libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
mbrpeptidemeasurements.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/masschroq/mbrpeptidemeasurements.cpp
3
* \date 27/10/2024
4
* \author Olivier Langella
5
* \brief peptide extracted measures in MBR mode 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
#include "
mbrpeptidemeasurements.h
"
30
31
#include "
msrungroup.h
"
32
#include "
pappsomspp/core/processing/detection/tracepeaklist.h
"
33
#include "
pappsomspp/core/pappsoexception.h
"
34
35
pappso::masschroq::MbrPeptideMeasurements::MbrPeptideMeasurements
(
36
const
pappso::masschroq::PeptideSp
&peptide_sp)
37
:
msp_peptide
(peptide_sp)
38
{
39
if
(
msp_peptide
.get() ==
nullptr
)
40
{
41
throw pappso::PappsoException(
"msp_peptide.get() == nullptr"
);
42
}
43
}
44
45
46
pappso::masschroq::MbrPeptideMeasurements::MbrPeptideMeasurements
(
47
const
pappso::masschroq::MbrPeptideMeasurements
&other)
48
:
PeptideMeasurementsBase
(other)
49
{
50
msp_peptide
= other.
msp_peptide
;
51
m_consensusMs2RetentionTime
= other.
m_consensusMs2RetentionTime
;
52
}
53
54
55
pappso::masschroq::MbrPeptideMeasurements::~MbrPeptideMeasurements
()
56
{
57
}
58
59
60
void
61
pappso::masschroq::MbrPeptideMeasurements::prepareMeasurements
(
62
const
pappso::MsRunId
&targeted_msrun,
63
const
pappso::masschroq::MsRunGroup
*msrun_group_p,
64
const
pappso::MsRunRetentionTime<QString>
&msrun_retention_time,
65
const
QuantificationMethodSp
&quantification_method)
66
{
67
// for one peptide
68
pappso::masschroq::Peptide
*the_peptide_p =
msp_peptide
.get();
69
// 1) charge states
70
// 2) isotope list
71
std::vector<std::uint8_t> charge_states = the_peptide_p->
getAllObservedChargeStateList
();
72
73
74
m_consensusMs2RetentionTime
= the_peptide_p->
getConsensusMs2RetentionTime
();
75
76
if
(msrun_retention_time.
isAligned
())
77
{
78
m_consensusMs2RetentionTime
=
79
msrun_retention_time.
translateAligned2OriginalRetentionTime
(
m_consensusMs2RetentionTime
);
80
}
81
82
double
consensus_rt = the_peptide_p->
getConsensusPeakRetentionTime
();
83
84
if
(consensus_rt > 0)
85
{
86
if
(msrun_retention_time.
isAligned
())
87
{
88
consensus_rt = msrun_retention_time.
translateAligned2OriginalRetentionTime
(consensus_rt);
89
}
90
}
91
for
(std::uint8_t charge : charge_states)
92
{
93
94
pappso::XicCoordSPtr
best_xic_coord;
95
if
(msrun_group_p->
getIonMobilityGridSp
().get() !=
nullptr
)
96
{
97
best_xic_coord = the_peptide_p->
getBestIonMobilityXicCoordToExtractOverallMsRunGroup
(
98
*msrun_group_p, targeted_msrun, charge);
99
}
100
else
101
{
102
best_xic_coord =
103
the_peptide_p->
getBestXicCoordSPtrForChargeInMsRunGroup
(msrun_group_p, charge);
104
}
105
106
if
(best_xic_coord.get() ==
nullptr
)
107
{
108
// We can not quantify it in this msrun group
109
}
110
else
111
{
112
113
prepareMeasurementsForPeptide
(
114
*the_peptide_p, quantification_method, best_xic_coord, charge, consensus_rt);
115
}
116
}
117
}
118
119
120
void
121
pappso::masschroq::MbrPeptideMeasurements::detectQuantifyPeaks
(
122
const
pappso::masschroq::QuantificationMethodSp
&quantification_method)
123
{
124
125
qDebug();
126
pappso::TracePeakList
peak_list;
127
std::vector<std::uint8_t> all_charge_states =
msp_peptide
.get()->getAllObservedChargeStateList();
128
129
130
for
(
auto
&measure_one :
m_measurementList
)
131
{
132
qDebug();
133
double
rt_target = measure_one.msp_xicCoord.get()->rtTarget;
134
peak_list.clear();
135
quantification_method.get()->
getTraceDetectionInterfaceCstSPtr
().get()->detect(
136
*(measure_one.msp_xicCoord.get()->xicSptr.get()), peak_list,
false
);
137
138
qDebug();
139
measure_one.m_peakQualityCategory =
PeakQualityCategory::missed
;
140
if
(
m_consensusMs2RetentionTime
> 0)
141
{
142
qDebug();
143
auto
it_best_matched_peak =
pappso::findTracePeakGivenRt
(
144
peak_list.begin(), peak_list.end(),
m_consensusMs2RetentionTime
);
145
146
if
(it_best_matched_peak != peak_list.end())
147
{
148
measure_one.m_tracePeakSp = it_best_matched_peak->makeTracePeakCstSPtr();
149
measure_one.m_peakQualityCategory =
PeakQualityCategory::c
;
150
if
(it_best_matched_peak->containsRt(rt_target))
151
{
152
measure_one.m_peakQualityCategory =
PeakQualityCategory::b
;
153
}
154
}
155
else
156
{
157
158
it_best_matched_peak =
159
pappso::findTracePeakGivenRt
(peak_list.begin(), peak_list.end(), rt_target);
160
161
if
(it_best_matched_peak != peak_list.end())
162
{
163
measure_one.m_tracePeakSp = it_best_matched_peak->makeTracePeakCstSPtr();
164
measure_one.m_peakQualityCategory =
PeakQualityCategory::d
;
165
}
166
}
167
}
168
}
169
}
170
171
const
pappso::masschroq::PeptideSp
&
172
pappso::masschroq::MbrPeptideMeasurements::getPeptideSp
()
const
173
{
174
return
msp_peptide
;
175
}
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::MsRunRetentionTime::isAligned
bool isAligned() const
Definition
msrunretentiontime.cpp:395
pappso::MsRunRetentionTime::translateAligned2OriginalRetentionTime
double translateAligned2OriginalRetentionTime(double aligned_retention_time) const
Definition
msrunretentiontime.cpp:336
pappso::TracePeakList
Definition
tracepeaklist.h:43
pappso::masschroq::MbrPeptideMeasurements
Definition
mbrpeptidemeasurements.h:49
pappso::masschroq::MbrPeptideMeasurements::detectQuantifyPeaks
virtual void detectQuantifyPeaks(const QuantificationMethodSp &quantification_method) override
Definition
mbrpeptidemeasurements.cpp:121
pappso::masschroq::MbrPeptideMeasurements::MbrPeptideMeasurements
MbrPeptideMeasurements(const PeptideSp &peptide_sp)
Definition
mbrpeptidemeasurements.cpp:35
pappso::masschroq::MbrPeptideMeasurements::getPeptideSp
const PeptideSp & getPeptideSp() const
Definition
mbrpeptidemeasurements.cpp:172
pappso::masschroq::MbrPeptideMeasurements::m_consensusMs2RetentionTime
double m_consensusMs2RetentionTime
Definition
mbrpeptidemeasurements.h:78
pappso::masschroq::MbrPeptideMeasurements::msp_peptide
PeptideSp msp_peptide
Definition
mbrpeptidemeasurements.h:76
pappso::masschroq::MbrPeptideMeasurements::prepareMeasurements
void prepareMeasurements(const pappso::MsRunId &targeted_msrun, const MsRunGroup *msrun_group_p, const pappso::MsRunRetentionTime< QString > &msrun_retention_time, const QuantificationMethodSp &quantification_method)
Definition
mbrpeptidemeasurements.cpp:61
pappso::masschroq::MbrPeptideMeasurements::~MbrPeptideMeasurements
virtual ~MbrPeptideMeasurements()
Definition
mbrpeptidemeasurements.cpp:55
pappso::masschroq::MsRunGroup
Definition
msrungroup.h:48
pappso::masschroq::MsRunGroup::getIonMobilityGridSp
const std::shared_ptr< pappso::IonMobilityGrid > & getIonMobilityGridSp() const
Definition
msrungroup.cpp:334
pappso::masschroq::PeptideMeasurementsBase::m_measurementList
std::vector< Measurement > m_measurementList
Definition
peptidemeasurementsbase.h:117
pappso::masschroq::PeptideMeasurementsBase::PeptideMeasurementsBase
PeptideMeasurementsBase()
Definition
peptidemeasurementsbase.cpp:34
pappso::masschroq::PeptideMeasurementsBase::prepareMeasurementsForPeptide
virtual void prepareMeasurementsForPeptide(Peptide &the_peptide, const QuantificationMethodSp &quantification_method, const pappso::XicCoordSPtr &best_xic_coord, std::uint8_t charge, double best_rt) final
Definition
peptidemeasurementsbase.cpp:89
pappso::masschroq::Peptide
Definition
peptide.h:58
pappso::masschroq::Peptide::getAllObservedChargeStateList
const std::vector< std::uint8_t > & getAllObservedChargeStateList() const
Definition
peptide.cpp:116
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::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::getConsensusPeakRetentionTime
double getConsensusPeakRetentionTime() const
get consensus retention time based on XIC peak measurements
Definition
peptide.cpp:259
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::QuantificationMethod::getTraceDetectionInterfaceCstSPtr
const pappso::TraceDetectionInterfaceCstSPtr & getTraceDetectionInterfaceCstSPtr() const
Definition
quantificationmethod.cpp:199
mbrpeptidemeasurements.h
msrungroup.h
pappso::masschroq::QuantificationMethodSp
std::shared_ptr< QuantificationMethod > QuantificationMethodSp
Definition
quantificationmethod.h:46
pappso::masschroq::PeakQualityCategory::missed
@ missed
no peak found at all
Definition
types.h:60
pappso::masschroq::PeakQualityCategory::c
@ c
Definition
types.h:54
pappso::masschroq::PeakQualityCategory::d
@ d
Definition
types.h:56
pappso::masschroq::PeakQualityCategory::b
@ b
Definition
types.h:52
pappso::masschroq::PeptideSp
std::shared_ptr< Peptide > PeptideSp
Definition
peptide.h:46
pappso::findTracePeakGivenRt
PMSPP_LIB_DECL std::vector< TracePeak >::iterator findTracePeakGivenRt(std::vector< TracePeak >::iterator begin, std::vector< TracePeak >::iterator end, double rt)
find the peak matching a retention time
Definition
tracepeaklist.cpp:78
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition
xiccoord.h:44
pappsoexception.h
tracepeaklist.h
pappsomspp
core
masschroq
mbrpeptidemeasurements.cpp
Generated on
for libpappsomspp by
1.17.0