Loading...
Searching...
No Matches
aacode.h
Go to the documentation of this file.
/**
* \file pappsomspp/amino_acid/aacode.h
* \date 03/05/2023
* \author Olivier Langella
* \brief give an integer code to each amino acid
*/
/*******************************************************************************
* Copyright (c) 2023 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "pappsomspp/export-import-config.h"
#include "pappsomspp/core/precision.h"
#include <vector>
#include "pappsomspp/core/amino_acid/aa.h"
namespace pappso
{
/**
* @brief collection of integer code for each amino acid
* 0 => null
* 1 to 20 => amino acid sorted by there mass (lower to higher). Leucine is
* replaced by Isoleucine
*/
class PMSPP_LIB_DECL AaCode
{
public:
/**
* Default constructor
*/
AaCode();
/**
* Default copy constructor
*/
AaCode(const AaCode &other);
/**
* Destructor
*/
~AaCode();
/** @brief get the integer code of an amino acid with the one letter code
* @return integer 1 to 20, 0 if not found
*/
uint8_t getAaCode(char aa_letter) const;
/** @brief get the integer code of an amino acid enum
* @return integer 1 to 20, 0 if not found
*/
uint8_t getAaCode(pappso::Enums::AminoAcidChar aa) const;
/** @brief get the integer code of an amino acid given a mass and a precision
* @return integer 1 to 20, 0 if not found
*/
uint8_t getAaCodeByMass(double mass, PrecisionPtr precision) const;
/** @brief get the Aa object from the one letter code
*/
const Aa &getAa(char aa_letter) const;
/** @brief get the Aa object from the amino acid integer code
*/
const Aa &getAa(uint8_t aa_code) const;
/** @brief get the mass of the amino acid given its integer code
* the amino acid can bear some modification (if addAaModification function was used)
*/
double getMass(uint8_t aa_code) const;
double getMass(char aa_letter) const;
/** @brief add a modification on an amino acid
* for example carbamido on C
*/
void addAaModification(char aa_letter, AaModificationP aaModification);
/** @brief number of amino acid coded letters in this aa code
*
*/
std::size_t getSize() const;
const std::vector<Aa> &getAaCollection() const;
private:
/** @brief give a number (the code) to each amino acid sorted by mass
*/
void updateNumbers();
/** @brief update mass cache
*/
void updateMass();
private:
std::vector<uint8_t> m_asciiTable;
std::vector<Aa> m_aaCollection;
std::vector<double> m_massCollection;
pappso::Aa m_leucine = Aa('L');
};
} // namespace pappso
aa.h
pappso::AaCode::updateNumbers
void updateNumbers()
give a number (the code) to each amino acid sorted by mass
Definition aacode.cpp:192
pappso::AaCode::addAaModification
void addAaModification(char aa_letter, AaModificationP aaModification)
add a modification on an amino acid for example carbamido on C
Definition aacode.cpp:169
pappso::AaCode::m_massCollection
std::vector< double > m_massCollection
Definition aacode.h:116
pappso::AaCode::m_asciiTable
std::vector< uint8_t > m_asciiTable
Definition aacode.h:113
pappso::AaCode::updateMass
void updateMass()
update mass cache
Definition aacode.cpp:212
pappso::AaCode::m_leucine
pappso::Aa m_leucine
Definition aacode.h:118
pappso::AaCode::getAaCodeByMass
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:245
pappso::AaCode::AaCode
AaCode()
Definition aacode.cpp:34
pappso::AaCode::getAaCollection
const std::vector< Aa > & getAaCollection() const
Definition aacode.cpp:266
pappso::AaCode::getAaCode
uint8_t getAaCode(char aa_letter) const
get the integer code of an amino acid with the one letter code
Definition aacode.cpp:81
pappso::AaCode::getMass
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:224
pappso::AaCode::getSize
std::size_t getSize() const
number of amino acid coded letters in this aa code
Definition aacode.cpp:74
pappso::AaCode::m_aaCollection
std::vector< Aa > m_aaCollection
Definition aacode.h:115
pappso::AaCode::getAa
const Aa & getAa(char aa_letter) const
get the Aa object from the one letter code
Definition aacode.cpp:132
pappso::Aa
Definition aa.h:45
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::Enums::AminoAcidChar
AminoAcidChar
Definition types.h:196
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::AaModificationP
const AaModification * AaModificationP
Definition aamodification.h:52
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition precision.h:122
precision.h