libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::Aa Class Reference

#include <aa.h>

Inheritance diagram for pappso::Aa:
pappso::AaBase pappso::AtomNumberInterface

Public Member Functions

 Aa (char aa_letter)
 
 Aa (AminoAcidChar aa_char)
 
 Aa (const Aa &aa)
 
 Aa (Aa &&toCopy)
 
Aaoperator= (const Aa &toCopy)
 
virtual ~Aa ()
 
pappso_double getMass () const override
 
int getNumberOfAtom (AtomIsotopeSurvey atom) const override final
 get the number of atom C, O, N, H in the molecule
 
int getNumberOfIsotope (Isotope isotope) const override final
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
 
unsigned int getNumberOfModification (AaModificationP mod) const
 
const QString toString () const
 
const QString toAbsoluteString () const
 
const QString toProForma () const
 get the amino acid in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README.md
 
void addAaModification (AaModificationP aaModification)
 
void removeAaModification (AaModificationP aaModification)
 
void replaceAaModification (AaModificationP oldmod, AaModificationP newmod)
 replaces all occurences of a modification by a new one
 
AaModificationP getInternalNterModification () const
 
AaModificationP getInternalCterModification () const
 
void removeInternalNterModification ()
 
void removeInternalCterModification ()
 
void removeAllButInternalModification ()
 remove all non internat modifications
 
const std::vector< AaModificationP > & getModificationList () const
 
double getTotalModificationMass () const
 get the sum of mass modifications
 
bool isLesser (Aa const &r) const
 
bool isAaEqual (Aa const &r) const
 
- Public Member Functions inherited from pappso::AaBase
virtual const char & getLetter () const
 
const AminoAcidChargetAminoAcidChar () const
 
virtual void replaceLeucineIsoleucine ()
 
- Public Member Functions inherited from pappso::AtomNumberInterface

Private Attributes

std::vector< AaModificationPm_listMod
 

Additional Inherited Members

- Static Public Member Functions inherited from pappso::AaBase
static const std::vector< AminoAcidChar > & getAminoAcidCharList ()
 
- Protected Member Functions inherited from pappso::AaBase
 AaBase (char aa_letter)
 
 AaBase (AminoAcidChar aa_char)
 
 AaBase (const AaBase &aabase)
 
virtual ~AaBase ()
 
int getNumberOfIsotope (Isotope isotope) const override
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
 
- Static Protected Member Functions inherited from pappso::AaBase
static pappso_double getAaMass (char aa_letter)
 
- Protected Attributes inherited from pappso::AaBase
char m_aaLetter
 

Detailed Description

Definition at line 44 of file aa.h.

Constructor & Destructor Documentation

◆ Aa() [1/4]

pappso::Aa::Aa ( char aa_letter)

Definition at line 41 of file aa.cpp.

41 : AaBase(aa_letter)
42{
43}
AaBase(char aa_letter)
Definition aabase.cpp:42

◆ Aa() [2/4]

pappso::Aa::Aa ( AminoAcidChar aa_char)

Definition at line 46 of file aa.cpp.

46 : AaBase(aa_char)
47{
48}

◆ Aa() [3/4]

pappso::Aa::Aa ( const Aa & aa)

Definition at line 50 of file aa.cpp.

50 : AaBase(other), m_listMod(other.m_listMod)
51{
52}
std::vector< AaModificationP > m_listMod
Definition aa.h:103

◆ Aa() [4/4]

pappso::Aa::Aa ( Aa && toCopy)

Definition at line 55 of file aa.cpp.

56 : AaBase(toCopy), m_listMod(std::move(toCopy.m_listMod))
57{
58}

◆ ~Aa()

pappso::Aa::~Aa ( )
virtual

Definition at line 60 of file aa.cpp.

61{
62}

Member Function Documentation

◆ addAaModification()

void pappso::Aa::addAaModification ( AaModificationP aaModification)

Definition at line 190 of file aa.cpp.

191{
192 qDebug() ;
193 qDebug() << aaModification->getAccession();
194 m_listMod.push_back(aaModification);
195 sort(m_listMod.begin(), m_listMod.end());
196 qDebug() ;
197}

References pappso::AaModification::getAccession(), and m_listMod.

Referenced by pappso::Peptide::Peptide(), pappso::PeptideProFormaParser::parseStringToPeptide(), and pappso::PeptideVariableModificationReplacement::replaceModificationsAtPosition().

◆ getInternalCterModification()

AaModificationP pappso::Aa::getInternalCterModification ( ) const

Definition at line 259 of file aa.cpp.

260{
261 for(auto &&modb : m_listMod)
262 {
263 if(modb->getAccession().startsWith("internal:Cter_"))
264 return modb;
265 }
266 return nullptr;
267}

References m_listMod.

◆ getInternalNterModification()

AaModificationP pappso::Aa::getInternalNterModification ( ) const

Definition at line 248 of file aa.cpp.

249{
250 for(auto &&modb : m_listMod)
251 {
252 if(modb->getAccession().startsWith("internal:Nter_"))
253 return modb;
254 }
255 return nullptr;
256}

References m_listMod.

◆ getMass()

pappso_double pappso::Aa::getMass ( ) const
overridevirtual

Reimplemented from pappso::AaBase.

Definition at line 90 of file aa.cpp.

91{
92 // qDebug() << "Aa::getMass() begin";
94 for(auto &&mod : m_listMod)
95 {
96 mass += mod->getMass();
97 }
98
99 // qDebug() << "Aa::getMass() end " << mass;
100 return mass;
101}
virtual pappso_double getMass() const
Definition aabase.cpp:389
double pappso_double
A type definition for doubles.
Definition types.h:50

References pappso::AaBase::getMass(), and m_listMod.

Referenced by pappso::specglob::PeptideModel::checkForMutation(), pappso::AaModification::createInstanceMutation(), and pappso::specglob::PeptideModel::ltrimOnRemoval().

◆ getModificationList()

const std::vector< AaModificationP > & pappso::Aa::getModificationList ( ) const

◆ getNumberOfAtom()

int pappso::Aa::getNumberOfAtom ( AtomIsotopeSurvey atom) const
finaloverridevirtual

get the number of atom C, O, N, H in the molecule

Reimplemented from pappso::AaBase.

Definition at line 207 of file aa.cpp.

208{
209 int number_of_carbon = AaBase::getNumberOfAtom(atom);
210 for(auto &&mod : m_listMod)
211 {
212 number_of_carbon += mod->getNumberOfAtom(atom);
213 }
214
215 // qDebug() << "Aa::getMass() end " << mass;
216 return number_of_carbon;
217}
virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition aabase.cpp:396

References pappso::AaBase::getNumberOfAtom(), and m_listMod.

Referenced by pappso::AaModification::createInstanceMutation().

◆ getNumberOfIsotope()

int pappso::Aa::getNumberOfIsotope ( Isotope isotope) const
finaloverridevirtual

get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule

Implements pappso::AtomNumberInterface.

Definition at line 221 of file aa.cpp.

222{
223 int number = 0;
224 for(auto &&mod : m_listMod)
225 {
226 number += mod->getNumberOfIsotope(isotope);
227 }
228
229 // qDebug() << "Aa::getMass() end " << mass;
230 return number;
231}

References m_listMod.

◆ getNumberOfModification()

unsigned int pappso::Aa::getNumberOfModification ( AaModificationP mod) const

Definition at line 234 of file aa.cpp.

235{
236 unsigned int number_of_mod = 0;
237 for(auto &&modb : m_listMod)
238 {
239 if(modb == mod)
240 number_of_mod += 1;
241 }
242
243 // qDebug() << "Aa::getMass() end " << mass;
244 return number_of_mod;
245}

References m_listMod.

Referenced by pappso::PeptideModificatorBase::getModificationPositionList().

◆ getTotalModificationMass()

double pappso::Aa::getTotalModificationMass ( ) const

get the sum of mass modifications

Definition at line 79 of file aa.cpp.

80{
81 double mass = 0;
82 for(auto &&mod : m_listMod)
83 {
84 mass += mod->getMass();
85 }
86 return mass;
87}

References m_listMod.

Referenced by pappso::specglob::PeptideModel::checkForAaModification(), and pappso::AaStringCodeMassMatching::getAaCodeFromMassWearingModification().

◆ isAaEqual()

bool pappso::Aa::isAaEqual ( Aa const & r) const

Definition at line 334 of file aa.cpp.

335{
336
337 return (std::tie(m_aaLetter, m_listMod) ==
338 std::tie(r.m_aaLetter, r.m_listMod));
339}
char m_aaLetter
Definition aabase.h:68

References pappso::AaBase::m_aaLetter, and m_listMod.

Referenced by pappso::operator==().

◆ isLesser()

bool pappso::Aa::isLesser ( Aa const & r) const

Definition at line 309 of file aa.cpp.

310{
311 qDebug() << m_listMod << "//" << r.m_listMod;
312 // qDebug() << "operator<(const Aa& l, const Aa& r)";
313 if(m_aaLetter == r.m_aaLetter)
314 {
315 std::size_t a = m_listMod.size();
316 std::size_t b = r.m_listMod.size();
317
318 if(a == b)
319 {
320 return (m_listMod < r.m_listMod);
321 }
322 else
323 {
324 return (a < b);
325 }
326 }
327 else
328 {
329 return (m_aaLetter < r.m_aaLetter);
330 }
331}

References pappso::a, pappso::b, pappso::AaBase::m_aaLetter, and m_listMod.

Referenced by pappso::operator<().

◆ operator=()

Aa & pappso::Aa::operator= ( const Aa & toCopy)

Definition at line 65 of file aa.cpp.

66{
67 m_aaLetter = toCopy.m_aaLetter;
68 m_listMod = toCopy.m_listMod;
69 return *this;
70}

References pappso::AaBase::m_aaLetter, and m_listMod.

◆ removeAaModification()

void pappso::Aa::removeAaModification ( AaModificationP aaModification)

Definition at line 177 of file aa.cpp.

178{
179 std::vector<AaModificationP>::iterator it =
180 std::find(m_listMod.begin(), m_listMod.end(), mod);
181 if(it != m_listMod.end())
182 {
183 m_listMod.erase(it);
184 }
185
186 qDebug() << m_listMod << Qt::endl;
187}

References m_listMod.

Referenced by pappso::PeptideVariableModificationReplacement::replaceModificationsAtPosition().

◆ removeAllButInternalModification()

void pappso::Aa::removeAllButInternalModification ( )

remove all non internat modifications

Definition at line 296 of file aa.cpp.

297{
298
299 m_listMod.erase(std::remove_if(m_listMod.begin(),
300 m_listMod.end(),
301 [](AaModificationP const &mod) {
302 return !mod->getAccession().startsWith(
303 "internal:");
304 }),
305 m_listMod.end());
306}
const AaModification * AaModificationP

References m_listMod.

◆ removeInternalCterModification()

void pappso::Aa::removeInternalCterModification ( )

Definition at line 283 of file aa.cpp.

284{
285 m_listMod.erase(std::remove_if(m_listMod.begin(),
286 m_listMod.end(),
287 [](AaModificationP const &mod) {
288 return mod->getAccession().startsWith(
289 "internal:Cter_");
290 }),
291 m_listMod.end());
292 sort(m_listMod.begin(), m_listMod.end());
293}

References m_listMod.

◆ removeInternalNterModification()

void pappso::Aa::removeInternalNterModification ( )

Definition at line 270 of file aa.cpp.

271{
272 m_listMod.erase(std::remove_if(m_listMod.begin(),
273 m_listMod.end(),
274 [](AaModificationP const &mod) {
275 return mod->getAccession().startsWith(
276 "internal:Nter_");
277 }),
278 m_listMod.end());
279 sort(m_listMod.begin(), m_listMod.end());
280}

References m_listMod.

◆ replaceAaModification()

void pappso::Aa::replaceAaModification ( AaModificationP oldmod,
AaModificationP newmod )

replaces all occurences of a modification by a new one

Parameters
oldmodmodification to change
newmodnew modification

Definition at line 200 of file aa.cpp.

201{
202 std::replace(m_listMod.begin(), m_listMod.end(), oldmod, newmod);
203 sort(m_listMod.begin(), m_listMod.end());
204}

References m_listMod.

◆ toAbsoluteString()

const QString pappso::Aa::toAbsoluteString ( ) const

Definition at line 104 of file aa.cpp.

105{
106 QString seq = "";
107 seq += this->getLetter();
108 auto it(m_listMod.begin());
109 if(it != m_listMod.end())
110 {
111 QStringList modification_str_list;
112 while(it != m_listMod.end())
113 {
114 modification_str_list << (*it)->getAccession();
115 it++;
116 }
117 if(modification_str_list.size() > 0)
118 seq += QString("(%1)").arg(modification_str_list.join(","));
119 }
120 return seq;
121}
virtual const char & getLetter() const
Definition aabase.cpp:436

References pappso::AaBase::getLetter(), and m_listMod.

◆ toProForma()

const QString pappso::Aa::toProForma ( ) const

get the amino acid in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README.md

Returns
QString as described in ProForma

Definition at line 147 of file aa.cpp.

148{
149 QString seq = "";
150 seq += this->getLetter();
151
152 std::vector<AaModificationP> copy_mod_list = m_listMod;
153 std::sort(copy_mod_list.begin(),
154 copy_mod_list.end(),
155 [](const AaModificationP &a, const AaModificationP &b) {
156 return a->getAccession() < b->getAccession();
157 });
158 auto it(copy_mod_list.begin());
159 if(it != copy_mod_list.end())
160 {
161 QStringList modification_str_list;
162 while(it != copy_mod_list.end())
163 {
164 if(!(*it)->isInternal())
165 {
166 modification_str_list << (*it)->toProForma();
167 }
168 it++;
169 }
170 if(modification_str_list.size() > 0)
171 seq += QString("[%1]").arg(modification_str_list.join("]["));
172 }
173 return seq;
174}

References pappso::a, pappso::b, pappso::AaBase::getLetter(), and m_listMod.

◆ toString()

const QString pappso::Aa::toString ( ) const

Definition at line 124 of file aa.cpp.

125{
126 QString seq = "";
127 seq += this->getLetter();
128 auto it(m_listMod.begin());
129 if(it != m_listMod.end())
130 {
131 QStringList modification_str_list;
132 while(it != m_listMod.end())
133 {
134 if(!(*it)->isInternal())
135 {
136 modification_str_list << (*it)->getAccession();
137 }
138 it++;
139 }
140 if(modification_str_list.size() > 0)
141 seq += QString("(%1)").arg(modification_str_list.join(","));
142 }
143 return seq;
144}

References pappso::AaBase::getLetter(), and m_listMod.

Member Data Documentation

◆ m_listMod


The documentation for this class was generated from the following files: