Loading...
Searching...
No Matches
peptide.h
Go to the documentation of this file.
/**
* \file pappsomspp/peptide/peptide.h
* \date 7/3/2015
* \author Olivier Langella
* \brief peptide model
*/
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ 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++ 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++. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#pragma once
#include <vector>
#include <memory>
#include <QString>
#include "../amino_acid/aa.h"
#include "pappsomspp/core/types.h"
#include "peptideinterface.h"
#include <cstdint>
#include "pappsomspp/export-import-config.h"
namespace pappso
{
enum class PeptideDirection : std::int8_t
{
Nter = 0,
Cter = 1
};
/** \brief tells if an ion is Nter
* \param ion_type the ion to test
*/
PMSPP_LIB_DECL bool peptideIonIsNter(Enums::PeptideIon ion_type);
/** \brief tells if an ion type is the complement ion of the other
* \param ion_type_ref the ion type reference
* \param ion_type the ion to test
*/
PMSPP_LIB_DECL bool peptideIonTypeIsComplement(Enums::PeptideIon ion_type_ref,
Enums::PeptideIon ion_type);
/** \brief get the direction of a peptide ion
* \param ion_type the ion to test
* \return the peptide direction
*/
PMSPP_LIB_DECL PeptideDirection getPeptideIonDirection(Enums::PeptideIon ion_type);
enum class PeptideIonNter
{
b,
bstar,
bo,
a,
astar,
ao,
bp,
c
};
enum class PeptideIonCter
{
y,
ystar,
yo,
z,
yp,
x
};
class Peptide;
typedef std::shared_ptr<const Peptide> PeptideSp;
typedef std::shared_ptr<Peptide> NoConstPeptideSp;
class PMSPP_LIB_DECL Peptide : public PeptideInterface
{
friend class PeptideProFormaParser;
friend bool operator<(const Peptide &l, const Peptide &r);
friend bool operator==(const Peptide &l, const Peptide &r);
public:
Peptide(const QString &pepstr);
virtual ~Peptide();
Peptide(const Peptide &peptide);
Peptide(Peptide &&toCopy);
PeptideSp makePeptideSp() const;
NoConstPeptideSp makeNoConstPeptideSp() const;
/** @brief adds a modification to amino acid sequence
* @param aaModification pointer on modification to add
* @param position position in the amino acid sequence (starts at 0)
* */
void addAaModification(AaModificationP aaModification, unsigned int position);
/** @brief adds a modification to all amino acid of the sequence
* @param aaModification pointer on modification to add
* @param Enums::AminoAcidChar amino_acid to apply the modification
* */
void addAaModificationOnAllAminoAcid(AaModificationP aaModification,
Enums::AminoAcidChar amino_acid);
std::vector<Aa>::iterator begin();
std::vector<Aa>::iterator end();
std::vector<Aa>::const_iterator begin() const;
std::vector<Aa>::const_iterator end() const;
std::vector<Aa>::const_reverse_iterator rbegin() const;
std::vector<Aa>::const_reverse_iterator rend() const;
Aa &getAa(unsigned int position);
const Aa &getConstAa(unsigned int position) const;
/** @brief get raw mass array of the amino acid sequence
*/
std::vector<double> getRawMassArray() const;
/** @brief get complete serie of product masses for a given charge and ion type
*/
std::vector<double> getMassIonSerie(unsigned int charge,
pappso::Enums::PeptideIon ion_type) const;
pappso_double getMass();
pappso_double getMass() const override;
virtual int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override;
virtual int getNumberOfIsotope(Enums::Isotope isotope) const override;
/** \brief print amino acid sequence without modifications */
const QString getSequence() const override;
unsigned int size() const override;
/** @brief count modification occurence
* @param mod modification to look for
* @result number of occurences
*/
unsigned int getNumberOfModification(AaModificationP mod) const;
/** @brief count modification occurence
* @param mod modification to look for
* @param aa_list amino acid list targets (one letter code)
* @result number of occurences
*/
unsigned int countModificationOnAa(AaModificationP mod, const std::vector<char> &aa_list) const;
/** @brief replaces all occurences of a modification by a new one
* @param oldmod modification to change
* @param newmod new modification
*/
void replaceAaModification(AaModificationP oldmod, AaModificationP newmod);
/** @brief replaces all occurences of a modification by a new one
* on a specific amino acid
* @param aa the amino acid to modify
* @param oldmod modification to change
* @param newmod new modification
*/
void replaceAaModificationOnAminoAcid(Enums::AminoAcidChar aa,
pappso::AaModificationP oldmod,
pappso::AaModificationP newmod);
/** @brief removes all occurences of a modification
* @param mod modification to remove
*/
void removeAaModification(AaModificationP mod);
/** @brief get modification positions
* @param mod modification to look for
* @result vector containing positions (from 0 to size-1)
*/
std::vector<unsigned int> getModificationPositionList(AaModificationP mod) const;
/** @brief get modification positions
* @param mod modification to look for
* @param aa_list amino acid list targets (one letter code)
* @result vector containing positions (from 0 to size-1)
*/
std::vector<unsigned int> getModificationPositionList(AaModificationP mod,
const std::vector<char> &aa_list) const;
/** @brief get positions of one amino acid in peptide
* @param aa the one letter code of the amino acid
* @result vector containing positions (from 0 to size-1) */
std::vector<unsigned int> getAaPositionList(char aa) const;
std::vector<unsigned int> getAaPositionList(std::list<char> list_aa) const;
/** \brief print modification except internal modifications */
const QString toString() const;
/** \brief print all modifications */
const QString toAbsoluteString() const;
/** \brief get all sequence string with modifications and converting Leucine
* to Isoleucine */
const QString getLiAbsoluteString() const;
void setCleavageNterModification(AaModificationP mod);
void setCleavageCterModification(AaModificationP mod);
AaModificationP getCleavageNterModification() const;
AaModificationP getCleavageCterModification() const;
void setNterModification(AaModificationP mod);
void setCterModification(AaModificationP mod);
AaModificationP getNterModification() const;
AaModificationP getCterModification() const;
/** @brief apply 100% isotope replacement
* @todo
*/
void setGlobalModification(Enums::Isotope isotope_kind);
void rotate();
void reverse();
/** @brief tells if the peptide sequence is a palindrome
*/
virtual bool isPalindrome() const override;
void replaceLeucineIsoleucine();
void removeNterAminoAcid();
void removeCterAminoAcid();
/** @brief get the peptide model in ProForma notation
* https://github.com/HUPO-PSI/ProForma/blob/master/README.md
* @return QString as described in ProForma
*/
QString toProForma() const;
virtual const ChemicalFormula getChemicalFormula() const override;
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override;
protected:
std::vector<Aa> m_aaVec;
bool m_fullC13 = false;
bool m_fullN15 = false;
bool m_fullH2 = false;
double m_proxyMass = -1;
// moiety added to peptide Nter on cleavage
AaModificationP m_cleavageNterMod = nullptr;
// moiety added to peptide Cter on cleavage
AaModificationP m_cleavageCterMod = nullptr;
AaModificationP m_NterMod = nullptr;
AaModificationP m_CterMod = nullptr;
};
} // namespace pappso
aa.h
pappso::Aa
Definition aa.h:45
pappso::ChemicalFormula
Definition chemicalformula.h:44
pappso::PeptideInterface
Definition peptideinterface.h:44
pappso::Peptide::m_cleavageCterMod
AaModificationP m_cleavageCterMod
Definition peptide.h:274
pappso::Peptide::replaceLeucineIsoleucine
void replaceLeucineIsoleucine()
Definition peptide.cpp:740
pappso::Peptide::makePeptideSp
PeptideSp makePeptideSp() const
Definition peptide.cpp:160
pappso::Peptide::Peptide
Peptide(const QString &pepstr)
Definition peptide.cpp:106
pappso::Peptide::getCterModification
AaModificationP getCterModification() const
Definition peptide.cpp:680
pappso::Peptide::setNterModification
void setNterModification(AaModificationP mod)
Definition peptide.cpp:649
pappso::Peptide::replaceAaModification
void replaceAaModification(AaModificationP oldmod, AaModificationP newmod)
replaces all occurences of a modification by a new one
Definition peptide.cpp:474
pappso::Peptide::removeNterAminoAcid
void removeNterAminoAcid()
Definition peptide.cpp:753
pappso::Peptide::rend
std::vector< Aa >::const_reverse_iterator rend() const
Definition peptide.cpp:203
pappso::Peptide::getChemicalFormulaCharge
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override
Definition peptide.cpp:845
pappso::Peptide::getModificationPositionList
std::vector< unsigned int > getModificationPositionList(AaModificationP mod) const
get modification positions
Definition peptide.cpp:522
pappso::Peptide::makeNoConstPeptideSp
NoConstPeptideSp makeNoConstPeptideSp() const
Definition peptide.cpp:166
pappso::Peptide::getNumberOfIsotope
virtual int getNumberOfIsotope(Enums::Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
Definition peptide.cpp:423
pappso::Peptide::isPalindrome
virtual bool isPalindrome() const override
tells if the peptide sequence is a palindrome
Definition peptide.cpp:705
pappso::Peptide::rbegin
std::vector< Aa >::const_reverse_iterator rbegin() const
Definition peptide.cpp:197
pappso::Peptide::getCleavageCterModification
AaModificationP getCleavageCterModification() const
Definition peptide.cpp:643
pappso::Peptide::getLiAbsoluteString
const QString getLiAbsoluteString() const
get all sequence string with modifications and converting Leucine to Isoleucine
Definition peptide.cpp:298
pappso::Peptide::PeptideProFormaParser
friend class PeptideProFormaParser
Definition peptide.h:103
pappso::Peptide::removeCterAminoAcid
void removeCterAminoAcid()
Definition peptide.cpp:770
pappso::Peptide::setGlobalModification
void setGlobalModification(Enums::Isotope isotope_kind)
apply 100% isotope replacement
Definition peptide.cpp:826
pappso::Peptide::m_fullN15
bool m_fullN15
Definition peptide.h:268
pappso::Peptide::setCleavageCterModification
void setCleavageCterModification(AaModificationP mod)
Definition peptide.cpp:621
pappso::Peptide::setCterModification
void setCterModification(AaModificationP mod)
Definition peptide.cpp:664
pappso::Peptide::m_NterMod
AaModificationP m_NterMod
Definition peptide.h:275
pappso::Peptide::getChemicalFormula
virtual const ChemicalFormula getChemicalFormula() const override
Definition peptide.cpp:838
pappso::Peptide::replaceAaModificationOnAminoAcid
void replaceAaModificationOnAminoAcid(Enums::AminoAcidChar aa, pappso::AaModificationP oldmod, pappso::AaModificationP newmod)
replaces all occurences of a modification by a new one on a specific amino acid
Definition peptide.cpp:489
pappso::Peptide::m_cleavageNterMod
AaModificationP m_cleavageNterMod
Definition peptide.h:272
pappso::Peptide::toAbsoluteString
const QString toAbsoluteString() const
print all modifications
Definition peptide.cpp:267
pappso::Peptide::m_fullH2
bool m_fullH2
Definition peptide.h:269
pappso::Peptide::m_fullC13
bool m_fullC13
Definition peptide.h:267
pappso::Peptide::operator<
friend bool operator<(const Peptide &l, const Peptide &r)
Definition peptide.cpp:47
pappso::Peptide::getNterModification
AaModificationP getNterModification() const
Definition peptide.cpp:686
pappso::Peptide::getNumberOfModification
unsigned int getNumberOfModification(AaModificationP mod) const
count modification occurence
Definition peptide.cpp:443
pappso::Peptide::getMassIonSerie
std::vector< double > getMassIonSerie(unsigned int charge, pappso::Enums::PeptideIon ion_type) const
get complete serie of product masses for a given charge and ion type
Definition peptide.cpp:336
pappso::Peptide::toString
const QString toString() const
print modification except internal modifications
Definition peptide.cpp:312
pappso::Peptide::getRawMassArray
std::vector< double > getRawMassArray() const
get raw mass array of the amino acid sequence
Definition peptide.cpp:325
pappso::Peptide::rotate
void rotate()
Definition peptide.cpp:692
pappso::Peptide::toProForma
QString toProForma() const
get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README....
Definition peptide.cpp:787
pappso::Peptide::getCleavageNterModification
AaModificationP getCleavageNterModification() const
Definition peptide.cpp:638
pappso::Peptide::removeAaModification
void removeAaModification(AaModificationP mod)
removes all occurences of a modification
Definition peptide.cpp:508
pappso::Peptide::size
unsigned int size() const override
Definition peptide.cpp:217
pappso::Peptide::getNumberOfAtom
virtual int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition peptide.cpp:403
pappso::Peptide::setCleavageNterModification
void setCleavageNterModification(AaModificationP mod)
Definition peptide.cpp:605
pappso::Peptide::getAa
Aa & getAa(unsigned int position)
Definition peptide.cpp:720
pappso::Peptide::addAaModificationOnAllAminoAcid
void addAaModificationOnAllAminoAcid(AaModificationP aaModification, Enums::AminoAcidChar amino_acid)
adds a modification to all amino acid of the sequence
Definition peptide.cpp:237
pappso::Peptide::getAaPositionList
std::vector< unsigned int > getAaPositionList(char aa) const
get positions of one amino acid in peptide
Definition peptide.cpp:567
pappso::Peptide::reverse
void reverse()
Definition peptide.cpp:698
pappso::Peptide::getMass
pappso_double getMass()
Definition peptide.cpp:375
pappso::Peptide::begin
std::vector< Aa >::iterator begin()
Definition peptide.cpp:173
pappso::Peptide::getSequence
const QString getSequence() const override
print amino acid sequence without modifications
Definition peptide.cpp:255
pappso::Peptide::addAaModification
void addAaModification(AaModificationP aaModification, unsigned int position)
adds a modification to amino acid sequence
Definition peptide.cpp:222
pappso::Peptide::end
std::vector< Aa >::iterator end()
Definition peptide.cpp:179
pappso::Peptide::m_proxyMass
double m_proxyMass
Definition peptide.h:270
pappso::Peptide::operator==
friend bool operator==(const Peptide &l, const Peptide &r)
Definition peptide.cpp:53
pappso::Peptide::m_CterMod
AaModificationP m_CterMod
Definition peptide.h:276
pappso::Peptide::m_aaVec
std::vector< Aa > m_aaVec
Definition peptide.h:266
pappso::Peptide::countModificationOnAa
unsigned int countModificationOnAa(AaModificationP mod, const std::vector< char > &aa_list) const
count modification occurence
Definition peptide.cpp:457
pappso::Peptide::getConstAa
const Aa & getConstAa(unsigned int position) const
Definition peptide.cpp:729
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::Enums::AtomIsotopeSurvey
AtomIsotopeSurvey
Definition types.h:110
pappso::Enums::Isotope
Isotope
Definition types.h:126
pappso::Enums::PeptideIon
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
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::peptideIonTypeIsComplement
bool peptideIonTypeIsComplement(Enums::PeptideIon ion_type_ref, Enums::PeptideIon ion_type)
tells if an ion type is the complement ion of the other
Definition peptide.cpp:70
pappso::PeptideIonNter
PeptideIonNter
Definition peptide.h:73
pappso::PeptideIonNter::a
@ a
Definition peptide.h:77
pappso::PeptideIonNter::c
@ c
Definition peptide.h:81
pappso::PeptideIonNter::astar
@ astar
Definition peptide.h:78
pappso::PeptideIonNter::bp
@ bp
Definition peptide.h:80
pappso::PeptideIonNter::bstar
@ bstar
Definition peptide.h:75
pappso::PeptideIonNter::b
@ b
Definition peptide.h:74
pappso::PeptideIonNter::bo
@ bo
Definition peptide.h:76
pappso::PeptideIonNter::ao
@ ao
Definition peptide.h:79
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition aamodification.h:48
pappso::PeptideDirection
PeptideDirection
Definition peptide.h:47
pappso::PeptideDirection::Cter
@ Cter
Definition peptide.h:49
pappso::PeptideDirection::Nter
@ Nter
Definition peptide.h:48
pappso::PeptideIonCter
PeptideIonCter
Definition peptide.h:86
pappso::PeptideIonCter::y
@ y
Definition peptide.h:87
pappso::PeptideIonCter::yp
@ yp
Definition peptide.h:91
pappso::PeptideIonCter::ystar
@ ystar
Definition peptide.h:88
pappso::PeptideIonCter::yo
@ yo
Definition peptide.h:89
pappso::PeptideIonCter::x
@ x
Definition peptide.h:92
pappso::PeptideIonCter::z
@ z
Definition peptide.h:90
pappso::AaModificationP
const AaModification * AaModificationP
Definition aamodification.h:52
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60
pappso::getPeptideIonDirection
PeptideDirection getPeptideIonDirection(Enums::PeptideIon ion_type)
get the direction of a peptide ion
Definition peptide.cpp:97
pappso::peptideIonIsNter
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:87
pappso::NoConstPeptideSp
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:98
peptideinterface.h
types.h