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
74 static AaModificationP getInstanceXtandemMod(const QString &type,
75 pappso_double mass,
76 const PeptideSp &peptide_sp,
77 unsigned int position);
78 static AaModificationP
79 getInstanceCustomizedMod(pappso_double modificationMass);
80
81 const QString &getAccession() const;
82 const QString &getName() const;
83
85
86 pappso_double getMass() const;
87 int getNumberOfAtom(AtomIsotopeSurvey atom) const override final;
88 int getNumberOfIsotope(Isotope isotope) const override final;
89 bool isInternal() const;
90
91
92 protected:
93 const QString m_accession;
94 QString m_name;
95
96 protected:
97 void setDiffFormula(const QString &diff_formula);
98 /** @brief set list of amino acid on which this modification takes place
99 *
100 * @arg origin string of the form "S T" for Serine or Threonine, "X" for any
101 * amino acid (see OBO PSI format)
102 * */
103 void setXrefOrigin(const QString &origin);
104
105
106 private:
107 AaModification(const QString &accession, pappso_double mass);
108 static AaModificationP createInstance(const QString &saccession);
109 static AaModificationP createInstance(const OboPsiModTerm &term);
110 static AaModificationP createInstanceMutation(const Aa &aa_from,
111 const Aa &aa_to);
112 /** @brief get heavy amino acid modification C13 N15
113 * @param aa_from orginal amino acid
114 */
115 static AaModificationP
116 createInstanceC13N15LabelledAminoAcid(const QChar &aa_from);
117 void calculateMassFromChemicalComponents();
118
119 using MapAccessionModifications = std::map<QString, AaModificationP>;
120
121
122 private:
124 QString m_origin;
125 std::map<AtomIsotopeSurvey, int> m_atomCount;
126 std::map<Isotope, int> m_mapIsotope;
127
128
130
131 static QMutex m_mutex;
132};
133
134} // namespace pappso
std::map< Isotope, int > m_mapIsotope
std::map< AtomIsotopeSurvey, int > m_atomCount
std::map< QString, AaModificationP > MapAccessionModifications
const QString m_accession
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