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 ()
 

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() << "Aa::addAaModification begin";
193 qDebug() << aaModification->getAccession();
194 m_listMod.push_back(aaModification);
195 sort(m_listMod.begin(), m_listMod.end());
196}

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 258 of file aa.cpp.

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

References m_listMod.

◆ getInternalNterModification()

AaModificationP pappso::Aa::getInternalNterModification ( ) const

Definition at line 247 of file aa.cpp.

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

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:386
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 206 of file aa.cpp.

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

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 220 of file aa.cpp.

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

References m_listMod.

◆ getNumberOfModification()

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

Definition at line 233 of file aa.cpp.

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

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 333 of file aa.cpp.

334{
335
336 return (std::tie(m_aaLetter, m_listMod) ==
337 std::tie(r.m_aaLetter, r.m_listMod));
338}
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 308 of file aa.cpp.

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

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 295 of file aa.cpp.

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

References m_listMod.

◆ removeInternalCterModification()

void pappso::Aa::removeInternalCterModification ( )

Definition at line 282 of file aa.cpp.

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

References m_listMod.

◆ removeInternalNterModification()

void pappso::Aa::removeInternalNterModification ( )

Definition at line 269 of file aa.cpp.

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

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 199 of file aa.cpp.

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

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:433

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: