85 uint8_t aa_code = m_asciiTable[aa_letter];
90 QObject::tr(
"getAaCode(char aa_letter) error, %1 is null : no amino acid for letter \"%2\"")
94 else if(aa_code >= m_massCollection.size())
97 QObject::tr(
"getAaCode(char aa_letter) error, %1 amino acid code not found in "
98 "m_aaCollection for letter \"%2\"")
109 uint8_t aa_code = m_asciiTable[(char)aa];
114 QObject::tr(
"getAaCode(pappso::Enums::AminoAcidChar aa) error, %1 is null : no amino acid "
119 else if(aa_code >= m_massCollection.size())
122 QObject::tr(
"getAaCode(pappso::Enums::AminoAcidChar aa) error, %1 amino acid code not "
123 "found in m_aaCollection for letter \"%2\"")
135 if (aa_letter ==
'L')
return m_leucine;
136 auto it = std::find_if(m_aaCollection.begin(), m_aaCollection.end(), [aa_letter](
const Aa &aa) {
137 if(aa.getLetter() == aa_letter)
141 if(it != m_aaCollection.end())
146 QObject::tr(
"error, %1 amino acid not found in m_aaCollection").arg(aa_letter));
156 QObject::tr(
"error, 0 is null : no amino acid").arg(aa_code));
158 else if(aa_code > 19)
161 QObject::tr(
"error, %1 amino acid code not found in m_aaCollection").arg(aa_code));
163 return m_aaCollection[aa_code - 1];
171 auto it = std::find_if(m_aaCollection.begin(), m_aaCollection.end(), [aa_letter](
const Aa &aa) {
172 if(aa.getLetter() == aa_letter)
176 if(it != m_aaCollection.end())
178 it->addAaModification(aaModification);
183 QObject::tr(
"error, %1 amino acid not found in m_aaCollection").arg(aa_letter));
194 std::sort(m_aaCollection.begin(), m_aaCollection.end(), [](
const Aa &aa1,
const Aa &aa2) {
195 return aa1.getMass() < aa2.getMass();
199 for(
const Aa &aa : m_aaCollection)
202 m_asciiTable[aa.getLetter()] = n;
205 m_asciiTable[
'L'] = m_asciiTable[
'I'];
213 m_massCollection.resize(1);
215 for(
const Aa &aa : m_aaCollection)
217 m_massCollection.push_back(aa.getMass());
225 return m_massCollection[aa_code];
233 return m_massCollection[this->getAaCode(aa_letter)];
239 QObject::tr(
"getMass(char aa_letter) failed :\n%1").arg(err.
qwhat()));
246 double delta = precision->
delta(mass);
247 double mass_min = mass - delta;
248 double mass_max = mass + delta;
250 for(uint8_t i = 1; i < m_massCollection.size(); i++)
252 if(m_massCollection.at(i) >= mass_min)
254 if(m_massCollection.at(i) <= mass_max)
264const std::vector<Aa> &
267 return m_aaCollection;
collection of integer code for each amino acid 0 => null 1 to 20 => amino acid sorted by there mass (...
void updateNumbers()
give a number (the code) to each amino acid sorted by mass
void addAaModification(char aa_letter, AaModificationP aaModification)
add a modification on an amino acid for example carbamido on C
std::vector< uint8_t > m_asciiTable
void updateMass()
update mass cache
uint8_t getAaCodeByMass(double mass, PrecisionPtr precision) const
get the integer code of an amino acid given a mass and a precision
const std::vector< Aa > & getAaCollection() const
uint8_t getAaCode(char aa_letter) const
get the integer code of an amino acid with the one letter code
double getMass(uint8_t aa_code) const
get the mass of the amino acid given its integer code the amino acid can bear some modification (if a...
std::size_t getSize() const
std::vector< Aa > m_aaCollection
const Aa & getAa(char aa_letter) const
get the Aa object from the one letter code
virtual const QString & qwhat() const
virtual pappso_double delta(pappso_double value) const =0
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...