30#include "../exception/exceptionoutofrange.h"
34ProteinIntegerCode::ProteinIntegerCode(
ProteinSp protein,
36 std::size_t aa_str_max_size)
40 if(aa_str_max_size > 7)
43 QObject::tr(
"aa_str_max_size exceeds max size"));
46 QString seq_str = protein.get()->getSequence();
49 for(
const QChar &aa_str : seq_str)
54 for(std::size_t i = 2; i <= aa_str_max_size; i++)
73std::vector<std::uint32_t>
77 std::vector<std::uint32_t> fragments;
79 int max = (m_seqAaCode.size() - fragment_size);
83 auto it = m_seqAaCode.begin();
84 for(
int i = 0; i <=
max; i++)
86 fragments.push_back(codec.
codeLlc(it, fragment_size));
94const std::vector<std::uint32_t> &
102 std::size_t indice = size - 2;
103 if(indice < m_peptideCodedFragments.size())
105 return m_peptideCodedFragments.at(indice);
112std::vector<std::pair<std::size_t, std::uint32_t>>
114 const std::vector<uint32_t> &code_list_in)
const
116 std::vector<std::pair<std::size_t, std::uint32_t>> return_pos;
117 std::vector<uint32_t> code_list = code_list_in;
119 std::sort(code_list.begin(), code_list.end());
120 auto it_end = std::unique(code_list.begin(), code_list.end());
121 for(
auto it_code = code_list.begin(); it_code != it_end; it_code++)
124 std::size_t size = 2;
125 for(
auto &liste_protein_seq_code : m_peptideCodedFragments)
128 auto it_seq_position = std::find(liste_protein_seq_code.begin(),
129 liste_protein_seq_code.end(),
131 while(it_seq_position != liste_protein_seq_code.end())
134 std::size_t position =
135 std::distance(liste_protein_seq_code.begin(), it_seq_position);
136 return_pos.push_back({size, position});
138 it_seq_position = std::find(
139 ++it_seq_position, liste_protein_seq_code.end(), *it_code);
uint8_t getAaCode(char aa_letter) const
const AaCode & getAaCode() const
uint32_t codeLlc(const QString &aa_str) const
get the lowest common denominator integer from amino acide suite string
const std::vector< std::uint32_t > & getPeptideCodedFragment(std::size_t size) const
std::vector< std::pair< std::size_t, std::uint32_t > > match(const std::vector< uint32_t > &code_list) const
std::vector< std::uint8_t > m_seqAaCode
ProteinIntegerCode(ProteinSp protein, const AaStringCodec &codec, std::size_t aa_str_max_size=5)
std::vector< std::vector< std::uint32_t > > m_peptideCodedFragments
std::vector< std::uint32_t > computePeptideCodeFragments(const AaStringCodec &codec, std::size_t fragment_size) const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< const Protein > ProteinSp
shared pointer on a Protein object
@ max
maximum of intensities
transform protein amino acid sequence into vectors of amino acid codes