libpappsomspp
Library for mass spectrometry
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 More...
 
int getNumberOfIsotope (Isotope isotope) const override final
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule More...
 
unsigned int getNumberOfModification (AaModificationP mod) const
 
const QString toString () const
 
const QString toAbsoluteString () const
 
void addAaModification (AaModificationP aaModification)
 
void removeAaModification (AaModificationP aaModification)
 
void replaceAaModification (AaModificationP oldmod, AaModificationP newmod)
 replaces all occurences of a modification by a new one More...
 
AaModificationP getInternalNterModification () const
 
AaModificationP getInternalCterModification () const
 
void removeInternalNterModification ()
 
void removeInternalCterModification ()
 
const std::vector< AaModificationP > & getModificationList () const
 
bool isLesser (Aa const &r) const
 
bool isAaEqual (Aa const &r) const
 
- Public Member Functions inherited from pappso::AaBase
virtual pappso_double getMass () const
 
virtual const char & getLetter () const
 
const AminoAcidChargetAminoAcidChar () const
 
virtual void replaceLeucineIsoleucine ()
 
virtual int getNumberOfAtom (AtomIsotopeSurvey atom) const =0
 get the number of atom C, O, N, H in the molecule More...
 
virtual int getNumberOfIsotope (Isotope isotope) const =0
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule More...
 

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 ()
 
virtual int getNumberOfAtom (AtomIsotopeSurvey atom) const override
 get the number of atom C, O, N, H in the molecule More...
 
int getNumberOfIsotope (Isotope isotope) const override
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule More...
 
- 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:89

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

151{
152 qDebug() << "Aa::addAaModification begin";
153 qDebug() << aaModification->getAccession();
154 m_listMod.push_back(aaModification);
155 sort(m_listMod.begin(), m_listMod.end());
156}

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

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

◆ getInternalCterModification()

AaModificationP pappso::Aa::getInternalCterModification ( ) const

Definition at line 218 of file aa.cpp.

219{
220 for(auto &&modb : m_listMod)
221 {
222 if(modb->getAccession().startsWith("internal:Cter_"))
223 return modb;
224 }
225 return nullptr;
226}

References m_listMod.

◆ getInternalNterModification()

AaModificationP pappso::Aa::getInternalNterModification ( ) const

Definition at line 207 of file aa.cpp.

208{
209 for(auto &&modb : m_listMod)
210 {
211 if(modb->getAccession().startsWith("internal:Nter_"))
212 return modb;
213 }
214 return nullptr;
215}

References m_listMod.

◆ getMass()

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

Reimplemented from pappso::AaBase.

Definition at line 79 of file aa.cpp.

80{
81 // qDebug() << "Aa::getMass() begin";
83 for(auto &&mod : m_listMod)
84 {
85 mass += mod->getMass();
86 }
87
88 // qDebug() << "Aa::getMass() end " << mass;
89 return mass;
90}
virtual pappso_double getMass() const
Definition: aabase.cpp:387
double pappso_double
A type definition for doubles.
Definition: types.h:50

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

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

◆ getModificationList()

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

Definition at line 73 of file aa.cpp.

74{
75 return m_listMod;
76}

References m_listMod.

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

167{
168 int number_of_carbon = AaBase::getNumberOfAtom(atom);
169 for(auto &&mod : m_listMod)
170 {
171 number_of_carbon += mod->getNumberOfAtom(atom);
172 }
173
174 // qDebug() << "Aa::getMass() end " << mass;
175 return number_of_carbon;
176}
virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition: aabase.cpp:394

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

181{
182 int number = 0;
183 for(auto &&mod : m_listMod)
184 {
185 number += mod->getNumberOfIsotope(isotope);
186 }
187
188 // qDebug() << "Aa::getMass() end " << mass;
189 return number;
190}

References m_listMod.

◆ getNumberOfModification()

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

Definition at line 193 of file aa.cpp.

194{
195 unsigned int number_of_mod = 0;
196 for(auto &&modb : m_listMod)
197 {
198 if(modb == mod)
199 number_of_mod += 1;
200 }
201
202 // qDebug() << "Aa::getMass() end " << mass;
203 return number_of_mod;
204}

References m_listMod.

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

◆ isAaEqual()

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

Definition at line 272 of file aa.cpp.

273{
274
275 return (std::tie(m_aaLetter, m_listMod) ==
276 std::tie(r.m_aaLetter, r.m_listMod));
277}
char m_aaLetter
Definition: aabase.h:67

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

Referenced by pappso::operator==().

◆ isLesser()

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

Definition at line 247 of file aa.cpp.

248{
249 qDebug() << m_listMod << "//" << r.m_listMod;
250 // qDebug() << "operator<(const Aa& l, const Aa& r)";
251 if(m_aaLetter == r.m_aaLetter)
252 {
253 std::size_t a = m_listMod.size();
254 std::size_t b = r.m_listMod.size();
255
256 if(a == b)
257 {
258 return (m_listMod < r.m_listMod);
259 }
260 else
261 {
262 return (a < b);
263 }
264 }
265 else
266 {
267 return (m_aaLetter < r.m_aaLetter);
268 }
269}

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

138{
139 std::vector<AaModificationP>::iterator it =
140 std::find(m_listMod.begin(), m_listMod.end(), mod);
141 if(it != m_listMod.end())
142 {
143 m_listMod.erase(it);
144 }
145
146 qDebug() << m_listMod << Qt::endl;
147}

References m_listMod.

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

◆ removeInternalCterModification()

void pappso::Aa::removeInternalCterModification ( )

Definition at line 238 of file aa.cpp.

239{
240 std::remove_if(
241 m_listMod.begin(), m_listMod.end(), [](AaModificationP const &mod) {
242 return mod->getAccession().startsWith("internal:Cter_");
243 });
244}
const AaModification * AaModificationP

References m_listMod.

◆ removeInternalNterModification()

void pappso::Aa::removeInternalNterModification ( )

Definition at line 229 of file aa.cpp.

230{
231 std::remove_if(
232 m_listMod.begin(), m_listMod.end(), [](AaModificationP const &mod) {
233 return mod->getAccession().startsWith("internal:Nter_");
234 });
235}

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

160{
161 std::replace(m_listMod.begin(), m_listMod.end(), oldmod, newmod);
162 sort(m_listMod.begin(), m_listMod.end());
163}

References m_listMod.

◆ toAbsoluteString()

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

Definition at line 93 of file aa.cpp.

94{
95 QString seq = "";
96 seq += this->getLetter();
97 auto it(m_listMod.begin());
98 if(it != m_listMod.end())
99 {
100 QStringList modification_str_list;
101 while(it != m_listMod.end())
102 {
103 modification_str_list << (*it)->getAccession();
104 it++;
105 }
106 if(modification_str_list.size() > 0)
107 seq += QString("(%1)").arg(modification_str_list.join(","));
108 }
109 return seq;
110}
virtual const char & getLetter() const
Definition: aabase.cpp:434

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

◆ toString()

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

Definition at line 113 of file aa.cpp.

114{
115 QString seq = "";
116 seq += this->getLetter();
117 auto it(m_listMod.begin());
118 if(it != m_listMod.end())
119 {
120 QStringList modification_str_list;
121 while(it != m_listMod.end())
122 {
123 if(!(*it)->isInternal())
124 {
125 modification_str_list << (*it)->getAccession();
126 }
127 it++;
128 }
129 if(modification_str_list.size() > 0)
130 seq += QString("(%1)").arg(modification_str_list.join(","));
131 }
132 return seq;
133}

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

Member Data Documentation

◆ m_listMod


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