Loading...
Searching...
No Matches
peptidefragmention.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/peptide/peptidefragmention.cpp
* \date 10/3/2015
* \author Olivier Langella
* \brief peptide ion 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
******************************************************************************/
#include <QDebug>
#include "peptidefragmention.h"
#include "../pappsoexception.h"
#include "peptidenaturalisotopelist.h"
#include "peptiderawfragmentmasses.h"
namespace pappso
{
PeptideFragmentIon::PeptideFragmentIon(const PeptideFragmentSp &sp_fragment,
PeptideIon ion_type)
: PeptideFragmentIon(sp_fragment, ion_type, 0)
{
}
PeptideFragmentIon::PeptideFragmentIon(
const PeptideFragmentSp &sp_fragment,
PeptideIon ion_type,
unsigned int number_of_neutral_phospho_loss)
: msp_fragment(sp_fragment), m_ionType(ion_type)
{
m_mass = msp_fragment.get()->getMass();
PeptideDirection direction = msp_fragment.get()->getPeptideIonDirection();
if(direction != pappso::getPeptideIonDirection(m_ionType))
{
throw PappsoException(
QString("PeptideIon %1 is not an %2 fragment")
.arg(PeptideFragmentIon::getPeptideIonName(m_ionType))
.arg(PeptideFragment::getPeptideIonDirectionName(direction)));
}
m_mass -= MASSH2O;
switch(m_ionType)
{
// -MASSH2O
case PeptideIon::yp:
m_neutralPhosphoLossNumber = number_of_neutral_phospho_loss;
m_mass -=
((MASSH2O + MASSPHOSPHORYLATEDR) * m_neutralPhosphoLossNumber);
ion_type = PeptideIon::y;
break;
case PeptideIon::bp:
m_neutralPhosphoLossNumber = number_of_neutral_phospho_loss;
m_mass -=
((MASSH2O + MASSPHOSPHORYLATEDR) * m_neutralPhosphoLossNumber);
ion_type = PeptideIon::b;
break;
default:
break;
}
m_mass += PeptideRawFragmentMasses::getDeltaMass(ion_type);
}
PeptideFragmentIon::PeptideFragmentIon(const PeptideFragmentIon &other)
: msp_fragment(other.msp_fragment), m_ionType(other.m_ionType)
{
m_mass = other.m_mass;
}
PeptideFragmentIon::PeptideFragmentIon(
PeptideFragmentIon &&toCopy) // move constructor
: msp_fragment(std::move(toCopy.msp_fragment)),
m_ionType(toCopy.m_ionType),
m_mass(toCopy.m_mass)
{
}
PeptideFragmentIon::~PeptideFragmentIon()
{
}
PeptideDirection
PeptideFragmentIon::getPeptideIonDirection(PeptideIon ion_type)
{
return pappso::getPeptideIonDirection(ion_type);
}
const QString
PeptideFragmentIon::getCompletePeptideIonName(unsigned int charge) const
{
std::size_t size = msp_fragment.get()->size();
QString plusstr = "+";
plusstr = plusstr.repeated(charge);
if(m_ionType == PeptideIon::yp)
{
return QString("y%1(-P%2)%3")
.arg(size)
.arg(m_neutralPhosphoLossNumber)
.arg(plusstr);
}
else if(m_ionType == PeptideIon::bp)
{
return QString("b%1(-P%2)%3")
.arg(size)
.arg(m_neutralPhosphoLossNumber)
.arg(plusstr);
}
return QString("%1%2%3")
.arg(getPeptideIonName(m_ionType))
.arg(size)
.arg(plusstr);
}
const QString
PeptideFragmentIon::getPeptideIonName() const
{
if((m_ionType == PeptideIon::yp) || (m_ionType == PeptideIon::bp))
{
return QString("%1(%2)")
.arg(getPeptideIonName(m_ionType))
.arg(m_neutralPhosphoLossNumber);
}
return getPeptideIonName(m_ionType);
}
const QString
PeptideFragmentIon::getPeptideIonName(PeptideIon m_ionType)
{
switch(m_ionType)
{
case PeptideIon::y:
return "y";
break;
case PeptideIon::yp:
return "yP";
break;
case PeptideIon::ystar:
return "y*";
break;
case PeptideIon::yo:
return "yO";
break;
case PeptideIon::bstar:
return "b*";
break;
case PeptideIon::bo:
return "bO";
break;
case PeptideIon::a:
return "a";
break;
case PeptideIon::astar:
return "a*";
break;
case PeptideIon::ao:
return "aO";
break;
case PeptideIon::c:
return "c";
break;
// SvgIon.moxygen - mN
case PeptideIon::z:
return "z";
break;
case PeptideIon::b:
return "b";
break;
case PeptideIon::bp:
return "bP";
break;
case PeptideIon::x:
return "x";
break;
default:
throw PappsoException(QString("PeptideIon name not implemented"));
break;
}
}
const QColor
PeptideFragmentIon::getPeptideIonColor(PeptideIon m_ionType)
{
switch(m_ionType)
{
case PeptideIon::y:
return QColor("red");
break;
case PeptideIon::yp:
return QColor("red");
break;
case PeptideIon::ystar:
return QColor("red");
break;
case PeptideIon::yo:
return QColor("orange");
break;
case PeptideIon::x:
return QColor("orange");
break;
case PeptideIon::bstar:
return QColor("blue");
break;
case PeptideIon::bo:
return QColor("#ff00ff");
break;
case PeptideIon::a:
return QColor("green");
break;
case PeptideIon::astar:
return QColor("green");
break;
case PeptideIon::ao:
return QColor("green");
break;
case PeptideIon::c:
return QColor("blue");
break;
// SvgIon.moxygen - mN
case PeptideIon::z:
return QColor("red");
break;
case PeptideIon::b:
return QColor("blue");
break;
case PeptideIon::bp:
return QColor("blue");
break;
default:
throw PappsoException(QString("PeptideIon color not implemented %1")
.arg(getPeptideIonName(m_ionType)));
break;
}
}
int
PeptideFragmentIon::getNumberOfAtom(AtomIsotopeSurvey atom) const
{
int number = msp_fragment.get()->getNumberOfAtom(atom);
int diff = 0;
switch(atom)
{
case AtomIsotopeSurvey::C:
switch(m_ionType)
{
case PeptideIon::y:
break;
case PeptideIon::yp:
// H 1 O 3 P 1 + H 2 0
break;
case PeptideIon::ystar:
// m_mass -= MASSNH3;
break;
case PeptideIon::yo:
// m_mass -= MASSH2O;
break;
case PeptideIon::bstar:
// m_mass -= MASSH2O;
// m_mass -= MASSNH3;
break;
case PeptideIon::bo:
// m_mass -= MASSH2O;
// m_mass -= MASSH2O;
break;
case PeptideIon::a:
// m_mass -= MASSH2O;
// m_mass -= MASSCO;
diff = -1;
break;
case PeptideIon::c:
// m_mass += MASSNH3;
break;
// SvgIon.moxygen - mN
case PeptideIon::z:
// m_mass -= MASSH2O;
// m_mass += MASSOXYGEN - MASSNITROGEN - MPROTIUM;
break;
case PeptideIon::b:
// m_mass -= MASSH2O;
break;
case PeptideIon::bp:
// H 1 O 3 P 1 + H 2 0
break;
case PeptideIon::astar:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSNH3;
diff = -1;
break;
case PeptideIon::ao:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSH2O;
diff = -1;
break;
case PeptideIon::x:
// +MASSCO + MASSOXYGEN
diff = +1;
break;
default:
throw PappsoException(QString("PeptideIon name not implemented"));
break;
}
break;
case AtomIsotopeSurvey::H:
switch(m_ionType)
{
case PeptideIon::y:
break;
case PeptideIon::yp:
// H 1 O 3 P 1 + H 2 0
diff = -3 * m_neutralPhosphoLossNumber;
break;
case PeptideIon::ystar:
// m_mass -= MASSNH3;
diff = -3;
break;
case PeptideIon::yo:
// m_mass -= MASSH2O;
diff = -2;
break;
case PeptideIon::bstar:
// m_mass -= MASSH2O;
// m_mass -= MASSNH3;
diff = -5;
break;
case PeptideIon::bo:
// m_mass -= MASSH2O;
// m_mass -= MASSH2O;
diff = -4;
break;
case PeptideIon::a:
// m_mass -= MASSH2O;
// m_mass -= MASSCO;
diff = -2;
break;
case PeptideIon::c:
// m_mass += MASSNH3;
diff = -3;
break;
// SvgIon.moxygen - mN
case PeptideIon::z:
// m_mass -= MASSH2O;
// m_mass += MASSOXYGEN - MASSNITROGEN - MPROTIUM;
diff = -3;
break;
case PeptideIon::b:
// m_mass -= MASSH2O;
diff = -2;
break;
case PeptideIon::bp:
// H 1 O 3 P 1 + H 2 0
diff = -3 * m_neutralPhosphoLossNumber;
break;
case PeptideIon::astar:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSNH3;
diff = -5;
break;
case PeptideIon::ao:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSH2O;
diff = -4;
break;
case PeptideIon::x:
// +MASSCO + MASSOXYGEN
diff = -2;
break;
default:
throw PappsoException(QString("PeptideIon name not implemented"));
break;
}
break;
case AtomIsotopeSurvey::N:
switch(m_ionType)
{
case PeptideIon::y:
break;
case PeptideIon::yp:
// H 1 O 3 P 1 + H 2 0
break;
case PeptideIon::ystar:
// m_mass -= MASSNH3;
diff = -1;
break;
case PeptideIon::yo:
// m_mass -= MASSH2O;
break;
case PeptideIon::bstar:
// m_mass -= MASSH2O;
// m_mass -= MASSNH3;
diff = -1;
break;
case PeptideIon::bo:
// m_mass -= MASSH2O;
// m_mass -= MASSH2O;
break;
case PeptideIon::a:
// m_mass -= MASSH2O;
// m_mass -= MASSCO;
break;
case PeptideIon::c:
// m_mass += MASSNH3;
diff = -1;
break;
// SvgIon.moxygen - mN
case PeptideIon::z:
// m_mass -= MASSH2O;
// m_mass += MASSOXYGEN - MASSNITROGEN - MPROTIUM;
diff = -1;
break;
case PeptideIon::b:
// m_mass -= MASSH2O;
break;
case PeptideIon::bp:
// H 1 O 3 P 1 + H 2 0
break;
case PeptideIon::astar:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSNH3;
diff = -1;
break;
case PeptideIon::ao:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSH2O;
break;
case PeptideIon::x:
// +MASSCO + MASSOXYGEN
break;
default:
throw PappsoException(QString("PeptideIon name not implemented"));
break;
}
break;
case AtomIsotopeSurvey::O:
switch(m_ionType)
{
case PeptideIon::y:
break;
case PeptideIon::yp:
// H 1 O 3 P 1 + H 2 0
diff = -4 * m_neutralPhosphoLossNumber;
break;
case PeptideIon::ystar:
// m_mass -= MASSNH3;
break;
case PeptideIon::yo:
// m_mass -= MASSH2O;
diff = -1;
break;
case PeptideIon::bstar:
// m_mass -= MASSH2O;
// m_mass -= MASSNH3;
diff = -1;
break;
case PeptideIon::bo:
// m_mass -= MASSH2O;
// m_mass -= MASSH2O;
diff = -2;
break;
case PeptideIon::a:
// m_mass -= MASSH2O;
// m_mass -= MASSCO;
diff = -2;
break;
case PeptideIon::c:
// m_mass += MASSNH3;
break;
// SvgIon.moxygen - mN
case PeptideIon::z:
// m_mass -= MASSH2O;
// m_mass += MASSOXYGEN - MASSNITROGEN - MPROTIUM;
diff = -2;
break;
case PeptideIon::b:
// m_mass -= MASSH2O;
diff = -1;
break;
case PeptideIon::bp:
// H 1 O 3 P 1 + H 2 0
diff = -4 * m_neutralPhosphoLossNumber;
break;
case PeptideIon::astar:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSNH3;
diff = -2;
break;
case PeptideIon::ao:
// m_mass -= MASSH2O;
// m_mass = - MASSCO - MASSH2O;
diff = -3;
break;
case PeptideIon::x:
// +MASSCO + MASSOXYGEN
diff = +1;
break;
default:
throw PappsoException(
QObject::tr("PeptideIon name not implemented"));
break;
}
break;
case AtomIsotopeSurvey::S:
break;
default:
qDebug() << "PeptideFragmentIon::getNumberOfAtom(AtomIsotopeSurvey "
"atom) NOT IMPLEMENTED";
}
return number + diff;
}
int
PeptideFragmentIon::getNumberOfIsotope(Isotope isotope) const
{
int number = msp_fragment.get()->getNumberOfIsotope(isotope);
return number;
}
PeptideFragmentIonSp
PeptideFragmentIon::makePeptideFragmentIonSp() const
{
return std::make_shared<PeptideFragmentIon>(*this);
}
unsigned int
PeptideFragmentIon::size() const
{
return msp_fragment.get()->size();
}
const QString
PeptideFragmentIon::getSequence() const
{
return msp_fragment.get()->getSequence();
}
const PeptideFragmentSp &
PeptideFragmentIon::getPeptideFragmentSp() const
{
return msp_fragment;
}
const QString
PeptideFragmentIon::getName() const
{
return QString("%1-%2").arg(getPeptideIonName(m_ionType)).arg(size());
}
pappso_double
PeptideFragmentIon::getMass() const
{
return m_mass;
}
PeptideIon
PeptideFragmentIon::getPeptideIonType() const
{
return m_ionType;
}
PeptideDirection
PeptideFragmentIon::getPeptideIonDirection() const
{
return msp_fragment.get()->getPeptideIonDirection();
}
unsigned int
PeptideFragmentIon::getNumberOfNeutralPhosphoLoss() const
{
return m_neutralPhosphoLossNumber;
}
bool
PeptideFragmentIon::isPalindrome() const
{
return msp_fragment.get()->isPalindrome();
}
} // namespace pappso
pappso::PappsoException
Definition pappsoexception.h:42
pappso::PeptideFragmentIon
Definition peptidefragmention.h:50
pappso::PeptideFragmentIon::makePeptideFragmentIonSp
PeptideFragmentIonSp makePeptideFragmentIonSp() const
Definition peptidefragmention.cpp:550
pappso::PeptideFragmentIon::m_neutralPhosphoLossNumber
unsigned int m_neutralPhosphoLossNumber
Definition peptidefragmention.h:102
pappso::PeptideFragmentIon::getPeptideIonName
const QString getPeptideIonName() const
Definition peptidefragmention.cpp:138
pappso::PeptideFragmentIon::m_mass
pappso_double m_mass
Definition peptidefragmention.h:98
pappso::PeptideFragmentIon::getPeptideFragmentSp
virtual const PeptideFragmentSp & getPeptideFragmentSp() const
Definition peptidefragmention.cpp:569
pappso::PeptideFragmentIon::getPeptideIonType
PeptideIon getPeptideIonType() const
Definition peptidefragmention.cpp:587
pappso::PeptideFragmentIon::msp_fragment
const PeptideFragmentSp msp_fragment
Definition peptidefragmention.h:95
pappso::PeptideFragmentIon::getCompletePeptideIonName
const QString getCompletePeptideIonName(unsigned int charge) const
get a complete ion name string
Definition peptidefragmention.cpp:110
pappso::PeptideFragmentIon::getNumberOfNeutralPhosphoLoss
unsigned int getNumberOfNeutralPhosphoLoss() const
Definition peptidefragmention.cpp:597
pappso::PeptideFragmentIon::getSequence
virtual const QString getSequence() const override
amino acid sequence without modification
Definition peptidefragmention.cpp:563
pappso::PeptideFragmentIon::~PeptideFragmentIon
virtual ~PeptideFragmentIon()
Definition peptidefragmention.cpp:97
pappso::PeptideFragmentIon::size
virtual unsigned int size() const override
Definition peptidefragmention.cpp:557
pappso::PeptideFragmentIon::PeptideFragmentIon
PeptideFragmentIon(const PeptideFragmentSp &sp_fragment, PeptideIon ion_type, unsigned int number_of_neutral_phospho_loss)
Definition peptidefragmention.cpp:45
pappso::PeptideFragmentIon::m_ionType
const PeptideIon m_ionType
Definition peptidefragmention.h:96
pappso::PeptideFragmentIon::getPeptideIonColor
static const QColor getPeptideIonColor(PeptideIon ion_type)
Definition peptidefragmention.cpp:204
pappso::PeptideFragmentIon::getNumberOfAtom
virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition peptidefragmention.cpp:259
pappso::PeptideFragmentIon::getMass
pappso_double getMass() const override
Definition peptidefragmention.cpp:581
pappso::PeptideFragmentIon::getPeptideIonDirection
PeptideDirection getPeptideIonDirection() const
Definition peptidefragmention.cpp:592
pappso::PeptideFragmentIon::isPalindrome
virtual bool isPalindrome() const override
tells if the peptide sequence is a palindrome
Definition peptidefragmention.cpp:603
pappso::PeptideFragmentIon::getName
virtual const QString getName() const override
Definition peptidefragmention.cpp:575
pappso::PeptideFragmentIon::getNumberOfIsotope
virtual int getNumberOfIsotope(Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
Definition peptidefragmention.cpp:543
pappso::PeptideFragment::getPeptideIonDirectionName
static const QString getPeptideIonDirectionName(PeptideDirection direction)
Definition peptidefragment.cpp:98
pappso::PeptideRawFragmentMasses::getDeltaMass
static pappso_double getDeltaMass(PeptideIon ion_type)
Definition peptiderawfragmentmasses.cpp:56
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:432
pappso::PeptideIon::a
@ a
Nter aldimine ions.
pappso::PeptideIon::y
@ y
Cter amino ions.
pappso::PeptideIon::c
@ c
Nter amino ions.
pappso::PeptideIon::astar
@ astar
Nter aldimine ions + NH3 loss.
pappso::PeptideIon::bp
@ bp
pappso::PeptideIon::yp
@ yp
pappso::PeptideIon::ystar
@ ystar
Cter amino ions + NH3 loss.
pappso::PeptideIon::yo
@ yo
Cter amino ions + H2O loss.
pappso::PeptideIon::bstar
@ bstar
Nter acylium ions + NH3 loss.
pappso::PeptideIon::b
@ b
Nter acylium ions.
pappso::PeptideIon::x
@ x
Cter acylium ions.
pappso::PeptideIon::bo
@ bo
Nter acylium ions + H2O loss.
pappso::PeptideIon::ao
@ ao
Nter aldimine ions + H2O loss.
pappso::PeptideIon::z
@ z
Cter carbocations.
pappso::getPeptideIonDirection
PeptideDirection getPeptideIonDirection(PeptideIon ion_type)
get the direction of a peptide ion
Definition peptide.cpp:70
pappso::PeptideFragmentIonSp
std::shared_ptr< const PeptideFragmentIon > PeptideFragmentIonSp
Definition peptidefragmention.h:46
pappso::PeptideDirection
PeptideDirection
Definition peptide.h:46
pappso::AtomIsotopeSurvey
AtomIsotopeSurvey
Definition types.h:89
pappso::AtomIsotopeSurvey::C
@ C
pappso::AtomIsotopeSurvey::S
@ S
pappso::AtomIsotopeSurvey::N
@ N
pappso::AtomIsotopeSurvey::H
@ H
pappso::AtomIsotopeSurvey::O
@ O
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50
pappso::Isotope
Isotope
Definition types.h:104
pappso::MASSH2O
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)
pappso::MASSPHOSPHORYLATEDR
const pappso_double MASSPHOSPHORYLATEDR(MPROTIUM+(MASSOXYGEN *3)+MASSPHOSPHORUS)
pappso::PeptideFragmentSp
std::shared_ptr< const PeptideFragment > PeptideFragmentSp
Definition peptidefragment.h:45
peptidefragmention.h
peptide ion model
peptidenaturalisotopelist.h
peptide natural isotope model
peptiderawfragmentmasses.h
class dedicated to raw mass computations of peptide products (fragments)