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 (Enums::AminoAcidChar aa_char)
 
 Aa (const Aa &aa)
 
 Aa (Aa &&toCopy)
 
Aaoperator= (const Aa &toCopy)
 
virtual ~Aa ()
 
pappso_double getMass () const override
 
int getNumberOfAtom (Enums::AtomIsotopeSurvey atom) const override final
 get the number of atom C, O, N, H in the molecule
 
int getNumberOfIsotope (Enums::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
 
void removeAllButInternalModification ()
 remove all non internal 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 Enums::AminoAcidChargetAminoAcidChar () const
 
virtual void replaceLeucineIsoleucine ()
 
- Public Member Functions inherited from pappso::AtomNumberInterface
virtual const ChemicalFormula getChemicalFormula () const
 

Private Attributes

std::vector< AaModificationPm_listMod
 

Additional Inherited Members

- Static Public Member Functions inherited from pappso::AaBase
static const std::vector< Enums::AminoAcidChar > & getAminoAcidCharList ()
 
- Protected Member Functions inherited from pappso::AaBase
 AaBase (char aa_letter)
 
 AaBase (Enums::AminoAcidChar aa_char)
 
 AaBase (const AaBase &aabase)
 
virtual ~AaBase ()
 
int getNumberOfIsotope (Enums::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:43

References pappso::AaBase::AaBase().

Referenced by Aa(), Aa(), isAaEqual(), isLesser(), and operator=().

◆ Aa() [2/4]

pappso::Aa::Aa ( Enums::AminoAcidChar aa_char)

Definition at line 46 of file aa.cpp.

46 : AaBase(aa_char)
47{
48}

References pappso::AaBase::AaBase().

◆ 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:98

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

◆ 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}

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

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

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

References pappso::AaModification::getAccession(), and 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:356
double pappso_double
A type definition for doubles.
Definition types.h:61

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 ( Enums::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(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition aabase.cpp:363

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

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

◆ getNumberOfIsotope()

int pappso::Aa::getNumberOfIsotope ( Enums::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().

◆ isAaEqual()

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

Definition at line 279 of file aa.cpp.

280{
281
282 return (std::tie(m_aaLetter, m_listMod) == std::tie(r.m_aaLetter, r.m_listMod));
283}
char m_aaLetter
Definition aabase.h:68

References Aa(), pappso::AaBase::m_aaLetter, and m_listMod.

Referenced by pappso::operator==().

◆ isLesser()

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

Definition at line 254 of file aa.cpp.

255{
256 qDebug() << m_listMod << "//" << r.m_listMod;
257 // qDebug() << "operator<(const Aa& l, const Aa& r)";
258 if(m_aaLetter == r.m_aaLetter)
259 {
260 std::size_t a = m_listMod.size();
261 std::size_t b = r.m_listMod.size();
262
263 if(a == b)
264 {
265 return (m_listMod < r.m_listMod);
266 }
267 else
268 {
269 return (a < b);
270 }
271 }
272 else
273 {
274 return (m_aaLetter < r.m_aaLetter);
275 }
276}

References Aa(), 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 Aa(), 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 = std::find(m_listMod.begin(), m_listMod.end(), mod);
180 if(it != m_listMod.end())
181 {
182 m_listMod.erase(it);
183 }
184
185 qDebug() << m_listMod << Qt::endl;
186}

References m_listMod.

◆ removeAllButInternalModification()

void pappso::Aa::removeAllButInternalModification ( )

remove all non internal modifications

Definition at line 247 of file aa.cpp.

248{
249
250 m_listMod.clear();
251}

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

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}
const AaModification * AaModificationP

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: