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 "peptideinterface.h"
#include <cstdint>
#include "../exportinmportconfig.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(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(PeptideIon ion_type_ref,
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(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;
public:
Peptide(const QString &pepstr);
virtual ~Peptide();
Peptide(const Peptide &peptide);
friend bool
operator<(const Peptide &l, const Peptide &r)
{
return (l.m_aaVec < r.m_aaVec);
}
friend bool
operator==(const Peptide &l, const Peptide &r)
{
return (l.m_aaVec == r.m_aaVec);
}
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 AminoAcidChar amino_acid to apply the modification
* */
void addAaModificationOnAllAminoAcid(AaModificationP aaModification,
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;
pappso_double getMass();
pappso_double getMass() const override;
virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override;
virtual int getNumberOfIsotope(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 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;
AaModificationP getInternalNterModification() const;
AaModificationP getInternalCterModification() const;
void removeInternalNterModification();
void removeInternalCterModification();
void setInternalNterModification(AaModificationP mod);
void setInternalCterModification(AaModificationP mod);
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;
protected:
std::vector<Aa> m_aaVec;
pappso_double m_proxyMass = -1;
};
} // namespace pappso
pappso::AaModification
Definition aamodification.h:57
pappso::Aa
Definition aa.h:45
pappso::PeptideInterface
Definition peptideinterface.h:43
pappso::PeptideProFormaParser
Definition peptideproformaparser.h:39
pappso::Peptide
Definition peptide.h:100
pappso::Peptide::operator==
friend bool operator==(const Peptide &l, const Peptide &r)
Definition peptide.h:113
pappso::Peptide::m_aaVec
std::vector< Aa > m_aaVec
Definition peptide.h:244
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition exportinmportconfig.h:14
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::PeptideIon
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:425
pappso::AminoAcidChar
AminoAcidChar
Definition types.h:159
pappso::getPeptideIonDirection
PeptideDirection getPeptideIonDirection(PeptideIon ion_type)
get the direction of a peptide ion
Definition peptide.cpp:70
pappso::operator<
bool operator<(Aa const &l, Aa const &r)
Definition aa.cpp:347
pappso::PeptideIonNter
PeptideIonNter
Definition peptide.h:72
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::c
@ c
pappso::PeptideIonNter::astar
@ astar
pappso::PeptideIonNter::bp
@ bp
pappso::PeptideIonNter::bstar
@ bstar
pappso::PeptideIonNter::b
@ b
pappso::PeptideIonNter::bo
@ bo
pappso::PeptideIonNter::ao
@ ao
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition aamodification.h:48
pappso::PeptideDirection
PeptideDirection
Definition peptide.h:46
pappso::PeptideDirection::Cter
@ Cter
pappso::PeptideDirection::Nter
@ Nter
pappso::PeptideIonCter
PeptideIonCter
Definition peptide.h:85
pappso::PeptideIonCter::y
@ y
pappso::PeptideIonCter::yp
@ yp
pappso::PeptideIonCter::ystar
@ ystar
pappso::PeptideIonCter::yo
@ yo
pappso::PeptideIonCter::x
@ x
pappso::PeptideIonCter::z
@ z
pappso::AtomIsotopeSurvey
AtomIsotopeSurvey
Definition types.h:89
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50
pappso::Isotope
Isotope
Definition types.h:104
pappso::peptideIonTypeIsComplement
bool peptideIonTypeIsComplement(PeptideIon ion_type_ref, PeptideIon ion_type)
tells if an ion type is the complement ion of the other
Definition peptide.cpp:43
pappso::peptideIonIsNter
bool peptideIonIsNter(PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:60
pappso::NoConstPeptideSp
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:97
peptideinterface.h