peptidefragmentionlistbase.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/peptide/peptidefragmentionlistbase.cpp
* \date 10/3/2015
* \author Olivier Langella
* \brief fragmentation base object
*/
/*******************************************************************************
* 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 "peptidefragmentionlistbase.h"
#include <QDebug>
#include <memory>
#include "../pappsoexception.h"
namespace pappso
{
std::list<PeptideIon>
PeptideFragmentIonListBase::getCIDionList()
{
IonList ret;
// populate ret
ret.push_back(PeptideIon::y);
ret.push_back(PeptideIon::yp);
ret.push_back(PeptideIon::ystar);
ret.push_back(PeptideIon::yo);
ret.push_back(PeptideIon::b);
ret.push_back(PeptideIon::bp);
ret.push_back(PeptideIon::a);
ret.push_back(PeptideIon::bstar);
ret.push_back(PeptideIon::bo);
return ret;
}
std::list<PeptideIon>
PeptideFragmentIonListBase::getETDionList()
{
IonList ret;
// populate ret
ret.push_back(PeptideIon::y);
ret.push_back(PeptideIon::c);
ret.push_back(PeptideIon::z);
ret.push_back(PeptideIon::ystar);
ret.push_back(PeptideIon::yo);
return ret;
}
const std::list<PeptideIon> &
PeptideFragmentIonListBase::getIonList() const
{
return m_ionList;
}
PeptideFragmentIonListBase::PeptideFragmentIonListBase(const PeptideSp &peptide,
const IonList &ions)
: msp_peptide(peptide), m_ionList(ions)
{
try
{
qDebug()
<< "PeptideFragmentIonListBase::PeptideFragmentIonListBase begin "
<< ions.size();
std::list<PeptideFragmentSp> fragment_list =
PeptideFragmentIonListBase::getPeptideFragmentList(msp_peptide);
m_phosphorylationNumber = 0;
AaModificationP phosphorylation_mod = nullptr;
for(auto &&fragment_sp : fragment_list)
{
// qDebug()<< "PeptideFragmentIonListBase::PeptideFragmentIonListBase
// ition";
if(fragment_sp.get()->getPeptideIonDirection() ==
PeptideDirection::Cter)
{
for(auto &&ion_type : m_ionList)
{
// qDebug()<<
// "PeptideFragmentIonListBase::PeptideFragmentIonListBase
// ition";
if((ion_type == PeptideIon::y) ||
(ion_type == PeptideIon::ystar) ||
(ion_type == PeptideIon::yo) ||
(ion_type == PeptideIon::z))
{
msp_peptide_fragment_ion_list.push_back(
std::make_shared<PeptideFragmentIon>(fragment_sp,
ion_type));
}
else if(ion_type == PeptideIon::yp)
{
if(phosphorylation_mod == nullptr)
{
phosphorylation_mod =
AaModification::getInstance("MOD:00696");
m_phosphorylationNumber =
peptide.get()->getNumberOfModification(
phosphorylation_mod);
}
for(unsigned int i = 0; i < m_phosphorylationNumber; i++)
{
msp_peptide_fragment_ion_list.push_back(
std::make_shared<PeptideFragmentIon>(
fragment_sp, ion_type, i + 1));
}
}
}
}
else
{
for(auto &&ion_type : m_ionList)
{
// b, bstar, bo, a
if((ion_type == PeptideIon::b) ||
(ion_type == PeptideIon::bstar) ||
(ion_type == PeptideIon::bo) ||
(ion_type == PeptideIon::a) || (ion_type == PeptideIon::c))
{
msp_peptide_fragment_ion_list.push_back(
std::make_shared<PeptideFragmentIon>(fragment_sp,
ion_type));
}
else if(ion_type == PeptideIon::bp)
{
if(phosphorylation_mod == nullptr)
{
phosphorylation_mod =
AaModification::getInstance("MOD:00696");
m_phosphorylationNumber =
peptide.get()->getNumberOfModification(
phosphorylation_mod);
}
for(unsigned int i = 0; i < m_phosphorylationNumber; i++)
{
msp_peptide_fragment_ion_list.push_back(
std::make_shared<PeptideFragmentIon>(
fragment_sp, ion_type, i + 1));
}
}
}
}
}
qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase end "
<< ions.size();
}
catch(PappsoException &exception_pappso)
{
QString errorStr =
QObject::tr(
"ERROR building PeptideFragmentIonListBase, PAPPSO exception:\n%1")
.arg(exception_pappso.qwhat());
qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase "
"PappsoException :\n"
<< errorStr;
throw PappsoException(errorStr);
}
catch(std::exception &exception_std)
{
QString errorStr =
QObject::tr(
"ERROR building PeptideFragmentIonListBase, std exception:\n%1")
.arg(exception_std.what());
qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase "
"std::exception :\n"
<< errorStr;
throw PappsoException(errorStr);
}
}
PeptideFragmentIonListBase::PeptideFragmentIonListBase(
const PeptideFragmentIonListBase &other)
: msp_peptide(other.msp_peptide),
msp_peptide_fragment_ion_list(other.msp_peptide_fragment_ion_list),
m_ionList(other.m_ionList),
m_phosphorylationNumber(other.m_phosphorylationNumber)
{
}
PeptideFragmentIonListBaseSp
PeptideFragmentIonListBase::makePeptideFragmentIonListBaseSp() const
{
return std::make_shared<const PeptideFragmentIonListBase>(*this);
}
PeptideFragmentIonListBase::~PeptideFragmentIonListBase()
{
}
const std::list<PeptideFragmentSp>
PeptideFragmentIonListBase::getPeptideFragmentList(const PeptideSp &peptide)
{
std::list<PeptideFragmentSp> peptide_fragment_list;
unsigned int max = peptide.get()->size() - 1;
for(unsigned int i = 0; i < max; i++)
{
peptide_fragment_list.push_back(std::make_shared<PeptideFragment>(
peptide, PeptideDirection::Nter, i + 1));
peptide_fragment_list.push_back(std::make_shared<PeptideFragment>(
peptide, PeptideDirection::Cter, i + 1));
}
return peptide_fragment_list;
}
const std::list<PeptideFragmentIonSp>
PeptideFragmentIonListBase::getPeptideFragmentIonSp(PeptideIon ion_type) const
{
std::list<PeptideFragmentIonSp> ion_list;
for(auto &&peptide_fragment_ion_sp : msp_peptide_fragment_ion_list)
{
if(peptide_fragment_ion_sp.get()->getPeptideIonType() == ion_type)
{
ion_list.push_back(peptide_fragment_ion_sp);
}
}
return (ion_list);
}
const PeptideFragmentIonSp &
PeptideFragmentIonListBase::getPeptideFragmentIonSp(PeptideIon ion_type,
unsigned int size) const
{
return getPeptideFragmentIonSp(ion_type, size, 0);
}
const PeptideFragmentIonSp &
PeptideFragmentIonListBase::getPeptideFragmentIonSp(
PeptideIon ion_type,
unsigned int size,
unsigned int number_of_neutral_phospho_loss) const
{
for(auto &&peptide_fragment_ion_sp : msp_peptide_fragment_ion_list)
{
if(peptide_fragment_ion_sp.get()->getPeptideIonType() == ion_type)
{
if(peptide_fragment_ion_sp.get()->size() == size)
{
if(peptide_fragment_ion_sp.get()
->getNumberOfNeutralPhosphoLoss() ==
number_of_neutral_phospho_loss)
{
return (peptide_fragment_ion_sp);
}
}
}
}
throw PappsoException(QString("PeptideFragmentIon %1 of size %2 not found")
.arg(PeptideFragmentIon::getPeptideIonName(ion_type))
.arg(size));
}
} // namespace pappso
pappso::AaModification
Definition: aamodification.h:57
pappso::AaModification::getInstance
static AaModificationP getInstance(const QString &accession)
Definition: aamodification.cpp:366
pappso::PappsoException
Definition: pappsoexception.h:42
pappso::PappsoException::qwhat
virtual const QString & qwhat() const
Definition: pappsoexception.h:68
pappso::PeptideFragmentIonListBase
Definition: peptidefragmentionlistbase.h:46
pappso::PeptideFragmentIonListBase::msp_peptide_fragment_ion_list
std::list< PeptideFragmentIonSp > msp_peptide_fragment_ion_list
Definition: peptidefragmentionlistbase.h:51
pappso::PeptideFragmentIonListBase::getPeptideFragmentIonSp
const std::list< PeptideFragmentIonSp > getPeptideFragmentIonSp(PeptideIon ion_type) const
Definition: peptidefragmentionlistbase.cpp:234
pappso::PeptideFragmentIonListBase::getETDionList
static std::list< PeptideIon > getETDionList()
Definition: peptidefragmentionlistbase.cpp:59
pappso::PeptideFragmentIonListBase::makePeptideFragmentIonListBaseSp
PeptideFragmentIonListBaseSp makePeptideFragmentIonListBaseSp() const
Definition: peptidefragmentionlistbase.cpp:206
pappso::PeptideFragmentIonListBase::~PeptideFragmentIonListBase
virtual ~PeptideFragmentIonListBase()
Definition: peptidefragmentionlistbase.cpp:212
pappso::PeptideFragmentIonListBase::PeptideFragmentIonListBase
PeptideFragmentIonListBase(const PeptideSp &peptide, const IonList &ions)
Definition: peptidefragmentionlistbase.cpp:78
pappso::PeptideFragmentIonListBase::getIonList
const std::list< PeptideIon > & getIonList() const
Definition: peptidefragmentionlistbase.cpp:73
pappso::PeptideFragmentIonListBase::IonList
std::list< PeptideIon > IonList
Definition: peptidefragmentionlistbase.h:47
pappso::PeptideFragmentIonListBase::size
unsigned int size() const
Definition: peptidefragmentionlistbase.h:111
pappso::PeptideFragmentIonListBase::m_ionList
IonList m_ionList
Definition: peptidefragmentionlistbase.h:52
pappso::PeptideFragmentIonListBase::getPeptideFragmentList
static const std::list< PeptideFragmentSp > getPeptideFragmentList(const PeptideSp &peptide)
Definition: peptidefragmentionlistbase.cpp:217
pappso::PeptideFragmentIonListBase::m_phosphorylationNumber
unsigned int m_phosphorylationNumber
Definition: peptidefragmentionlistbase.h:53
pappso::PeptideFragmentIonListBase::msp_peptide
const PeptideSp msp_peptide
Definition: peptidefragmentionlistbase.h:50
pappso::PeptideFragmentIonListBase::getCIDionList
static std::list< PeptideIon > getCIDionList()
Definition: peptidefragmentionlistbase.cpp:41
pappso::PeptideFragmentIon::getPeptideIonName
const QString getPeptideIonName() const
Definition: peptidefragmention.cpp:138
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:385
pappso::PeptideIon::a
@ a
Nter aldimine ions.
pappso::PeptideIon::y
@ y
Cter amino ions.
pappso::PeptideIon::c
@ c
Nter amino ions.
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::bo
@ bo
Nter acylium ions + H2O loss.
pappso::PeptideIon::z
@ z
Cter carbocations.
pappso::PeptideFragmentIonSp
std::shared_ptr< const PeptideFragmentIon > PeptideFragmentIonSp
Definition: peptidefragmention.h:44
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition: aamodification.h:47
pappso::PeptideDirection::Cter
@ Cter
pappso::PeptideDirection::Nter
@ Nter
pappso::PeptideFragmentIonListBaseSp
std::shared_ptr< const PeptideFragmentIonListBase > PeptideFragmentIonListBaseSp
Definition: peptidefragmentionlistbase.h:41
pappso::XicExtractMethod::max
@ max
maximum of intensities
peptidefragmentionlistbase.h
fragmentation base object