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>
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, const QChar &mut_to);
71
72 /** @brief get a PSI MOD instance corresponding to the removal of the given
73 * amino acid find the modifications that corresponds to the removal of a
74 * residue id: MOD:01651 name: natural, standard, encoded residue removal
75 * @param amino_acid orginal amino acid letter
76 * @return AaModificationP
77 */
78 static AaModificationP getInstanceRemovalAccessionByAaLetter(const QChar &amino_acid);
79
80
81 /** @brief get a PSI MOD instance corresponding to the insertion of the given
82 * amino acid find the modifications.
83 *
84 * insertion of residue id: MOD:01441 name: natural, standard, encoded residue
85 * @param amino_acid orginal amino acid letter
86 * @return AaModificationP
87 */
88 static AaModificationP getInstanceInsertionAccessionByAaLetter(const QChar &amino_acid);
89
90
91 static AaModificationP getInstanceXtandemMod(const QString &type,
92 pappso_double mass,
93 const PeptideSp &peptide_sp,
94 unsigned int position);
96
97 const QString &getAccession() const;
98 const QString &getName() const;
99
100 /** @brief get the amino acid in ProForma notation
101 * https://github.com/HUPO-PSI/ProForma/blob/master/README.md
102 * @return QString as described in ProForma
103 */
104 const QString toProForma() const;
105
107
108 pappso_double getMass() const;
109 int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override final;
110 int getNumberOfIsotope(Enums::Isotope isotope) const override final;
111 bool isInternal() const;
112
113 /** @brief get list of amino acid on which this modification takes place
114 *
115 * @return origin string of the form "S T" for Serine or Threonine, "X" for
116 * any amino acid (see OBO PSI format)
117 * */
118 const QString &getXrefOrigin() const;
119
120
121 protected:
122 const QString m_accession;
123 QString m_name;
124
125 protected:
126 void setDiffFormula(const pappso::ChemicalFormula &diff_formula);
127
128 /** @brief set list of amino acid on which this modification takes place
129 *
130 * @arg origin string of the form "S T" for Serine or Threonine, "X" for any
131 * amino acid (see OBO PSI format)
132 * */
133 void setXrefOrigin(const QString &origin);
134
135
136 private:
137 AaModification(const QString &accession, pappso_double mass);
138 static AaModificationP createInstance(const QString &saccession);
139 static AaModificationP createInstance(const OboPsiModTerm &term);
140 static AaModificationP createInstanceMutation(const Aa &aa_from, const Aa &aa_to);
141 /** @brief get heavy amino acid modification C13 N15
142 * @param aa_from orginal amino acid
143 */
144 static AaModificationP createInstanceC13N15LabelledAminoAcid(const QChar &aa_from);
146
147 using MapAccessionModifications = std::map<QString, AaModificationP>;
148
149
150 private:
152 QString m_origin;
153 std::map<Enums::AtomIsotopeSurvey, int> m_atomCount;
154 std::map<Enums::Isotope, int> m_mapIsotope;
155
156
158
159 static QMutex m_mutex;
160};
161
162} // namespace pappso
const QString & getName() const
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
int getNumberOfIsotope(Enums::Isotope isotope) const override final
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
std::map< Enums::Isotope, int > m_mapIsotope
void setDiffFormula(const pappso::ChemicalFormula &diff_formula)
static AaModificationP createInstance(const QString &saccession)
const QString & getAccession() const
const QString & getXrefOrigin() const
get list of amino acid on which this modification takes place
static AaModificationP getInstanceXtandemMod(const QString &type, pappso_double mass, const PeptideSp &peptide_sp, unsigned int position)
AaModification(AaModification &&toCopy)
pappso_double getMass() const
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override final
get the number of atom C, O, N, H in the molecule
void setXrefOrigin(const QString &origin)
set list of amino acid on which this modification takes place
std::map< QString, AaModificationP > MapAccessionModifications
static AaModificationP getInstance(const QString &accession)
static AaModificationP getInstanceRemovalAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the removal of the given amino acid find the modifications th...
static AaModificationP createInstanceC13N15LabelledAminoAcid(const QChar &aa_from)
get heavy amino acid modification C13 N15
static AaModificationP getInstanceCustomizedMod(pappso_double modificationMass)
const QString toProForma() const
get the amino acid in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README....
static AaModificationP getInstanceInsertionAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the insertion of the given amino acid find the modifications.
static AaModificationP createInstanceMutation(const Aa &aa_from, const Aa &aa_to)
static MapAccessionModifications m_mapAccessionModifications
std::map< Enums::AtomIsotopeSurvey, int > m_atomCount
#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
double pappso_double
A type definition for doubles.
Definition types.h:61
std::unique_ptr< const AaModification > AaModificationUp