libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptide.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/masschroq/peptide.h
3 * \date 24/09/2024
4 * \author Olivier Langella
5 * \brief peptide model in masschroqlite
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2024 Olivier Langella
10 *<Olivier.Langella@universite-paris-saclay.fr>.
11 *
12 * This file is part of MassChroQ.
13 *
14 * MassChroQ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * MassChroQ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with MassChroQ. If not, see <http://www.gnu.org/licenses/>.
26 *
27 ******************************************************************************/
28
29#pragma once
30
31
32#include "peptidebase.h"
33#include "msrun.h"
34#include "protein.h"
35#include "peptidemeasurements.h"
38#include <cstdint>
39#include <QJsonObject>
40
41namespace pappso::masschroq
42{
43
44class Peptide;
45
46typedef std::shared_ptr<Peptide> PeptideSp;
47
48class MsRunGroup;
49
50class PeptideLabel;
51
52typedef std::shared_ptr<PeptideLabel> PeptideLabelSp;
53
54/**
55 * unique studied entity representing the molecule we want to measure
56 */
57class Peptide : public PeptideBase
58{
59 public:
60 /** @brief constructor
61 * @param id unique identifier for this peptide
62 * @param msp_peptide peptide sequence
63 * @param protein_list vector of protein shared pointer linked to this
64 * peptide^
65 */
66 Peptide(const QString &id,
67 const pappso::PeptideSp &peptide_sp,
68 const std::vector<ProteinSp> &protein_list);
69
70 /**
71 * Copy constructor
72 *
73 * @param other TODO
74 */
75 Peptide(const Peptide &other);
76
77 /**
78 * Destructor
79 */
80 virtual ~Peptide();
81
82
83 /** @brief compute possible isotopes for this molecule
84 * @param ni_min_abundance the minimal isotop abundance proportion to cover
85 * (0.9 will compute isotopes to reach at least 90% of its theoretical
86 * abundance
87 */
88 virtual void computeIsotopologues(double ni_min_abundance) override;
89
90
91 /** @brief get peptide unique identifier
92 */
93 const QString &getId() const;
94
95 /** @brief set optional information as text to this peptide
96 */
97 void setMods(const QString &mods);
98
99 /** @brief get optional information as text
100 */
101 const QString &getMods() const;
102
103
104 void addObservedChargeState(std::uint8_t charge);
105 void addObservedInMsRunSp(const MsRunSp &msrun_sp);
106
107 const std::vector<std::uint8_t> &getAllObservedChargeStateList() const;
108
109 const std::vector<ProteinSp> &getProteinSpList() const;
110
111 /** @brief accumulate retention time information for MS1 peak measurement
112 *
113 * convenient function used while collecting data from first pass
114 * quantification process
115 * @param one_xic_measure a peak to process
116 * @param msrun_retention_time the msrun retention time converter for this
117 * msrun
118 */
120 const pappso::MsRunRetentionTime<QString> &msrun_retention_time);
121
122
123 /** @brief accumulate retention time information for MS2 observation
124 * convenient function used while collecting data from first pass
125 * quantification process
126 * @param peptide_observation an MS2 observation
127 * @param msrun_retention_time the msrun retention time converter for this
128 * msrun
129 *
130 */
131 void
132 addAlignedPeptideObservation(const PeptideObservation &peptide_observation,
133 const pappso::MsRunRetentionTime<QString> &msrun_retention_time);
134
135 /** @brief compute consensus retention time (on MS2 observations and MS1 peak
136 * measurements) the computation is based on data collected during the first
137 * pass of quantification
138 */
140
141
142 /** @brief internal structure to compute consensus retention times
143 */
151
152
153 /** @brief tell if this peptide is observed (MS2 fragmentation and
154 * identification) in this msrun
155 * @param msrun_p msrun pointer
156 * @return true if observed, false otherwise
157 */
158 bool isObservedInMsRunSp(const MsRun *msrun_p);
159
160
161 /** @brief get the XIC coordinates of the higher observed intensity for this
162 * peptide and charge in other MS run in the group
163 * @param msrun_group_p pointer on the msrun group
164 * @param charge the targeted charge
165 * @return pappso::XicCoordSPtr shared pointer on xic coordinate
166 */
168 std::uint8_t charge) const;
169
170 /** @brief get ion mobility coordinates corrected against other MSruns in the
171 * group
172 *
173 * @param msrun_group_p pointer on the msrun group
174 * @param targeted_msrun the xic coordinate target (required to adjust ion
175 * mobility to this msrun)
176 * @param charge the targeted charge
177 * @return pappso::XicCoordSPtr shared pointer on xic coordinate
178 */
181 const pappso::MsRunId &targeted_msrun,
182 std::uint8_t charge) const;
183
184 /** @brief sets the current msrun retention time reference
185 * @param pappso::MsRunRetentionTime<QString> msrun run retention time
186 * reference
187 */
189 const pappso::MsRunRetentionTime<QString> *msrun_retention_time_reference_p);
190
191 /** @brief get consensus retention time based on XIC peak measurements
192 * @return retention time in seconds
193 */
194 double getConsensusPeakRetentionTime() const;
195
196
197 /** @brief get consensus retention time based on MS2 fragmenation and
198 * identification events
199 * @return retention time in seconds
200 */
201 double getConsensusMs2RetentionTime() const;
202
203 /** @brief internal structure to store msrun + charge + intensity + xic
204 * coordinate
205 */
207 {
210 std::uint8_t charge;
211 double intensity; ///< MS1 intensity of the precursor
212 };
213
214 void addMsRunXicCoordCharge(const MsRunXicCoordCharge &msrun_xic_coord);
215
216
217 /** @brief Populate ion mobility grid with observed XIC coordinates for this
218 * peptide on all MSruns The ion mobility grid only works with Tims TOF
219 * mobility index
220 */
221 void populateIonMobilityGrid(pappso::IonMobilityGrid *ion_mobility_grid_p) const;
222
223 /** @brief build peptide label map from JSON label_list object
224 */
225 void setJsonLabelList(const QJsonObject &json_label_list);
226
227
228 /** @brief get a peptide label pointer with the corresponding label identifier
229 */
230 PeptideLabel *getPeptideLabelPtr(const QString &label) const;
231
232 /** @brief get the peptide label label_list
233 */
234 const std::map<QString, PeptideLabelSp> &getPeptideLabelMap() const;
235
236 private:
237 const QString m_id;
238 const std::vector<ProteinSp> m_proteinSpList;
239 QString m_mods;
240 std::vector<std::uint8_t> m_allObservedChargeStateList;
241 std::vector<MsRunSp> m_observedInMsRunSpList;
242
243 std::vector<AlignedPeakPositionElement> m_alignedPeakPositionElementList;
244
247
249 std::vector<double> m_referenceMs2ObservationList;
250
251 std::vector<MsRunXicCoordCharge> m_msRunXicCoordChargeList;
252
253 std::map<QString, PeptideLabelSp> m_peptideLabelMap;
254};
255} // namespace pappso::masschroq
MS run identity MsRunId identifies an MS run with a unique ID (XmlId) and contains eventually informa...
Definition msrunid.h:54
PeptideBase(const pappso::PeptideSp &peptide_sp)
double m_consensusAlignedPeakRetentionTime
Definition peptide.h:245
void computeConsensusRetentionTime()
compute consensus retention time (on MS2 observations and MS1 peak measurements) the computation is b...
Definition peptide.cpp:194
const QString & getMods() const
get optional information as text
Definition peptide.cpp:94
void addObservedChargeState(std::uint8_t charge)
Definition peptide.cpp:106
std::vector< std::uint8_t > m_allObservedChargeStateList
Definition peptide.h:240
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:306
Peptide(const QString &id, const pappso::PeptideSp &peptide_sp, const std::vector< ProteinSp > &protein_list)
constructor
Definition peptide.cpp:36
std::vector< MsRunXicCoordCharge > m_msRunXicCoordChargeList
Definition peptide.h:251
virtual void computeIsotopologues(double ni_min_abundance) override
compute possible isotopes for this molecule
Definition peptide.cpp:56
void addMsRunXicCoordCharge(const MsRunXicCoordCharge &msrun_xic_coord)
Definition peptide.cpp:271
std::vector< double > m_referenceMs2ObservationList
Definition peptide.h:249
bool isObservedInMsRunSp(const MsRun *msrun_p)
tell if this peptide is observed (MS2 fragmentation and identification) in this msrun
Definition peptide.cpp:240
const std::vector< ProteinSp > m_proteinSpList
Definition peptide.h:238
void setJsonLabelList(const QJsonObject &json_label_list)
build peptide label map from JSON label_list object
Definition peptide.cpp:402
void setMods(const QString &mods)
set optional information as text to this peptide
Definition peptide.cpp:88
const std::vector< std::uint8_t > & getAllObservedChargeStateList() const
Definition peptide.cpp:116
PeptideLabel * getPeptideLabelPtr(const QString &label) const
get a peptide label pointer with the corresponding label identifier
Definition peptide.cpp:430
const std::vector< ProteinSp > & getProteinSpList() const
Definition peptide.cpp:134
const QString & getId() const
get peptide unique identifier
Definition peptide.cpp:82
double getConsensusMs2RetentionTime() const
get consensus retention time based on MS2 fragmenation and identification events
Definition peptide.cpp:264
std::vector< AlignedPeakPositionElement > m_alignedPeakPositionElementList
Definition peptide.h:243
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:278
void setReferenceMsRunRetentionTimePtr(const pappso::MsRunRetentionTime< QString > *msrun_retention_time_reference_p)
sets the current msrun retention time reference
Definition peptide.cpp:251
const std::map< QString, PeptideLabelSp > & getPeptideLabelMap() const
get the peptide label label_list
Definition peptide.cpp:100
double m_consensusAlignedMs2RetentionTime
Definition peptide.h:246
std::vector< MsRunSp > m_observedInMsRunSpList
Definition peptide.h:241
double getConsensusPeakRetentionTime() const
get consensus retention time based on XIC peak measurements
Definition peptide.cpp:258
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
std::map< QString, PeptideLabelSp > m_peptideLabelMap
Definition peptide.h:253
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
const pappso::MsRunRetentionTime< QString > * mp_referenceMsRunRetentionTime
Definition peptide.h:248
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:348
void addObservedInMsRunSp(const MsRunSp &msrun_sp)
Definition peptide.cpp:123
std::shared_ptr< PeptideLabel > PeptideLabelSp
Definition peptide.h:52
std::shared_ptr< Peptide > PeptideSp
Definition peptide.h:46
std::shared_ptr< MsRun > MsRunSp
Definition msrun.h:44
std::shared_ptr< const Peptide > PeptideSp
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44
internal structure to compute consensus retention times
Definition peptide.h:145
internal structure to store msrun + charge + intensity + xic coordinate
Definition peptide.h:207
double intensity
MS1 intensity of the precursor.
Definition peptide.h:211