libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
aacode.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/amino_acid/aacode.h
3 * \date 03/05/2023
4 * \author Olivier Langella
5 * \brief give an integer code to each amino acid
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2023 Olivier Langella <Olivier.Langella@u-psud.fr>.
10 *
11 * This file is part of PAPPSOms-tools.
12 *
13 * PAPPSOms-tools 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-tools 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-tools. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
28#pragma once
29
32#include <vector>
34
35namespace pappso
36{
37/**
38 * @brief collection of integer code for each amino acid
39 * 0 => null
40 * 1 to 20 => amino acid sorted by there mass (lower to higher). Leucine is
41 * replaced by Isoleucine
42 */
44{
45 public:
46 /**
47 * Default constructor
48 */
49 AaCode();
50
51 /**
52 * Default copy constructor
53 */
54 AaCode(const AaCode &other);
55
56 /**
57 * Destructor
58 */
59 ~AaCode();
60
61 /** @brief get the integer code of an amino acid with the one letter code
62 * @return integer 1 to 20, 0 if not found
63 */
64 uint8_t getAaCode(char aa_letter) const;
65
66 /** @brief get the integer code of an amino acid enum
67 * @return integer 1 to 20, 0 if not found
68 */
70
71
72 /** @brief get the integer code of an amino acid given a mass and a precision
73 * @return integer 1 to 20, 0 if not found
74 */
75 uint8_t getAaCodeByMass(double mass, PrecisionPtr precision) const;
76
77 /** @brief get the Aa object from the one letter code
78 */
79 const Aa &getAa(char aa_letter) const;
80
81 /** @brief get the Aa object from the amino acid integer code
82 */
83 const Aa &getAa(uint8_t aa_code) const;
84
85
86 /** @brief get the mass of the amino acid given its integer code
87 * the amino acid can bear some modification (if addAaModification function was used)
88 */
89 double getMass(uint8_t aa_code) const;
90 double getMass(char aa_letter) const;
91
92 /** @brief add a modification on an amino acid
93 * for example carbamido on C
94 */
95 void addAaModification(char aa_letter, AaModificationP aaModification);
96
97 std::size_t getSize() const;
98
99 const std::vector<Aa> &getAaCollection() const;
100
101 private:
102 /** @brief give a number (the code) to each amino acid sorted by mass
103 */
104 void updateNumbers();
105 /** @brief update mass cache
106 */
107 void updateMass();
108
109 private:
110 std::vector<uint8_t> m_asciiTable;
111
112 std::vector<Aa> m_aaCollection;
113 std::vector<double> m_massCollection;
114};
115} // namespace pappso
void updateNumbers()
give a number (the code) to each amino acid sorted by mass
Definition aacode.cpp:187
void addAaModification(char aa_letter, AaModificationP aaModification)
add a modification on an amino acid for example carbamido on C
Definition aacode.cpp:164
std::vector< double > m_massCollection
Definition aacode.h:113
std::vector< uint8_t > m_asciiTable
Definition aacode.h:110
void updateMass()
update mass cache
Definition aacode.cpp:207
uint8_t getAaCodeByMass(double mass, PrecisionPtr precision) const
get the integer code of an amino acid given a mass and a precision
Definition aacode.cpp:231
const std::vector< Aa > & getAaCollection() const
Definition aacode.cpp:252
uint8_t getAaCode(char aa_letter) const
get the integer code of an amino acid with the one letter code
Definition aacode.cpp:81
double getMass(uint8_t aa_code) const
get the mass of the amino acid given its integer code the amino acid can bear some modification (if a...
Definition aacode.cpp:219
std::size_t getSize() const
Definition aacode.cpp:74
std::vector< Aa > m_aaCollection
Definition aacode.h:112
const Aa & getAa(char aa_letter) const
get the Aa object from the one letter code
Definition aacode.cpp:129
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const AaModification * AaModificationP
const PrecisionBase * PrecisionPtr
Definition precision.h:122