libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptidemeasurementsbase.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/masschroq/peptidemeasurements.cpp
3 * \date 24/01/2025
4 * \author Olivier Langella
5 * \brief peptide measurement model base in masschroqlite
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2025 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
30#include "peptide.h"
31#include "peptidelabel.h"
33
37
41
47
48
49const std::vector<pappso::masschroq::PeptideMeasurementsBase::Measurement> &
54
55void
58 const PeptideLabel *label_p,
59 const pappso::masschroq::QuantificationMethodSp &quantification_method,
60 std::uint8_t charge,
61 double isotope_minimum_ratio,
62 const pappso::XicCoordSPtr &best_xic_coord,
63 double best_rt)
64{
65
66 qDebug();
67 const std::vector<pappso::PeptideNaturalIsotopeAverageSp> &natural_isotope_average_list =
69 quantification_method.get()->getXicExtractionMeanPrecisionPtr(),
70 charge,
71 isotope_minimum_ratio);
72
73 for(pappso::PeptideNaturalIsotopeAverageSp isotope_average_sp : natural_isotope_average_list)
74 {
75 pappso::XicCoordSPtr xic_coord = best_xic_coord->initializeAndClone();
76 xic_coord.get()->rtTarget = best_rt;
77 xic_coord.get()->mzRange =
78 quantification_method.get()->getXicExtractionMzRange(isotope_average_sp.get()->getMz());
79
80
81 m_measurementList.push_back(
82 {charge, xic_coord, PeakQualityCategory::nomatch, label_p, nullptr, isotope_average_sp});
83 }
84
85 qDebug() << m_measurementList.size();
86}
87
88void
90 pappso::masschroq::Peptide &the_peptide,
91 const QuantificationMethodSp &quantification_method,
92 const pappso::XicCoordSPtr &best_xic_coord,
93 std::uint8_t charge,
94 double best_rt)
95{
96
97 double isotope_minimum_ratio = quantification_method.get()->getIsotopeMinimumRatio();
98
99
100 auto label_map = the_peptide.getPeptideLabelMap();
101
102 if(isotope_minimum_ratio > 0)
103 {
104 // isotope
105 if(label_map.size() > 0)
106 {
107 // isotope, label
108
109 for(auto &peptide_label_pair : label_map)
110 {
111 // for each label
112 qDebug();
113 generateMeasurementsForIsotopeList(*(peptide_label_pair.second.get()),
114 peptide_label_pair.second.get(),
115 quantification_method,
116 charge,
117 isotope_minimum_ratio,
118 best_xic_coord,
119 best_rt);
120 }
121 }
122 else
123 {
124 // isotope, no label
126 nullptr,
127 quantification_method,
128 charge,
129 isotope_minimum_ratio,
130 best_xic_coord,
131 best_rt);
132 }
133 }
134 else
135 {
136 // no isotope
137 if(label_map.size() > 0)
138 {
139 // no isotope, label
140 for(auto &peptide_label_pair : label_map)
141 {
142 // for each label
143 qDebug();
144 double mz = peptide_label_pair.second->getPappsoPeptideSp().get()->getMz(charge);
145 pappso::XicCoordSPtr xic_coord = best_xic_coord->initializeAndClone();
146 xic_coord.get()->rtTarget = best_rt;
147 xic_coord.get()->mzRange = quantification_method.get()->getXicExtractionMzRange(mz);
148
149
150 m_measurementList.push_back({charge,
151 xic_coord,
153 peptide_label_pair.second.get(),
154 nullptr,
155 nullptr});
156 }
157 }
158 else
159 {
160 // no isotope, no label
161 double mz = the_peptide.getPappsoPeptideSp().get()->getMz(charge);
162 pappso::XicCoordSPtr xic_coord = best_xic_coord->initializeAndClone();
163 xic_coord.get()->rtTarget = best_rt;
164 xic_coord.get()->mzRange = quantification_method.get()->getXicExtractionMzRange(mz);
165
166
167 m_measurementList.push_back(
168 {charge, xic_coord, PeakQualityCategory::nomatch, nullptr, nullptr, nullptr});
169 }
170 }
171}
172
173
174void
176 std::vector<pappso::XicCoordSPtr> &xic_coord_list) const
177{
178 for(auto &measure : m_measurementList)
179 {
180 if(measure.msp_xicCoord.get()->rtTarget > 0)
181 {
182 xic_coord_list.push_back(measure.msp_xicCoord);
183 }
184 }
185}
186
187
188void
190{
191
192 for(auto &measure_one : m_measurementList)
193 {
194 measure_one.msp_xicCoord.get()->xicSptr = nullptr;
195 }
196}
197
198void
virtual const std::vector< pappso::PeptideNaturalIsotopeAverageSp > & getPeptideNaturalIsotopeAverageSpList(pappso::PrecisionPtr precision, std::uint8_t charge, double ni_min_abundance)
get possible and distinguishable masses of isotopes get list of distinguishable isotopes given the ch...
virtual const pappso::PeptideSp & getPappsoPeptideSp() const
get the peptide sequence
virtual const std::vector< Measurement > & getMeasurementList() const
virtual void pushBackXicCoordList(std::vector< pappso::XicCoordSPtr > &xic_coord_list) const final
virtual void generateMeasurementsForIsotopeList(PeptideBase &peptide_base, const PeptideLabel *label_p, const QuantificationMethodSp &quantification_method, std::uint8_t charge, double isotope_minimum_ratio, const pappso::XicCoordSPtr &best_xic_coord, double best_rt) final
virtual void clear() final
clear the measurement vector
virtual void prepareMeasurementsForPeptide(Peptide &the_peptide, const QuantificationMethodSp &quantification_method, const pappso::XicCoordSPtr &best_xic_coord, std::uint8_t charge, double best_rt) final
const std::map< QString, PeptideLabelSp > & getPeptideLabelMap() const
get the peptide label label_list
Definition peptide.cpp:100
pappso::PrecisionPtr getXicExtractionMeanPrecisionPtr() const
const pappso::MzRange getXicExtractionMzRange(double mz) const
std::shared_ptr< QuantificationMethod > QuantificationMethodSp
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44