Loading...
Searching...
No Matches
peptiderawfragmentmasses.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/peptide/peptiderawfragmentmasses.cpp
* \date 16/7/2016
* \author Olivier Langella
* \brief class dedicated to raw mass computations of peptide products
* (fragments)
*/
/*******************************************************************************
* Copyright (c) 2016 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 "peptiderawfragmentmasses.h"
namespace pappso
{
PeptideRawFragmentMasses::ionDeltatMzMassMap PeptideRawFragmentMasses::m_ionDeltaMz = {
[(std::int8_t)Enums::PeptideIon::b] = 0,
[(std::int8_t)Enums::PeptideIon::bstar] = -MASSNH3,
[(std::int8_t)Enums::PeptideIon::bo] = -MASSH2O,
[(std::int8_t)Enums::PeptideIon::a] = -MASSCO,
[(std::int8_t)Enums::PeptideIon::astar] = -MASSCO - MASSNH3,
[(std::int8_t)Enums::PeptideIon::ao] = -MASSCO - MASSH2O,
[(std::int8_t)Enums::PeptideIon::bp] = -1,
[(std::int8_t)Enums::PeptideIon::c] = MASSNH3,
[(std::int8_t)Enums::PeptideIon::y] = MASSH2O,
[(std::int8_t)Enums::PeptideIon::ystar] = MASSH2O - MASSNH3,
[(std::int8_t)Enums::PeptideIon::yo] = 0,
[(std::int8_t)Enums::PeptideIon::z] = MASSOXYGEN - MASSNITROGEN - MPROTIUM,
[(std::int8_t)Enums::PeptideIon::yp] = -1,
[(std::int8_t)Enums::PeptideIon::x] = MASSCO + MASSOXYGEN};
pappso_double
PeptideRawFragmentMasses::getDeltaMass(Enums::PeptideIon ion_type)
{
return m_ionDeltaMz[(std::int8_t)ion_type];
}
PeptideRawFragmentMasses::PeptideRawFragmentMasses(const Peptide &peptide,
RawFragmentationMode mode)
{
qDebug();
std::vector<Aa>::const_iterator it(peptide.begin());
std::vector<Aa>::const_iterator end(peptide.end());
if(it == end)
return;
qDebug();
pappso_double cumulative_mass = it->getMass();
if(peptide.getNterModification() != nullptr)
{
cumulative_mass += peptide.getNterModification()->getMass();
}
qDebug();
m_cumulativeNterMasses.push_back(cumulative_mass);
it++;
if(it != end)
{
end--;
qDebug();
while(it != end)
{
qDebug() << " cumulative_mass=" << cumulative_mass;
cumulative_mass += it->getMass();
if((mode == RawFragmentationMode::proline_effect) && (it->getLetter() == 'P'))
{
}
else
{
m_cumulativeNterMasses.push_back(cumulative_mass);
}
it++;
}
}
qDebug();
std::vector<Aa>::const_reverse_iterator rit(peptide.rbegin());
std::vector<Aa>::const_reverse_iterator ritf(peptide.rbegin());
std::vector<Aa>::const_reverse_iterator rend(peptide.rend());
ritf++;
cumulative_mass = rit->getMass();
if(peptide.getCterModification() != nullptr)
{
cumulative_mass += peptide.getCterModification()->getMass();
}
if((mode == RawFragmentationMode::proline_effect) && (ritf != rend) && (ritf->getLetter() == 'P'))
{
}
else
{
m_cumulativeCterMasses.push_back(cumulative_mass);
}
qDebug();
rit++;
ritf++;
if(rit != rend)
{
rend--;
while(rit != rend)
{
cumulative_mass += rit->getMass();
if((mode == RawFragmentationMode::proline_effect) && (ritf != peptide.rend()) &&
(ritf->getLetter() == 'P'))
{
}
else
{
m_cumulativeCterMasses.push_back(cumulative_mass);
}
rit++;
ritf++;
}
}
qDebug();
}
void
PeptideRawFragmentMasses::pushBackIonMasses(std::vector<pappso_double> &mass_list,
Enums::PeptideIon ion_type) const
{
const std::vector<pappso_double> *p_mass_list = &m_cumulativeCterMasses;
if(peptideIonIsNter(ion_type))
{
// nter
p_mass_list = &m_cumulativeNterMasses;
}
for(pappso_double mass : *p_mass_list)
{
mass_list.push_back(mass + m_ionDeltaMz[(std::int8_t)ion_type]);
}
}
void
PeptideRawFragmentMasses::pushBackIonMz(std::vector<pappso_double> &mass_list,
Enums::PeptideIon ion_type,
unsigned int charge) const
{
const std::vector<pappso_double> *p_mass_list = &m_cumulativeCterMasses;
if(peptideIonIsNter(ion_type))
{
// nter
p_mass_list = &m_cumulativeNterMasses;
}
for(pappso_double mass : *p_mass_list)
{
mass_list.push_back((mass + m_ionDeltaMz[(std::int8_t)ion_type] + (MHPLUS * charge)) /
charge);
}
}
void
PeptideRawFragmentMasses::pushBackMatchSpectrum(std::vector<SimplePeakIonMatch> &peak_match_list,
const MassSpectrum &spectrum,
PrecisionPtr precision,
Enums::PeptideIon ion_type,
unsigned int charge) const
{
std::vector<pappso_double> mass_list;
pushBackIonMz(mass_list, ion_type, charge);
// no need to sort
// std::sort(mass_list.begin(), mass_list.end());
std::vector<pappso_double>::iterator it_mz = mass_list.begin();
std::vector<pappso_double>::iterator it_mz_end = mass_list.end();
// scan products over each peak in spectrum :
std::vector<DataPoint>::const_iterator it_peak = spectrum.begin();
std::vector<DataPoint>::const_iterator it_peak_end = spectrum.end();
unsigned int ion_size = 1;
while((it_peak != it_peak_end) && (it_mz != it_mz_end))
{
MzRange massrange(it_peak->x, precision);
if((*it_mz) > massrange.upper())
{
it_peak++;
continue;
}
if((*it_mz) < massrange.lower())
{
it_mz++;
ion_size++;
continue;
}
peak_match_list.push_back({(*it_peak), ion_type, ion_size, charge, (*it_mz)});
it_mz++;
ion_size++;
}
}
PeptideRawFragmentMasses::~PeptideRawFragmentMasses()
{
}
} // namespace pappso
pappso::AaModification::getMass
pappso_double getMass() const
Definition aamodification.cpp:759
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition massspectrum.h:70
pappso::MzRange
Definition mzrange.h:46
pappso::MzRange::lower
pappso_double lower() const
Definition mzrange.h:71
pappso::MzRange::upper
pappso_double upper() const
Definition mzrange.h:77
pappso::PeptideRawFragmentMasses::ionDeltatMzMassMap
pappso_double[20] ionDeltatMzMassMap
Definition peptiderawfragmentmasses.h:61
pappso::PeptideRawFragmentMasses::pushBackIonMasses
void pushBackIonMasses(std::vector< pappso_double > &mass_list, Enums::PeptideIon ion_type) const
Definition peptiderawfragmentmasses.cpp:145
pappso::PeptideRawFragmentMasses::~PeptideRawFragmentMasses
~PeptideRawFragmentMasses()
Definition peptiderawfragmentmasses.cpp:222
pappso::PeptideRawFragmentMasses::pushBackMatchSpectrum
void pushBackMatchSpectrum(std::vector< SimplePeakIonMatch > &peak_match_list, const MassSpectrum &spectrum, PrecisionPtr precision, Enums::PeptideIon ion_type, unsigned int charge) const
Definition peptiderawfragmentmasses.cpp:183
pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses
PeptideRawFragmentMasses(const Peptide &peptide, RawFragmentationMode mode)
Definition peptiderawfragmentmasses.cpp:61
pappso::PeptideRawFragmentMasses::m_cumulativeCterMasses
std::vector< pappso_double > m_cumulativeCterMasses
cumulative Cter masses (without internal Cter modification)
Definition peptiderawfragmentmasses.h:72
pappso::PeptideRawFragmentMasses::m_cumulativeNterMasses
std::vector< pappso_double > m_cumulativeNterMasses
cumulative Nter masses (without internal Nter modification)
Definition peptiderawfragmentmasses.h:68
pappso::PeptideRawFragmentMasses::pushBackIonMz
void pushBackIonMz(std::vector< pappso_double > &mass_list, Enums::PeptideIon ion_type, unsigned int charge) const
Definition peptiderawfragmentmasses.cpp:163
pappso::PeptideRawFragmentMasses::m_ionDeltaMz
static ionDeltatMzMassMap m_ionDeltaMz
Definition peptiderawfragmentmasses.h:64
pappso::PeptideRawFragmentMasses::getDeltaMass
static pappso_double getDeltaMass(Enums::PeptideIon ion_type)
Definition peptiderawfragmentmasses.cpp:55
pappso::Peptide
Definition peptide.h:102
pappso::Peptide::getCterModification
AaModificationP getCterModification() const
Definition peptide.cpp:680
pappso::Peptide::rend
std::vector< Aa >::const_reverse_iterator rend() const
Definition peptide.cpp:203
pappso::Peptide::rbegin
std::vector< Aa >::const_reverse_iterator rbegin() const
Definition peptide.cpp:197
pappso::Peptide::getNterModification
AaModificationP getNterModification() const
Definition peptide.cpp:686
pappso::Peptide::begin
std::vector< Aa >::iterator begin()
Definition peptide.cpp:173
pappso::Peptide::end
std::vector< Aa >::iterator end()
Definition peptide.cpp:179
pappso::Enums::PeptideIon
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
pappso::Enums::PeptideIon::a
@ a
Nter aldimine ions.
Definition types.h:290
pappso::Enums::PeptideIon::y
@ y
Cter amino ions.
Definition types.h:295
pappso::Enums::PeptideIon::c
@ c
Nter amino ions.
Definition types.h:294
pappso::Enums::PeptideIon::astar
@ astar
Nter aldimine ions + NH3 loss.
Definition types.h:291
pappso::Enums::PeptideIon::bp
@ bp
Definition types.h:293
pappso::Enums::PeptideIon::yp
@ yp
Definition types.h:299
pappso::Enums::PeptideIon::ystar
@ ystar
Cter amino ions + NH3 loss.
Definition types.h:296
pappso::Enums::PeptideIon::yo
@ yo
Cter amino ions + H2O loss.
Definition types.h:297
pappso::Enums::PeptideIon::bstar
@ bstar
Nter acylium ions + NH3 loss.
Definition types.h:288
pappso::Enums::PeptideIon::b
@ b
Nter acylium ions.
Definition types.h:287
pappso::Enums::PeptideIon::x
@ x
Cter acylium ions.
Definition types.h:300
pappso::Enums::PeptideIon::bo
@ bo
Nter acylium ions + H2O loss.
Definition types.h:289
pappso::Enums::PeptideIon::ao
@ ao
Nter aldimine ions + H2O loss.
Definition types.h:292
pappso::Enums::PeptideIon::z
@ z
Cter carbocations.
Definition types.h:298
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::MASSCO
const pappso_double MASSCO(MASSCARBON+MASSOXYGEN)
pappso::MHPLUS
const pappso_double MHPLUS(1.007276466879)
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60
pappso::MPROTIUM
const pappso_double MPROTIUM(1.007825032241)
pappso::MASSH2O
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)
pappso::peptideIonIsNter
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:87
pappso::MASSNH3
const pappso_double MASSNH3((MPROTIUM *3)+MASSNITROGEN)
pappso::MASSNITROGEN
const pappso_double MASSNITROGEN(14.0030740048)
pappso::MASSOXYGEN
const pappso_double MASSOXYGEN(15.99491461956)
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition precision.h:122
pappso::RawFragmentationMode
RawFragmentationMode
Definition peptiderawfragmentmasses.h:43
pappso::RawFragmentationMode::proline_effect
@ proline_effect
Definition peptiderawfragmentmasses.h:45
peptiderawfragmentmasses.h