libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
aamodification.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/amino_acid/aamodification.h
3 * \date 7/3/2015
4 * \author Olivier Langella
5 * \brief amino acid modification model
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Contributors:
27 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
31
32#pragma once
33
34#include <QDebug>
35#include <QString>
36#include <QMutex>
37#include <memory>
38#include <map>
39#include "../types.h"
40#include "atomnumberinterface.h"
41#include "../obo/obopsimod.h"
42
43namespace pappso
44{
45
46
47class Peptide;
48typedef std::shared_ptr<const Peptide> PeptideSp;
49
50class AaModification;
51typedef std::unique_ptr<const AaModification> AaModificationUp;
53
54class Aa;
55
57{
58
59 public:
60 AaModification(AaModification &&toCopy); // move constructor
61
62 static AaModificationP getInstance(const QString &accession);
63 static AaModificationP getInstance(const OboPsiModTerm &oboterm);
64
65 /** @brief get a fake modification coding a mutation from an amino acid to an
66 * other
67 * @param mut_from orginal amino acid
68 * @param mut_to targeted amino acid
69 */
70 static AaModificationP getInstanceMutation(const QChar &mut_from,
71 const QChar &mut_to);
72
73 /** @brief get a PSI MOD instance corresponding to the removal of the given
74 * amino acid find the modifications that corresponds to the removal of a
75 * residue id: MOD:01651 name: natural, standard, encoded residue removal
76 * @param amino_acid orginal amino acid letter
77 * @return AaModificationP
78 */
79 static AaModificationP
80 getInstanceRemovalAccessionByAaLetter(const QChar &amino_acid);
81
82
83 /** @brief get a PSI MOD instance corresponding to the insertion of the given
84 * amino acid find the modifications.
85 *
86 * insertion of residue id: MOD:01441 name: natural, standard, encoded residue
87 * @param amino_acid orginal amino acid letter
88 * @return AaModificationP
89 */
90 static AaModificationP
91 getInstanceInsertionAccessionByAaLetter(const QChar &amino_acid);
92
93
94 static AaModificationP getInstanceXtandemMod(const QString &type,
95 pappso_double mass,
96 const PeptideSp &peptide_sp,
97 unsigned int position);
98 static AaModificationP
99 getInstanceCustomizedMod(pappso_double modificationMass);
100
101 const QString &getAccession() const;
102 const QString &getName() const;
103
104 /** @brief get the amino acid in ProForma notation
105 * https://github.com/HUPO-PSI/ProForma/blob/master/README.md
106 * @return QString as described in ProForma
107 */
108 const QString toProForma() const;
109
111
112 pappso_double getMass() const;
113 int getNumberOfAtom(AtomIsotopeSurvey atom) const override final;
114 int getNumberOfIsotope(Isotope isotope) const override final;
115 bool isInternal() const;
116
117 /** @brief get list of amino acid on which this modification takes place
118 *
119 * @return origin string of the form "S T" for Serine or Threonine, "X" for
120 * any amino acid (see OBO PSI format)
121 * */
122 const QString &getXrefOrigin() const;
123
124
125 protected:
126 const QString m_accession;
127 QString m_name;
128
129 protected:
130 void setDiffFormula(const QString &diff_formula);
131
132 /** @brief set list of amino acid on which this modification takes place
133 *
134 * @arg origin string of the form "S T" for Serine or Threonine, "X" for any
135 * amino acid (see OBO PSI format)
136 * */
137 void setXrefOrigin(const QString &origin);
138
139
140 private:
141 AaModification(const QString &accession, pappso_double mass);
142 static AaModificationP createInstance(const QString &saccession);
143 static AaModificationP createInstance(const OboPsiModTerm &term);
144 static AaModificationP createInstanceMutation(const Aa &aa_from,
145 const Aa &aa_to);
146 /** @brief get heavy amino acid modification C13 N15
147 * @param aa_from orginal amino acid
148 */
149 static AaModificationP
150 createInstanceC13N15LabelledAminoAcid(const QChar &aa_from);
151 void calculateMassFromChemicalComponents();
152
153 using MapAccessionModifications = std::map<QString, AaModificationP>;
154
155
156 private:
158 QString m_origin;
159 std::map<AtomIsotopeSurvey, int> m_atomCount;
160 std::map<Isotope, int> m_mapIsotope;
161
162
164
165 static QMutex m_mutex;
166};
167
168} // namespace pappso
std::map< Isotope, int > m_mapIsotope
std::map< AtomIsotopeSurvey, int > m_atomCount
std::map< QString, AaModificationP > MapAccessionModifications
static MapAccessionModifications m_mapAccessionModifications
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const Peptide > PeptideSp
const AaModification * AaModificationP
AtomIsotopeSurvey
Definition types.h:89
double pappso_double
A type definition for doubles.
Definition types.h:50
Isotope
Definition types.h:104
std::unique_ptr< const AaModification > AaModificationUp