Loading...
Searching...
No Matches
peptide.h
Go to the documentation of this file.
/**
* \file pappsomspp/masschroq/peptide.h
* \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/>.
*
******************************************************************************/
#pragma once
#include "peptidebase.h"
#include "msrun.h"
#include "protein.h"
#include "peptidemeasurements.h"
#include "pappsomspp/core/msrun/alignment/msrunretentiontime.h"
#include "pappsomspp/core/msrun/xiccoord/ionmobilitygrid.h"
#include <cstdint>
#include <QJsonObject>
namespace pappso::masschroq
{
class Peptide;
typedef std::shared_ptr<Peptide> PeptideSp;
class MsRunGroup;
class PeptideLabel;
typedef std::shared_ptr<PeptideLabel> PeptideLabelSp;
/**
* unique studied entity representing the molecule we want to measure
*/
class Peptide : public PeptideBase
{
public:
/** @brief constructor
* @param id unique identifier for this peptide
* @param msp_peptide peptide sequence
* @param protein_list vector of protein shared pointer linked to this
* peptide^
*/
Peptide(const QString &id,
const pappso::PeptideSp &peptide_sp,
const std::vector<ProteinSp> &protein_list);
/**
* Copy constructor
*
* @param other TODO
*/
Peptide(const Peptide &other);
/**
* Destructor
*/
virtual ~Peptide();
/** @brief compute possible isotopes for this molecule
* @param ni_min_abundance the minimal isotop abundance proportion to cover
* (0.9 will compute isotopes to reach at least 90% of its theoretical
* abundance
*/
virtual void computeIsotopologues(double ni_min_abundance) override;
/** @brief get peptide unique identifier
*/
const QString &getId() const;
/** @brief set optional information as text to this peptide
*/
void setMods(const QString &mods);
/** @brief get optional information as text
*/
const QString &getMods() const;
void addObservedChargeState(std::uint8_t charge);
void addObservedInMsRunSp(const MsRunSp &msrun_sp);
const std::vector<std::uint8_t> &getAllObservedChargeStateList() const;
const std::vector<ProteinSp> &getProteinSpList() const;
/** @brief accumulate retention time information for MS1 peak measurement
*
* convenient function used while collecting data from first pass
* quantification process
* @param one_xic_measure a peak to process
* @param msrun_retention_time the msrun retention time converter for this
* msrun
*/
void addAlignedPeakMeasurement(const PeptideMeasurements::Measurement &one_xic_measure,
const pappso::MsRunRetentionTime<QString> &msrun_retention_time);
/** @brief accumulate retention time information for MS2 observation
* convenient function used while collecting data from first pass
* quantification process
* @param peptide_observation an MS2 observation
* @param msrun_retention_time the msrun retention time converter for this
* msrun
*
*/
void
addAlignedPeptideObservation(const PeptideObservation &peptide_observation,
const pappso::MsRunRetentionTime<QString> &msrun_retention_time);
/** @brief compute consensus retention time (on MS2 observations and MS1 peak
* measurements) the computation is based on data collected during the first
* pass of quantification
*/
void computeConsensusRetentionTime();
/** @brief internal structure to compute consensus retention times
*/
struct AlignedPeakPositionElement
{
double alignedRetentionTime;
double intensity;
double wide;
double alignedRetentionTimeCenter;
};
/** @brief tell if this peptide is observed (MS2 fragmentation and
* identification) in this msrun
* @param msrun_p msrun pointer
* @return true if observed, false otherwise
*/
bool isObservedInMsRunSp(const MsRun *msrun_p);
/** @brief get the XIC coordinates of the higher observed intensity for this
* peptide and charge in other MS run in the group
* @param msrun_group_p pointer on the msrun group
* @param charge the targeted charge
* @return pappso::XicCoordSPtr shared pointer on xic coordinate
*/
pappso::XicCoordSPtr getBestXicCoordSPtrForChargeInMsRunGroup(const MsRunGroup *msrun_group_p,
std::uint8_t charge) const;
/** @brief get ion mobility coordinates corrected against other MSruns in the
* group
*
* @param msrun_group_p pointer on the msrun group
* @param targeted_msrun the xic coordinate target (required to adjust ion
* mobility to this msrun)
* @param charge the targeted charge
* @return pappso::XicCoordSPtr shared pointer on xic coordinate
*/
pappso::XicCoordSPtr
getBestIonMobilityXicCoordToExtractOverallMsRunGroup(const MsRunGroup &msrun_group,
const pappso::MsRunId &targeted_msrun,
std::uint8_t charge) const;
/** @brief sets the current msrun retention time reference
* @param pappso::MsRunRetentionTime<QString> msrun run retention time
* reference
*/
void setReferenceMsRunRetentionTimePtr(
const pappso::MsRunRetentionTime<QString> *msrun_retention_time_reference_p);
/** @brief get consensus retention time based on XIC peak measurements
* @return retention time in seconds
*/
double getConsensusPeakRetentionTime() const;
/** @brief get consensus retention time based on MS2 fragmenation and
* identification events
* @return retention time in seconds
*/
double getConsensusMs2RetentionTime() const;
/** @brief internal structure to store msrun + charge + intensity + xic
* coordinate
*/
struct MsRunXicCoordCharge
{
MsRun *msrun_p;
pappso::XicCoordSPtr xic_coord_sp;
std::uint8_t charge;
double intensity; ///< MS1 intensity of the precursor
};
void addMsRunXicCoordCharge(const MsRunXicCoordCharge &msrun_xic_coord);
/** @brief Populate ion mobility grid with observed XIC coordinates for this
* peptide on all MSruns The ion mobility grid only works with Tims TOF
* mobility index
*/
void populateIonMobilityGrid(pappso::IonMobilityGrid *ion_mobility_grid_p) const;
/** @brief build peptide label map from JSON label_list object
*/
void setJsonLabelList(const QJsonObject &json_label_list);
/** @brief get a peptide label pointer with the corresponding label identifier
*/
PeptideLabel *getPeptideLabelPtr(const QString &label) const;
/** @brief get the peptide label label_list
*/
const std::map<QString, PeptideLabelSp> &getPeptideLabelMap() const;
private:
const QString m_id;
const std::vector<ProteinSp> m_proteinSpList;
QString m_mods;
std::vector<std::uint8_t> m_allObservedChargeStateList;
std::vector<MsRunSp> m_observedInMsRunSpList;
std::vector<AlignedPeakPositionElement> m_alignedPeakPositionElementList;
double m_consensusAlignedPeakRetentionTime = 0;
double m_consensusAlignedMs2RetentionTime = 0;
const pappso::MsRunRetentionTime<QString> *mp_referenceMsRunRetentionTime = nullptr;
std::vector<double> m_referenceMs2ObservationList;
std::vector<MsRunXicCoordCharge> m_msRunXicCoordChargeList;
std::map<QString, PeptideLabelSp> m_peptideLabelMap;
};
} // namespace pappso::masschroq
pappso::IonMobilityGrid
Definition ionmobilitygrid.h:42
pappso::MsRunId
MS run identity MsRunId identifies an MS run with a unique ID (XmlId) and contains eventually informa...
Definition msrunid.h:54
pappso::MsRunRetentionTime
Definition msrunretentiontime.h:43
pappso::masschroq::MsRunGroup
Definition msrungroup.h:48
pappso::masschroq::MsRun
Definition msrun.h:50
pappso::masschroq::PeptideBase::PeptideBase
PeptideBase(const pappso::PeptideSp &peptide_sp)
Definition peptidebase.cpp:31
pappso::masschroq::PeptideLabel
Definition peptidelabel.h:40
pappso::masschroq::PeptideObservation
Definition peptideobservation.h:48
pappso::masschroq::Peptide
Definition peptide.h:58
pappso::masschroq::Peptide::m_consensusAlignedPeakRetentionTime
double m_consensusAlignedPeakRetentionTime
Definition peptide.h:245
pappso::masschroq::Peptide::m_mods
QString m_mods
Definition peptide.h:239
pappso::masschroq::Peptide::~Peptide
virtual ~Peptide()
Definition peptide.cpp:49
pappso::masschroq::Peptide::computeConsensusRetentionTime
void computeConsensusRetentionTime()
compute consensus retention time (on MS2 observations and MS1 peak measurements) the computation is b...
Definition peptide.cpp:194
pappso::masschroq::Peptide::getMods
const QString & getMods() const
get optional information as text
Definition peptide.cpp:94
pappso::masschroq::Peptide::addObservedChargeState
void addObservedChargeState(std::uint8_t charge)
Definition peptide.cpp:106
pappso::masschroq::Peptide::m_allObservedChargeStateList
std::vector< std::uint8_t > m_allObservedChargeStateList
Definition peptide.h:240
pappso::masschroq::Peptide::populateIonMobilityGrid
void populateIonMobilityGrid(pappso::IonMobilityGrid *ion_mobility_grid_p) const
Populate ion mobility grid with observed XIC coordinates for this peptide on all MSruns The ion mobil...
Definition peptide.cpp:308
pappso::masschroq::Peptide::Peptide
Peptide(const QString &id, const pappso::PeptideSp &peptide_sp, const std::vector< ProteinSp > &protein_list)
constructor
Definition peptide.cpp:36
pappso::masschroq::Peptide::m_msRunXicCoordChargeList
std::vector< MsRunXicCoordCharge > m_msRunXicCoordChargeList
Definition peptide.h:251
pappso::masschroq::Peptide::computeIsotopologues
virtual void computeIsotopologues(double ni_min_abundance) override
compute possible isotopes for this molecule
Definition peptide.cpp:56
pappso::masschroq::Peptide::addMsRunXicCoordCharge
void addMsRunXicCoordCharge(const MsRunXicCoordCharge &msrun_xic_coord)
Definition peptide.cpp:272
pappso::masschroq::Peptide::m_referenceMs2ObservationList
std::vector< double > m_referenceMs2ObservationList
Definition peptide.h:249
pappso::masschroq::Peptide::isObservedInMsRunSp
bool isObservedInMsRunSp(const MsRun *msrun_p)
tell if this peptide is observed (MS2 fragmentation and identification) in this msrun
Definition peptide.cpp:240
pappso::masschroq::Peptide::m_proteinSpList
const std::vector< ProteinSp > m_proteinSpList
Definition peptide.h:238
pappso::masschroq::Peptide::setJsonLabelList
void setJsonLabelList(const QJsonObject &json_label_list)
build peptide label map from JSON label_list object
Definition peptide.cpp:405
pappso::masschroq::Peptide::setMods
void setMods(const QString &mods)
set optional information as text to this peptide
Definition peptide.cpp:88
pappso::masschroq::Peptide::getAllObservedChargeStateList
const std::vector< std::uint8_t > & getAllObservedChargeStateList() const
Definition peptide.cpp:116
pappso::masschroq::Peptide::getPeptideLabelPtr
PeptideLabel * getPeptideLabelPtr(const QString &label) const
get a peptide label pointer with the corresponding label identifier
Definition peptide.cpp:433
pappso::masschroq::Peptide::getProteinSpList
const std::vector< ProteinSp > & getProteinSpList() const
Definition peptide.cpp:134
pappso::masschroq::Peptide::getId
const QString & getId() const
get peptide unique identifier
Definition peptide.cpp:82
pappso::masschroq::Peptide::getConsensusMs2RetentionTime
double getConsensusMs2RetentionTime() const
get consensus retention time based on MS2 fragmenation and identification events
Definition peptide.cpp:265
pappso::masschroq::Peptide::m_alignedPeakPositionElementList
std::vector< AlignedPeakPositionElement > m_alignedPeakPositionElementList
Definition peptide.h:243
pappso::masschroq::Peptide::getBestXicCoordSPtrForChargeInMsRunGroup
pappso::XicCoordSPtr getBestXicCoordSPtrForChargeInMsRunGroup(const MsRunGroup *msrun_group_p, std::uint8_t charge) const
get the XIC coordinates of the higher observed intensity for this peptide and charge in other MS run ...
Definition peptide.cpp:280
pappso::masschroq::Peptide::m_id
const QString m_id
Definition peptide.h:237
pappso::masschroq::Peptide::setReferenceMsRunRetentionTimePtr
void setReferenceMsRunRetentionTimePtr(const pappso::MsRunRetentionTime< QString > *msrun_retention_time_reference_p)
sets the current msrun retention time reference
Definition peptide.cpp:252
pappso::masschroq::Peptide::getPeptideLabelMap
const std::map< QString, PeptideLabelSp > & getPeptideLabelMap() const
get the peptide label label_list
Definition peptide.cpp:100
pappso::masschroq::Peptide::m_consensusAlignedMs2RetentionTime
double m_consensusAlignedMs2RetentionTime
Definition peptide.h:246
pappso::masschroq::Peptide::m_observedInMsRunSpList
std::vector< MsRunSp > m_observedInMsRunSpList
Definition peptide.h:241
pappso::masschroq::Peptide::getConsensusPeakRetentionTime
double getConsensusPeakRetentionTime() const
get consensus retention time based on XIC peak measurements
Definition peptide.cpp:259
pappso::masschroq::Peptide::addAlignedPeptideObservation
void addAlignedPeptideObservation(const PeptideObservation &peptide_observation, const pappso::MsRunRetentionTime< QString > &msrun_retention_time)
accumulate retention time information for MS2 observation convenient function used while collecting d...
Definition peptide.cpp:180
pappso::masschroq::Peptide::m_peptideLabelMap
std::map< QString, PeptideLabelSp > m_peptideLabelMap
Definition peptide.h:253
pappso::masschroq::Peptide::addAlignedPeakMeasurement
void addAlignedPeakMeasurement(const PeptideMeasurements::Measurement &one_xic_measure, const pappso::MsRunRetentionTime< QString > &msrun_retention_time)
accumulate retention time information for MS1 peak measurement
Definition peptide.cpp:140
pappso::masschroq::Peptide::mp_referenceMsRunRetentionTime
const pappso::MsRunRetentionTime< QString > * mp_referenceMsRunRetentionTime
Definition peptide.h:248
pappso::masschroq::Peptide::getBestIonMobilityXicCoordToExtractOverallMsRunGroup
pappso::XicCoordSPtr getBestIonMobilityXicCoordToExtractOverallMsRunGroup(const MsRunGroup &msrun_group, const pappso::MsRunId &targeted_msrun, std::uint8_t charge) const
get ion mobility coordinates corrected against other MSruns in the group
Definition peptide.cpp:351
pappso::masschroq::Peptide::addObservedInMsRunSp
void addObservedInMsRunSp(const MsRunSp &msrun_sp)
Definition peptide.cpp:123
ionmobilitygrid.h
protein.h
msrun.h
msrunretentiontime.h
pappso::masschroq
Definition alignmentmethod.h:38
pappso::masschroq::PeptideLabelSp
std::shared_ptr< PeptideLabel > PeptideLabelSp
Definition peptide.h:52
pappso::masschroq::PeptideSp
std::shared_ptr< Peptide > PeptideSp
Definition peptide.h:46
pappso::masschroq::MsRunSp
std::shared_ptr< MsRun > MsRunSp
Definition msrun.h:44
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition aamodification.h:48
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44
peptidebase.h
peptidemeasurements.h
pappso::masschroq::PeptideMeasurementsBase::Measurement
Definition peptidemeasurementsbase.h:74
pappso::masschroq::Peptide::AlignedPeakPositionElement
internal structure to compute consensus retention times
Definition peptide.h:145
pappso::masschroq::Peptide::AlignedPeakPositionElement::alignedRetentionTime
double alignedRetentionTime
Definition peptide.h:146
pappso::masschroq::Peptide::AlignedPeakPositionElement::wide
double wide
Definition peptide.h:148
pappso::masschroq::Peptide::AlignedPeakPositionElement::intensity
double intensity
Definition peptide.h:147
pappso::masschroq::Peptide::AlignedPeakPositionElement::alignedRetentionTimeCenter
double alignedRetentionTimeCenter
Definition peptide.h:149
pappso::masschroq::Peptide::MsRunXicCoordCharge
internal structure to store msrun + charge + intensity + xic coordinate
Definition peptide.h:207
pappso::masschroq::Peptide::MsRunXicCoordCharge::msrun_p
MsRun * msrun_p
Definition peptide.h:208
pappso::masschroq::Peptide::MsRunXicCoordCharge::xic_coord_sp
pappso::XicCoordSPtr xic_coord_sp
Definition peptide.h:209
pappso::masschroq::Peptide::MsRunXicCoordCharge::intensity
double intensity
MS1 intensity of the precursor.
Definition peptide.h:211
pappso::masschroq::Peptide::MsRunXicCoordCharge::charge
std::uint8_t charge
Definition peptide.h:210