libpappsomspp
Library for mass spectrometry
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
30#include "../exportinmportconfig.h"
31#include "../precision.h"
32#include <vector>
33#include "aa.h"
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
67 /** @brief get the integer code of an amino acid given a mass and a precision
68 * @return integer 1 to 20, 0 if not found
69 */
70 uint8_t getAaCodeByMass(double mass, PrecisionPtr precision) const;
71
72 /** @brief get the Aa object from the one letter code
73 */
74 const Aa &getAa(char aa_letter) const;
75
76 /** @brief get the Aa object from the amino acid integer code
77 */
78 const Aa &getAa(uint8_t aa_code) const;
79
80
81 /** @brief get the mass of the amino acid given its integer code
82 * the amino acid can bear some modification (if addAaModification function was used)
83 */
84 double getMass(uint8_t aa_code) const;
85 double getMass(char aa_letter) const;
86
87 /** @brief add a modification on an amino acid
88 * for example carbamido on C
89 */
90 void addAaModification(char aa_letter, AaModificationP aaModification);
91
92 std::size_t getSize() const;
93
94 const std::vector<Aa> &getAaCollection() const;
95
96 private:
97 /** @brief give a number (the code) to each amino acid sorted by mass
98 */
99 void updateNumbers();
100 /** @brief update mass cache
101 */
102 void updateMass();
103
104 private:
105 std::vector<uint8_t> m_asciiTable;
106
107 std::vector<Aa> m_aaCollection;
108 std::vector<double> m_massCollection;
109};
110} // namespace pappso
collection of integer code for each amino acid 0 => null 1 to 20 => amino acid sorted by there mass (...
Definition: aacode.h:44
std::vector< double > m_massCollection
Definition: aacode.h:108
std::vector< uint8_t > m_asciiTable
Definition: aacode.h:105
std::vector< Aa > m_aaCollection
Definition: aacode.h:107
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