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

#include <aamodification.h>

Inheritance diagram for pappso::AaModification:
pappso::AtomNumberInterface

Public Member Functions

 AaModification (AaModification &&toCopy)
 
const QString & getAccession () const
 
const QString & getName () const
 
 ~AaModification ()
 
pappso_double getMass () const
 
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
 
bool isInternal () const
 

Static Public Member Functions

static AaModificationP getInstance (const QString &accession)
 
static AaModificationP getInstance (const OboPsiModTerm &oboterm)
 
static AaModificationP getInstanceMutation (const QChar &mut_from, const QChar &mut_to)
 get a fake modification coding a mutation from an amino acid to an other
 
static AaModificationP getInstanceXtandemMod (const QString &type, pappso_double mass, const PeptideSp &peptide_sp, unsigned int position)
 
static AaModificationP getInstanceCustomizedMod (pappso_double modificationMass)
 

Protected Member Functions

void setDiffFormula (const QString &diff_formula)
 
void setXrefOrigin (const QString &origin)
 set list of amino acid on which this modification takes place
 

Protected Attributes

const QString m_accession
 
QString m_name
 

Private Types

using MapAccessionModifications = std::map< QString, AaModificationP >
 

Private Member Functions

 AaModification (const QString &accession, pappso_double mass)
 
void calculateMassFromChemicalComponents ()
 

Static Private Member Functions

static AaModificationP createInstance (const QString &saccession)
 
static AaModificationP createInstance (const OboPsiModTerm &term)
 
static AaModificationP createInstanceMutation (const Aa &aa_from, const Aa &aa_to)
 
static AaModificationP createInstanceC13N15LabelledAminoAcid (const QChar &aa_from)
 get heavy amino acid modification C13 N15
 

Private Attributes

pappso_double m_mass
 
QString m_origin
 
std::map< AtomIsotopeSurvey, int > m_atomCount
 
std::map< Isotope, int > m_mapIsotope
 

Static Private Attributes

static MapAccessionModifications m_mapAccessionModifications
 
static QMutex m_mutex
 

Detailed Description

Definition at line 56 of file aamodification.h.

Member Typedef Documentation

◆ MapAccessionModifications

Definition at line 119 of file aamodification.h.

Constructor & Destructor Documentation

◆ AaModification() [1/2]

pappso::AaModification::AaModification ( AaModification &&  toCopy)

Definition at line 76 of file aamodification.cpp.

77 : m_accession(toCopy.m_accession),
78 m_name(toCopy.m_name),
79 m_mass(toCopy.m_mass),
80 m_atomCount(std::move(toCopy.m_atomCount)),
81 m_mapIsotope(toCopy.m_mapIsotope)
82{
83 m_origin = toCopy.m_origin;
84}
std::map< Isotope, int > m_mapIsotope
std::map< AtomIsotopeSurvey, int > m_atomCount
const QString m_accession

References m_origin.

◆ ~AaModification()

pappso::AaModification::~AaModification ( )

Definition at line 86 of file aamodification.cpp.

87{
88}

◆ AaModification() [2/2]

Member Function Documentation

◆ calculateMassFromChemicalComponents()

void pappso::AaModification::calculateMassFromChemicalComponents ( )
private

Definition at line 312 of file aamodification.cpp.

313{
314 pappso_double theoreticalm_mass = 0;
315 std::map<AtomIsotopeSurvey, int>::const_iterator it_atom =
317 if(it_atom != m_atomCount.end())
318 {
319 theoreticalm_mass += MASSCARBON * (it_atom->second);
320 }
321 it_atom = m_atomCount.find(AtomIsotopeSurvey::H);
322 if(it_atom != m_atomCount.end())
323 {
324 theoreticalm_mass += MPROTIUM * (it_atom->second);
325 }
326
327 it_atom = m_atomCount.find(AtomIsotopeSurvey::O);
328 if(it_atom != m_atomCount.end())
329 {
330 theoreticalm_mass += MASSOXYGEN * (it_atom->second);
331 }
332
333 it_atom = m_atomCount.find(AtomIsotopeSurvey::N);
334 if(it_atom != m_atomCount.end())
335 {
336 theoreticalm_mass += MASSNITROGEN * (it_atom->second);
337 }
338 it_atom = m_atomCount.find(AtomIsotopeSurvey::S);
339 if(it_atom != m_atomCount.end())
340 {
341 theoreticalm_mass += MASSSULFUR * (it_atom->second);
342 }
343
344 qDebug() << theoreticalm_mass;
345
346 theoreticalm_mass += DIFFC12C13 * m_mapIsotope.at(Isotope::C13);
347 theoreticalm_mass += DIFFH1H2 * m_mapIsotope.at(Isotope::H2);
348 theoreticalm_mass += DIFFN14N15 * m_mapIsotope.at(Isotope::N15);
349 theoreticalm_mass += DIFFO16O17 * m_mapIsotope.at(Isotope::O17);
350 theoreticalm_mass += DIFFO16O18 * m_mapIsotope.at(Isotope::O18);
351 theoreticalm_mass += DIFFS32S33 * m_mapIsotope.at(Isotope::S33);
352 theoreticalm_mass += DIFFS32S34 * m_mapIsotope.at(Isotope::S34);
353 theoreticalm_mass += DIFFS32S36 * m_mapIsotope.at(Isotope::S36);
354
355
356 if(m_mass == 0.0)
357 {
358 m_mass = theoreticalm_mass;
359 }
360 else
361 {
362 pappso_double diff = std::fabs((pappso_double)m_mass - theoreticalm_mass);
363 if(diff < 0.001)
364 {
365 m_mass = theoreticalm_mass;
366 qDebug() << diff;
367 }
368 else
369 {
370 qDebug()
371 << "ERROR in AaModification::calculateMassFromChemicalComponents "
372 "theo="
373 << theoreticalm_mass << " m=" << m_mass << " diff=" << diff
374 << " accession=" << m_accession;
375 }
376 }
377}
const pappso_double DIFFS32S33(32.9714589101 - MASSSULFUR)
const pappso_double DIFFS32S34(33.9678670300 - MASSSULFUR)
const pappso_double DIFFO16O17(16.99913150 - MASSOXYGEN)
const pappso_double MASSCARBON(12)
const pappso_double MASSSULFUR(31.9720711741)
const pappso_double DIFFS32S36(35.9670812000 - MASSSULFUR)
double pappso_double
A type definition for doubles.
Definition types.h:50
const pappso_double MPROTIUM(1.007825032241)
const pappso_double MASSNITROGEN(14.0030740048)
const pappso_double MASSOXYGEN(15.99491461956)
const pappso_double DIFFO16O18(17.9991610 - MASSOXYGEN)
const pappso_double DIFFN14N15(15.0001088982 - MASSNITROGEN)
const pappso_double DIFFC12C13(1.0033548378)
const pappso_double DIFFH1H2(2.0141017778 - MPROTIUM)

References pappso::C, pappso::C13, pappso::DIFFC12C13(), pappso::DIFFH1H2(), pappso::DIFFN14N15(), pappso::DIFFO16O17(), pappso::DIFFO16O18(), pappso::DIFFS32S33(), pappso::DIFFS32S34(), pappso::DIFFS32S36(), pappso::H, pappso::H2, m_accession, m_atomCount, m_mapIsotope, m_mass, pappso::MASSCARBON(), pappso::MASSNITROGEN(), pappso::MASSOXYGEN(), pappso::MASSSULFUR(), pappso::MPROTIUM(), pappso::N, pappso::N15, pappso::O, pappso::O17, pappso::O18, pappso::S, pappso::S33, pappso::S34, and pappso::S36.

Referenced by setDiffFormula().

◆ createInstance() [1/2]

AaModificationP pappso::AaModification::createInstance ( const OboPsiModTerm term)
staticprivate

Definition at line 112 of file aamodification.cpp.

113{
114 AaModification *new_mod;
115 // qDebug() << " AaModification::createInstance begin";
116 new_mod = new AaModification(term.m_accession, term.m_diffMono);
117 // xref: DiffFormula: "C 0 H 0 N 0 O 1 S 0"
118 new_mod->setDiffFormula(term.m_diffFormula);
119 new_mod->setXrefOrigin(term.m_origin);
120 new_mod->m_name = term.m_name;
121 qDebug() << new_mod->m_mass;
122 return new_mod;
123}
AaModification(AaModification &&toCopy)

References pappso::OboPsiModTerm::m_accession, pappso::OboPsiModTerm::m_diffFormula, pappso::OboPsiModTerm::m_diffMono, m_mass, m_name, pappso::OboPsiModTerm::m_name, pappso::OboPsiModTerm::m_origin, setDiffFormula(), and setXrefOrigin().

◆ createInstance() [2/2]

AaModificationP pappso::AaModification::createInstance ( const QString &  saccession)
staticprivate

Definition at line 126 of file aamodification.cpp.

127{
128 if(accession == "internal:Nter_hydrolytic_cleavage_H")
129 {
130 OboPsiModTerm term;
131 term.m_accession = accession;
132 term.m_diffFormula = "H 1";
133 term.m_diffMono = MPROTIUM;
134 term.m_name = "Nter hydrolytic cleavage H+";
135 return (AaModification::createInstance(term));
136 }
137 if(accession == "internal:Cter_hydrolytic_cleavage_HO")
138 {
139 OboPsiModTerm term;
140 term.m_accession = accession;
141 term.m_diffFormula = "H 1 O 1";
142 term.m_diffMono = MPROTIUM + MASSOXYGEN;
143 term.m_name = "Cter hydrolytic cleavage HO";
144 return (AaModification::createInstance(term));
145 }
146 if(accession.startsWith("MUTATION:"))
147 {
148 QRegularExpression regexp_mutation("^MUTATION:([A-Z])=>([A-Z])$");
149 QRegularExpressionMatch match = regexp_mutation.match(accession);
150 if(match.hasMatch())
151 {
152 qDebug() << match.capturedTexts()[1].at(0) << " "
153 << match.capturedTexts()[2].at(0);
154
155 Aa aa_from(match.capturedTexts()[1].toStdString().c_str()[0]);
156 Aa aa_to(match.capturedTexts()[2].toStdString().c_str()[0]);
157 AaModificationP instance_mutation =
158 createInstanceMutation(aa_from, aa_to);
159 return instance_mutation;
160 // m_psiModLabel<<"|";
161 }
162 }
163 if(accession.startsWith("C13N15:"))
164 {
165 QRegularExpression regexp_label("^C13N15:([A-Z])$");
166 QRegularExpressionMatch match = regexp_label.match(accession);
167 if(match.hasMatch())
168 {
169 char labelled_aa(match.capturedTexts()[1].toStdString().c_str()[0]);
170
171 AaModificationP instance_labelled_aa_p =
172 createInstanceC13N15LabelledAminoAcid(QChar(labelled_aa));
173
174
175 return instance_labelled_aa_p;
176 // m_psiModLabel<<"|";
177 }
178 }
179 // initMyResource();
180 FilterOboPsiModSink term_list;
181 FilterOboPsiModTermAccession filterm_accession(term_list, accession);
182
183 OboPsiMod psimod(filterm_accession);
184
185 try
186 {
187 return (AaModification::createInstance(term_list.getOne()));
188 }
189 catch(ExceptionNotFound &e)
190 {
191 throw ExceptionNotFound(QObject::tr("modification not found : [%1]\n%2")
192 .arg(accession)
193 .arg(e.qwhat()));
194 }
195}
static AaModificationP createInstance(const QString &saccession)
static AaModificationP createInstanceC13N15LabelledAminoAcid(const QChar &aa_from)
get heavy amino acid modification C13 N15
static AaModificationP createInstanceMutation(const Aa &aa_from, const Aa &aa_to)
const AaModification * AaModificationP

References createInstance(), createInstanceC13N15LabelledAminoAcid(), createInstanceMutation(), pappso::FilterOboPsiModSink::getOne(), pappso::OboPsiModTerm::m_accession, pappso::OboPsiModTerm::m_diffFormula, pappso::OboPsiModTerm::m_diffMono, pappso::OboPsiModTerm::m_name, pappso::MASSOXYGEN(), pappso::MPROTIUM(), and pappso::PappsoException::qwhat().

Referenced by createInstance(), createInstanceC13N15LabelledAminoAcid(), getInstance(), and getInstance().

◆ createInstanceC13N15LabelledAminoAcid()

AaModificationP pappso::AaModification::createInstanceC13N15LabelledAminoAcid ( const QChar &  aa_from)
staticprivate

get heavy amino acid modification C13 N15

Parameters
aa_fromorginal amino acid

Definition at line 692 of file aamodification.cpp.

693{
694 switch(from_aa.toLatin1())
695 {
696 case 'R':
697 return createInstance("MOD:00587");
698 break;
699 case 'K':
700 return createInstance("MOD:00582");
701 break;
702 case 'F':
703 return createInstance("MOD:00589");
704 break;
705 }
706
707 // At this point we have no MOD ontology term for all the other amino-acid
708 // residue, we need to craft the stuff ourselves.
709
710 QString accession(QString("C13N15:%1").arg(from_aa));
711
712 // Define the diff formula for each amino acid code not handled above.
713
714 QString diff_formula;
715
716 switch(from_aa.toLatin1())
717 {
718 case 'G':
719 diff_formula = "(12)C -2 (13)C 2 (14)N -1 (15)N 1";
720 break;
721 case 'A':
722 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
723 break;
724 case 'V':
725 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
726 break;
727 case 'I':
728 diff_formula = "(12)C -6 (13)C 6 (14)N -1 (15)N 1";
729 break;
730 case 'L':
731 diff_formula = "(12)C -6 (13)C 6 (14)N -1 (15)N 1";
732 break;
733 case 'S':
734 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
735 break;
736 case 'T':
737 diff_formula = "(12)C -4 (13)C 4 (14)N -1 (15)N 1";
738 break;
739 case 'C':
740 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
741 break;
742 case 'M':
743 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
744 break;
745 case 'D':
746 diff_formula = "(12)C -4 (13)C 4 (14)N -1 (15)N 1";
747 break;
748 case 'E':
749 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
750 break;
751 case 'N':
752 diff_formula = "(12)C -4 (13)C 4 (14)N -2 (15)N 2";
753 break;
754 case 'Q':
755 diff_formula = "(12)C -5 (13)C 5 (14)N -2 (15)N 2";
756 break;
757 case 'W':
758 diff_formula = "(12)C -11 (13)C 11 (14)N -2 (15)N 2";
759 break;
760 case 'Y':
761 diff_formula = "(12)C -9 (13)C 9 (14)N -1 (15)N 1";
762 break;
763 case 'H':
764 diff_formula = "(12)C -6 (13)C 6 (14)N -3 (15)N 3";
765 break;
766 case 'P':
767 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
768 break;
769 default:
770 throw PappsoException(
771 QObject::tr("ERROR creating C13N15-labelled amino acid residue %1\n")
772 .arg(from_aa));
773 }
774
775 OboPsiModTerm obo_psi_term;
776 obo_psi_term.m_accession = accession;
777 obo_psi_term.m_diffFormula = diff_formula;
778 obo_psi_term.m_name = QString("Fully C13N15-labelled %1").arg(from_aa);
779 obo_psi_term.m_diffMono = 0;
780
781 qDebug() << "obo_psi_term.m_diffFormula: " << obo_psi_term.m_diffFormula;
782 return AaModification::createInstance(obo_psi_term);
783}

References createInstance(), pappso::OboPsiModTerm::m_accession, pappso::OboPsiModTerm::m_diffFormula, pappso::OboPsiModTerm::m_diffMono, and pappso::OboPsiModTerm::m_name.

Referenced by createInstance().

◆ createInstanceMutation()

AaModificationP pappso::AaModification::createInstanceMutation ( const Aa aa_from,
const Aa aa_to 
)
staticprivate

Definition at line 616 of file aamodification.cpp.

617{
618 QString accession(
619 QString("MUTATION:%1=>%2").arg(aa_from.getLetter()).arg(aa_to.getLetter()));
620 double diffMono = aa_to.getMass() - aa_from.getMass();
621 // not found
622 AaModification *instance_mutation;
623 // qDebug() << " AaModification::createInstance begin";
624 instance_mutation = new AaModification(accession, diffMono);
625 // xref: DiffFormula: "C 0 H 0 N 0 O 1 S 0"
626
627 for(std::int8_t atomInt = (std::int8_t)AtomIsotopeSurvey::C;
628 atomInt != (std::int8_t)AtomIsotopeSurvey::last;
629 atomInt++)
630 {
631 AtomIsotopeSurvey atom = static_cast<AtomIsotopeSurvey>(atomInt);
632 instance_mutation->m_atomCount[atom] =
633 aa_to.getNumberOfAtom(atom) - aa_from.getNumberOfAtom(atom);
634 }
635 instance_mutation->m_name = QString("mutation from %1 to %2")
636 .arg(aa_from.getLetter())
637 .arg(aa_to.getLetter());
638 return instance_mutation;
639}
AtomIsotopeSurvey
Definition types.h:89

References pappso::C, pappso::AaBase::getLetter(), pappso::Aa::getMass(), pappso::Aa::getNumberOfAtom(), pappso::last, m_atomCount, and m_name.

Referenced by createInstance(), and getInstanceMutation().

◆ getAccession()

const QString & pappso::AaModification::getAccession ( ) const

◆ getInstance() [1/2]

AaModificationP pappso::AaModification::getInstance ( const OboPsiModTerm oboterm)
static

Definition at line 445 of file aamodification.cpp.

446{
447
448 QMutexLocker locker(&m_mutex);
449
450 std::pair<MapAccessionModifications::iterator, bool> insert_res =
452 std::pair<QString, AaModificationP>(oboterm.m_accession, nullptr));
453
454 if(!insert_res.second)
455 {
456 // Failed to insert, was there already by same key.
457 }
458 else
459 {
460 // Could insert (albeit with nullptr), was not there already by same key.
461 // Just assign to the *correct* pair member the pointer to an
462 // extemporaneously allocated AaModification.
463 insert_res.first->second = AaModification::createInstance(oboterm);
464 }
465
466 return insert_res.first->second;
467}
static MapAccessionModifications m_mapAccessionModifications

References createInstance(), pappso::OboPsiModTerm::m_accession, m_mapAccessionModifications, and m_mutex.

◆ getInstance() [2/2]

AaModificationP pappso::AaModification::getInstance ( const QString &  accession)
static

Definition at line 400 of file aamodification.cpp.

401{
402 try
403 {
404 QMutexLocker locker(&m_mutex);
405 MapAccessionModifications::iterator it =
406 m_mapAccessionModifications.find(accession);
407 if(it == m_mapAccessionModifications.end())
408 {
409
410 // not found
411 std::pair<MapAccessionModifications::iterator, bool> insert_res =
413 std::pair<QString, AaModificationP>(
414 accession, AaModification::createInstance(accession)));
415 it = insert_res.first;
416 }
417 else
418 {
419 // found
420 }
421 return it->second;
422 }
423 catch(ExceptionNotFound &e)
424 {
425 throw ExceptionNotFound(
426 QObject::tr("ERROR getting instance of : %1 NOT FOUND\n%2")
427 .arg(accession)
428 .arg(e.qwhat()));
429 }
430 catch(PappsoException &e)
431 {
432 throw PappsoException(QObject::tr("ERROR getting instance of %1\n%2")
433 .arg(accession)
434 .arg(e.qwhat()));
435 }
436 catch(std::exception &e)
437 {
438 throw PappsoException(QObject::tr("ERROR getting instance of %1\n%2")
439 .arg(accession)
440 .arg(e.what()));
441 }
442}

References createInstance(), m_mapAccessionModifications, m_mutex, pappso::PappsoException::qwhat(), and pappso::PappsoException::what().

Referenced by pappso::Peptide::Peptide(), pappso::PeptideFragment::PeptideFragment(), pappso::PeptideFragmentIonListBase::PeptideFragmentIonListBase(), getInstanceXtandemMod(), pappso::PeptideModificatorPipeline::parseFixedModification(), pappso::PeptideModificatorPipeline::parseLabeledModification(), pappso::PeptideModificatorPipeline::parsePotentialModification(), and pappso::PeptideStrParser::parseStringToPeptide().

◆ getInstanceCustomizedMod()

AaModificationP pappso::AaModification::getInstanceCustomizedMod ( pappso_double  modificationMass)
static

Definition at line 380 of file aamodification.cpp.

381{
382 QString accession = QString("%1").arg(modificationMass);
383 qDebug() << accession;
384 QMutexLocker locker(&m_mutex);
385 if(m_mapAccessionModifications.find(accession) ==
387 {
388 // not found
389 m_mapAccessionModifications.insert(std::pair<QString, AaModification *>(
390 accession, new AaModification(accession, modificationMass)));
391 }
392 else
393 {
394 // found
395 }
396 return m_mapAccessionModifications.at(accession);
397}

References m_mapAccessionModifications, and m_mutex.

Referenced by pappso::PeptideStrParser::parseStringToPeptide().

◆ getInstanceMutation()

AaModificationP pappso::AaModification::getInstanceMutation ( const QChar &  mut_from,
const QChar &  mut_to 
)
static

get a fake modification coding a mutation from an amino acid to an other

Parameters
mut_fromorginal amino acid
mut_totargeted amino acid

Definition at line 643 of file aamodification.cpp.

644{
645 QString accession(QString("MUTATION:%1=>%2").arg(mut_from).arg(mut_to));
646 try
647 {
648 QMutexLocker locker(&m_mutex);
649 MapAccessionModifications::iterator it =
650 m_mapAccessionModifications.find(accession);
651 if(it == m_mapAccessionModifications.end())
652 {
653 Aa aa_from(mut_from.toLatin1());
654 Aa aa_to(mut_to.toLatin1());
655 AaModificationP instance_mutation =
656 createInstanceMutation(aa_from, aa_to);
657
658 std::pair<MapAccessionModifications::iterator, bool> insert_res =
660 std::pair<QString, AaModificationP>(accession,
661 instance_mutation));
662 it = insert_res.first;
663 }
664 else
665 {
666 // found
667 }
668 return it->second;
669 }
670 catch(ExceptionNotFound &e)
671 {
672 throw ExceptionNotFound(
673 QObject::tr("ERROR getting instance of : %1 NOT FOUND\n%2")
674 .arg(accession)
675 .arg(e.qwhat()));
676 }
677 catch(PappsoException &e)
678 {
679 throw PappsoException(QObject::tr("ERROR getting instance of %1\n%2")
680 .arg(accession)
681 .arg(e.qwhat()));
682 }
683 catch(std::exception &e)
684 {
685 throw PappsoException(QObject::tr("ERROR getting instance of %1\n%2")
686 .arg(accession)
687 .arg(e.what()));
688 }
689}

References createInstanceMutation(), m_mapAccessionModifications, m_mutex, pappso::PappsoException::qwhat(), and pappso::PappsoException::what().

◆ getInstanceXtandemMod()

AaModificationP pappso::AaModification::getInstanceXtandemMod ( const QString &  type,
pappso_double  mass,
const PeptideSp peptide_sp,
unsigned int  position 
)
static

Definition at line 471 of file aamodification.cpp.

475{
477 if(MzRange(mass, precision).contains(getInstance("MOD:00719")->getMass()))
478 {
479 if(type == "M")
480 {
481 return getInstance("MOD:00719");
482 }
483 if(type == "K")
484 {
485 return getInstance("MOD:01047");
486 }
487 }
488 // accession== "MOD:00057"
489 if(MzRange(mass, precision).contains(getInstance("MOD:00408")->getMass()))
490 {
491 // id: MOD:00394
492 // name: acetylated residue
493 // potential N-terminus modifications
494 if(position == 0)
495 {
496 return getInstance("MOD:00408");
497 }
498 }
499 if(MzRange(mass, precision).contains(getInstance("MOD:01160")->getMass()))
500 {
501 //-17.02655
502 // loss of ammonia [MOD:01160] -17.026549
503 return getInstance("MOD:01160");
504 }
505
506 if(MzRange(mass, precision).contains(getInstance("MOD:01060")->getMass()))
507 {
508 //// iodoacetamide [MOD:00397] 57.021464
509 if(type == "C")
510 {
511 return getInstance("MOD:01060");
512 }
513 else
514 {
515 return getInstance("MOD:00397");
516 }
517 }
518 if(MzRange(mass, precision).contains(getInstance("MOD:00704")->getMass()))
519 {
520 // loss of water
521 /*
522 if (position == 0) {
523 if (peptide_sp.get()->getSequence().startsWith("EG")) {
524 return getInstance("MOD:00365");
525 }
526 if (peptide_sp.get()->getSequence().startsWith("ES")) {
527 return getInstance("MOD:00953");
528 }
529 if (type == "E") {
530 return getInstance("MOD:00420");
531 }
532 }
533 */
534 // dehydrated residue [MOD:00704] -18.010565
535 return getInstance("MOD:00704");
536 }
537 if(MzRange(mass, precision).contains(getInstance("MOD:00696")->getMass()))
538 {
539 // phosphorylated residue [MOD:00696] 79.966330
540 return getInstance("MOD:00696");
541 }
542 bool isCter = false;
543 if(peptide_sp.get()->size() == (position + 1))
544 {
545 isCter = true;
546 }
547 if((position == 0) || isCter)
548 {
549 if(MzRange(mass, precision).contains(getInstance("MOD:00429")->getMass()))
550 {
551 // dimethyl
552 return getInstance("MOD:00429");
553 }
554 if(MzRange(mass, precision).contains(getInstance("MOD:00552")->getMass()))
555 {
556 // 4x(2)H labeled dimethyl residue
557 return getInstance("MOD:00552");
558 }
559 if(MzRange(mass, precision).contains(getInstance("MOD:00638")->getMass()))
560 {
561 // 2x(13)C,6x(2)H-dimethylated arginine
562 return getInstance("MOD:00638");
563 }
564 }
565 throw PappsoException(
566 QObject::tr("tandem modification not found : %1 %2 %3 %4")
567 .arg(type)
568 .arg(mass)
569 .arg(peptide_sp.get()->getSequence())
570 .arg(position));
571}
pappso_double getMass() const
static AaModificationP getInstance(const QString &accession)
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
const PrecisionBase * PrecisionPtr
Definition precision.h:122

References pappso::PrecisionFactory::getDaltonInstance(), getInstance(), and getMass().

◆ getMass()

pappso_double pappso::AaModification::getMass ( ) const

◆ getName()

const QString & pappso::AaModification::getName ( ) const

Definition at line 99 of file aamodification.cpp.

100{
101 return m_name;
102}

References m_name.

◆ getNumberOfAtom()

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

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

Implements pappso::AtomNumberInterface.

Definition at line 581 of file aamodification.cpp.

582{
583 // qDebug() << "AaModification::getNumberOfAtom(AtomIsotopeSurvey atom) NOT
584 // IMPLEMENTED";
585 return m_atomCount.at(atom);
586}

References m_atomCount.

Referenced by pappso::PeptideFragment::getNumberOfAtom().

◆ getNumberOfIsotope()

int pappso::AaModification::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 590 of file aamodification.cpp.

591{
592 try
593 {
594 return m_mapIsotope.at(isotope);
595 }
596 catch(std::exception &e)
597 {
598 throw PappsoException(
599 QObject::tr("ERROR in AaModification::getNumberOfIsotope %2")
600 .arg(e.what()));
601 }
602}

References m_mapIsotope.

◆ isInternal()

bool pappso::AaModification::isInternal ( ) const

Definition at line 606 of file aamodification.cpp.

607{
608 if(m_accession.startsWith("internal:"))
609 {
610 return true;
611 }
612 return false;
613}

References m_accession.

◆ setDiffFormula()

void pappso::AaModification::setDiffFormula ( const QString &  diff_formula)
protected

Definition at line 205 of file aamodification.cpp.

206{
207 QRegularExpression rx("(^|\\s)([C,H,O,N,H,S])\\s([-]{0,1}\\d+)");
208 QRegularExpressionMatchIterator i = rx.globalMatch(diff_formula);
209
210 while(i.hasNext())
211 {
212 QRegularExpressionMatch match = i.next();
213
214 qDebug() << match.captured(2) << " " << match.captured(2) << " "
215 << match.captured(3);
216
217 if(match.captured(2) == "C")
218 {
219 m_atomCount[AtomIsotopeSurvey::C] = match.captured(3).toInt();
220 }
221 else if(match.captured(2) == "H")
222 {
223 m_atomCount[AtomIsotopeSurvey::H] = match.captured(3).toInt();
224 }
225 else if(match.captured(2) == "N")
226 {
227 m_atomCount[AtomIsotopeSurvey::N] = match.captured(3).toInt();
228 }
229 else if(match.captured(2) == "O")
230 {
231 m_atomCount[AtomIsotopeSurvey::O] = match.captured(3).toInt();
232 }
233 else if(match.captured(2) == "S")
234 {
235 m_atomCount[AtomIsotopeSurvey::S] = match.captured(3).toInt();
236 }
237 }
238
239 // look for isotopes :
240 rx.setPattern("\\(([-]{0,1}\\d+)\\)([C,H,O,N,H,S])\\s([-]{0,1}\\d+)");
241
242 i = rx.globalMatch(diff_formula);
243
244 while(i.hasNext())
245 {
246 QRegularExpressionMatch match = i.next();
247
248 qDebug() << match.captured(1) << " " << match.captured(2) << " "
249 << match.captured(3);
250
251 int number_of_isotopes = match.captured(3).toInt();
252
253 if(match.captured(2) == "C")
254 {
255 if(match.captured(1) == "13")
256 {
257 m_mapIsotope.at(Isotope::C13) = number_of_isotopes;
258 }
259 m_atomCount[AtomIsotopeSurvey::C] += number_of_isotopes;
260 }
261 else if(match.captured(2) == "H")
262 {
263 if(match.captured(1) == "2")
264 {
265 m_mapIsotope.at(Isotope::H2) = number_of_isotopes;
266 }
267 m_atomCount[AtomIsotopeSurvey::H] += number_of_isotopes;
268 }
269 else if(match.captured(2) == "N")
270 {
271 if(match.captured(1) == "15")
272 {
273 m_mapIsotope.at(Isotope::N15) = number_of_isotopes;
274 }
275 m_atomCount[AtomIsotopeSurvey::N] += number_of_isotopes;
276 }
277 else if(match.captured(2) == "O")
278 {
279 if(match.captured(1) == "17")
280 {
281 m_mapIsotope.at(Isotope::O17) = number_of_isotopes;
282 }
283 else if(match.captured(1) == "18")
284 {
285 m_mapIsotope.at(Isotope::O18) = number_of_isotopes;
286 }
287 m_atomCount[AtomIsotopeSurvey::O] += number_of_isotopes;
288 }
289 else if(match.captured(2) == "S")
290 {
291 if(match.captured(1) == "33")
292 {
293 m_mapIsotope.at(Isotope::S33) = number_of_isotopes;
294 }
295 else if(match.captured(1) == "34")
296 {
297 m_mapIsotope.at(Isotope::S34) = number_of_isotopes;
298 }
299 else if(match.captured(1) == "36")
300 {
301 m_mapIsotope.at(Isotope::S36) = number_of_isotopes;
302 }
303 m_atomCount[AtomIsotopeSurvey::S] += number_of_isotopes;
304 }
305 }
306
308}

References pappso::C, pappso::C13, calculateMassFromChemicalComponents(), pappso::H, pappso::H2, m_atomCount, m_mapIsotope, pappso::N, pappso::N15, pappso::O, pappso::O17, pappso::O18, pappso::S, pappso::S33, pappso::S34, and pappso::S36.

Referenced by createInstance().

◆ setXrefOrigin()

void pappso::AaModification::setXrefOrigin ( const QString &  origin)
protected

set list of amino acid on which this modification takes place

  • origin string of the form "S T" for Serine or Threonine, "X" for any amino acid (see OBO PSI format)

Definition at line 198 of file aamodification.cpp.

199{
200 // xref: Origin: "N"
201 // xref: Origin: "X"
202 m_origin = origin;
203}

References m_origin.

Referenced by createInstance().

Member Data Documentation

◆ m_accession

const QString pappso::AaModification::m_accession
protected

Definition at line 93 of file aamodification.h.

Referenced by calculateMassFromChemicalComponents(), getAccession(), and isInternal().

◆ m_atomCount

std::map<AtomIsotopeSurvey, int> pappso::AaModification::m_atomCount
private

◆ m_mapAccessionModifications

AaModification::MapAccessionModifications pappso::AaModification::m_mapAccessionModifications
staticprivate
Initial value:
= [] {
return ret;
}()
std::map< QString, AaModificationP > MapAccessionModifications

Definition at line 129 of file aamodification.h.

Referenced by getInstance(), getInstance(), getInstanceCustomizedMod(), and getInstanceMutation().

◆ m_mapIsotope

std::map<Isotope, int> pappso::AaModification::m_mapIsotope
private

◆ m_mass

pappso_double pappso::AaModification::m_mass
private

Definition at line 123 of file aamodification.h.

Referenced by calculateMassFromChemicalComponents(), createInstance(), and getMass().

◆ m_mutex

QMutex pappso::AaModification::m_mutex
staticprivate

◆ m_name

QString pappso::AaModification::m_name
protected

Definition at line 94 of file aamodification.h.

Referenced by createInstance(), createInstanceMutation(), and getName().

◆ m_origin

QString pappso::AaModification::m_origin
private

Definition at line 124 of file aamodification.h.

Referenced by AaModification(), and setXrefOrigin().


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