Loading...
Searching...
No Matches
peptideobservation.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/masschroq/peptideobservation.cpp
* \date 24/09/2024
* \author Olivier Langella
* \brief peptide model in masschroqlite
*/
/*******************************************************************************
* Copyright (c) 2024 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of MassChroQ.
*
* MassChroQ 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.
*
* MassChroQ 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 MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "peptideobservation.h"
#include "pappsomspp/core/pappsoexception.h"
pappso::masschroq::PeptideObservation::PeptideObservation(pappso::masschroq::PeptideSp peptide)
: msp_peptide(peptide)
{
}
pappso::masschroq::PeptideObservation::PeptideObservation(const PeptideObservation &other)
: msp_peptide(other.msp_peptide)
{
m_observationList = other.m_observationList;
}
pappso::masschroq::PeptideObservation::~PeptideObservation()
{
}
void
pappso::masschroq::PeptideObservation::addObservation(
const pappso::masschroq::PeptideObservation::Observation &observation)
{
m_observationList.push_back(observation);
}
std::vector<std::uint8_t>
pappso::masschroq::PeptideObservation::getObservedChargeStates() const
{
std::vector<std::uint8_t> charge_list;
for(auto &observation : m_observationList)
{
charge_list.push_back(observation.m_charge);
}
std::sort(charge_list.begin(), charge_list.end());
charge_list.erase(std::unique(charge_list.begin(), charge_list.end()), charge_list.end());
return charge_list;
}
const pappso::masschroq::PeptideSp &
pappso::masschroq::PeptideObservation::getPeptideSp() const
{
return msp_peptide;
}
double
pappso::masschroq::PeptideObservation::getBestRtOverallChargeStates() const
{
double best_rt = 0;
double intensity = -1;
for(auto &observation : m_observationList)
{
if(observation.msp_precursor.get()->getIntensity() > intensity)
{
best_rt = observation.msp_precursor.get()->getXicCoordSPtr().get()->rtTarget;
intensity = observation.msp_precursor.get()->getIntensity();
}
}
return best_rt;
}
pappso::XicCoordSPtr
pappso::masschroq::PeptideObservation::getBestXicCoordSPtrForCharge(std::uint8_t charge) const
{
// get XIC coordinates of the most intense precursor
pappso::pappso_double intensity = -1;
pappso::XicCoordSPtr best_xic_coord;
for(auto &observation : m_observationList)
{
if(observation.m_charge == charge)
{
if(observation.msp_precursor.get()->getIntensity() > intensity)
{
intensity = observation.msp_precursor.get()->getIntensity();
best_xic_coord = observation.msp_precursor.get()->getXicCoordSPtr();
qDebug();
}
}
}
return best_xic_coord;
}
pappso::XicCoordSPtr
pappso::masschroq::PeptideObservation::getBestXicCoord() const
{
// get XIC coordinates of the most intense precursor
pappso::pappso_double intensity = -1;
pappso::XicCoordSPtr best_xic_coord;
for(auto &observation : m_observationList)
{
if(observation.msp_precursor.get()->getIntensity() > intensity)
{
intensity = observation.msp_precursor.get()->getIntensity();
best_xic_coord = observation.msp_precursor.get()->getXicCoordSPtr();
qDebug();
}
}
return best_xic_coord;
}
std::vector<double>
pappso::masschroq::PeptideObservation::getObservedRetentionTimesOverallChargeStates() const
{
std::vector<double> rt_list;
for(auto &observation : m_observationList)
{
rt_list.push_back(observation.msp_precursor.get()->getXicCoordSPtr().get()->rtTarget);
}
return rt_list;
}
const std::vector<pappso::masschroq::PeptideObservation::Observation> &
pappso::masschroq::PeptideObservation::getObservationList() const
{
return m_observationList;
}
pappso::masschroq::PeptideObservation::getObservationList
const std::vector< Observation > & getObservationList() const
Definition peptideobservation.cpp:150
pappso::masschroq::PeptideObservation::getBestXicCoord
pappso::XicCoordSPtr getBestXicCoord() const
Definition peptideobservation.cpp:117
pappso::masschroq::PeptideObservation::~PeptideObservation
virtual ~PeptideObservation()
Definition peptideobservation.cpp:46
pappso::masschroq::PeptideObservation::getObservedRetentionTimesOverallChargeStates
std::vector< double > getObservedRetentionTimesOverallChargeStates() const
Definition peptideobservation.cpp:138
pappso::masschroq::PeptideObservation::addObservation
void addObservation(const PeptideObservation::Observation &observation)
Definition peptideobservation.cpp:51
pappso::masschroq::PeptideObservation::getObservedChargeStates
std::vector< std::uint8_t > getObservedChargeStates() const
Definition peptideobservation.cpp:57
pappso::masschroq::PeptideObservation::m_observationList
std::vector< Observation > m_observationList
Definition peptideobservation.h:99
pappso::masschroq::PeptideObservation::getBestRtOverallChargeStates
double getBestRtOverallChargeStates() const
Definition peptideobservation.cpp:77
pappso::masschroq::PeptideObservation::getPeptideSp
const PeptideSp & getPeptideSp() const
Definition peptideobservation.cpp:71
pappso::masschroq::PeptideObservation::getBestXicCoordSPtrForCharge
pappso::XicCoordSPtr getBestXicCoordSPtrForCharge(std::uint8_t charge) const
Definition peptideobservation.cpp:94
pappso::masschroq::PeptideObservation::PeptideObservation
PeptideObservation(PeptideSp peptide)
Definition peptideobservation.cpp:34
pappso::masschroq::PeptideObservation::msp_peptide
PeptideSp msp_peptide
Definition peptideobservation.h:98
pappso::masschroq::PeptideSp
std::shared_ptr< Peptide > PeptideSp
Definition peptide.h:46
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44
pappsoexception.h
peptideobservation.h
pappso::masschroq::PeptideObservation::Observation
Definition peptideobservation.h:70