libpappsomspp
Library for mass spectrometry
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 static AaModificationP getInstanceXtandemMod(const QString &type,
73 pappso_double mass,
74 const PeptideSp &peptide_sp,
75 unsigned int position);
76 static AaModificationP
77 getInstanceCustomizedMod(pappso_double modificationMass);
78
79 const QString &getAccession() const;
80 const QString &getName() const;
81
83
84 pappso_double getMass() const;
85 int getNumberOfAtom(AtomIsotopeSurvey atom) const override final;
86 int getNumberOfIsotope(Isotope isotope) const override final;
87 bool isInternal() const;
88
89
90 protected:
91 const QString m_accession;
92 QString m_name;
93
94 protected:
95 void setDiffFormula(const QString &diff_formula);
96 /** @brief set list of amino acid on which this modification takes place
97 *
98 * @arg origin string of the form "S T" for Serine or Threonine, "X" for any
99 * amino acid (see OBO PSI format)
100 * */
101 void setXrefOrigin(const QString &origin);
102
103
104 private:
105 AaModification(const QString &accession, pappso_double mass);
106 static AaModificationP createInstance(const QString &saccession);
107 static AaModificationP createInstance(const OboPsiModTerm &term);
108 static AaModificationP createInstanceMutation(const Aa &aa_from,
109 const Aa &aa_to);
110 void calculateMassFromChemicalComponents();
111
112 using MapAccessionModifications = std::map<QString, AaModificationP>;
113
114
115 private:
117 QString m_origin;
118 std::map<AtomIsotopeSurvey, int> m_atomCount;
119 std::map<Isotope, int> m_mapIsotope;
120
121
123
124 static QMutex m_mutex;
125};
126
127} // 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
Definition: aa.h:45
#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:77
double pappso_double
A type definition for doubles.
Definition: types.h:49
Isotope
Definition: types.h:92
std::unique_ptr< const AaModification > AaModificationUp