OpenMS
Loading...
Searching...
No Matches
IsobaricChannelExtractor.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Stephan Aiche, Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
15
16namespace OpenMS
17{
18 class IsobaricQuantitationMethod;
19 class ConsensusMap;
20 class ConsensusFeature;
21
23 struct ChannelQC
24 {
25
26 std::vector<double> mz_deltas;
28 };
29
30 typedef std::map<std::string, ChannelQC> ChannelQCSet;
31
53 class OPENMS_DLLAPI IsobaricChannelExtractor :
55 {
56public:
62 explicit IsobaricChannelExtractor(const IsobaricQuantitationMethod* const quant_method);
63
66
69
76 void extractChannels(const PeakMap& ms_exp_data, ConsensusMap& consensus_map);
77
88 std::vector<double> extractSingleSpec(Size spec_idx, const MSExperiment& exp, std::vector<std::pair<double, unsigned>>& channel_qc);
89
99 void registerChannelsInOutputMap(ConsensusMap& consensus_map, const std::string& filename = "");
100
105 void printStats(ChannelQCSet& stats) const;
106
113 void printStatsWithMissing(std::vector<ChannelQC>& stats) const;
114
119
126
132 static bool scanWindowCoversChannels(const MSSpectrum& spec, const IsobaricQuantitationMethod& method, double tolerance = 0.0);
133
134private:
143 {
148
153
159 PurityState_(const PeakMap& targetExp);
160
166 void advanceFollowUp(const double rt);
167
173 bool followUpValid(const double rt) const;
174 };
175
178
181
184
187
190
193
196
199
202
205
207 static constexpr double qc_dist_mz = 0.5; // fixed! Do not change!
208
211
218 bool isValidPrecursor_(const Precursor& precursor) const;
219
227
235 double computePrecursorPurity_(const PeakMap::ConstIterator& ms2_spec, const PurityState_& precursor) const;
236
245 double computeSingleScanPrecursorPurity_(const PeakMap::ConstIterator& ms2_spec, const PeakMap::SpectrumType& precursor_spec) const;
246
253 std::string getActivationMethod_(const PeakMap::SpectrumType& s) const
254 {
255 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
256 {
257 if (!it->getActivationMethods().empty()) return Precursor::NamesOfActivationMethod[static_cast<size_t>(*(it->getActivationMethods().begin()))];
258 }
259 return "";
260 }
261
262
263protected:
266
268 void updateMembers_() override;
269 };
270} // namespace
271
A consensus feature spanning multiple LC-MS/MS experiments.
Definition ConsensusFeature.h:45
A container for consensus elements.
Definition ConsensusMap.h:67
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Extracts individual channels from MS/MS spectra for isobaric labeling experiments.
Definition IsobaricChannelExtractor.h:55
bool hasLowIntensityReporter_(const ConsensusFeature &cf) const
Checks whether the given ConsensusFeature contains a channel that is below the given intensity thresh...
void printStats()
Prints statistics about the channel errors with OPENMS_LOG_INFO.
double computeSingleScanPrecursorPurity_(const PeakMap::ConstIterator &ms2_spec, const PeakMap::SpectrumType &precursor_spec) const
Computes the purity of the precursor given an iterator pointing to the MS/MS spectrum and a reference...
bool interpolate_precursor_purity_
Flag if precursor purity will solely be computed based on the precursor scan (false),...
Definition IsobaricChannelExtractor.h:204
const IsobaricQuantitationMethod * quant_method_
The used quantitation method (itraq4plex, tmt6plex,..).
Definition IsobaricChannelExtractor.h:177
Peak2D::CoordinateType reporter_mass_shift_
Allowed deviation between the expected and observed reporter ion m/z.
Definition IsobaricChannelExtractor.h:183
std::string selected_activation_
Used to select only specific types of spectra for the channel extraction.
Definition IsobaricChannelExtractor.h:180
void extractChannels(const PeakMap &ms_exp_data, ConsensusMap &consensus_map)
Extracts the isobaric channels from the tandem MS data and stores intensity values in a consensus map...
bool remove_low_intensity_quantifications_
Flag if complete quantification should be discarded if a single reporter ion has an intensity below t...
Definition IsobaricChannelExtractor.h:195
static bool scanWindowCoversChannels(const MSSpectrum &spec, const IsobaricQuantitationMethod &method, double tolerance=0.0)
Whether the scan window(s) of spec reach every reporter ion of method (within tolerance)
IsobaricChannelExtractor(const IsobaricQuantitationMethod *const quant_method)
C'tor to create a new channel extractor for the given quantitation method.
void setDefaultParams_()
implemented for DefaultParamHandler
double max_precursor_isotope_deviation_
Max. allowed deviation between theoretical and observed isotopic peaks of the precursor peak in the i...
Definition IsobaricChannelExtractor.h:201
void registerChannelsInOutputMap(ConsensusMap &consensus_map, const std::string &filename="")
Registers channel information in a ConsensusMap.
void printStatsWithMissing(std::vector< ChannelQC > &stats) const
Prints the stats collected during quantification. ChannelQC mzdeltas may contain missing values encod...
IsobaricChannelExtractor & operator=(const IsobaricChannelExtractor &rhs)
Assignment operator.
IsobaricChannelExtractor(const IsobaricChannelExtractor &other)
Copy c'tor.
double min_precursor_purity_
Minimum precursor purity to accept the spectrum for quantitation.
Definition IsobaricChannelExtractor.h:198
Peak2D::IntensityType min_reporter_intensity_
Minimum reporter ion intensity to be considered for quantitation.
Definition IsobaricChannelExtractor.h:192
double computePrecursorPurity_(const PeakMap::ConstIterator &ms2_spec, const PurityState_ &precursor) const
Computes the purity of the precursor given an iterator pointing to the MS/MS spectrum and one to the ...
ChannelQCSet & getStats()
Returns a reference to the channel statistics.
std::string getActivationMethod_(const PeakMap::SpectrumType &s) const
Get the first (of potentially many) activation methods (HCD,CID,...) of this spectrum.
Definition IsobaricChannelExtractor.h:253
bool isValidPrecursor_(const Precursor &precursor) const
Checks if the given precursor fulfills all constraints for extractions.
void updateMembers_() override
implemented for DefaultParamHandler
void clearStats()
Clears channel statistics, e.g. after a new experiment has been loaded.
Peak2D::IntensityType min_precursor_intensity_
Minimum intensity of the precursor to be considered for quantitation.
Definition IsobaricChannelExtractor.h:186
ChannelQCSet channel_mz_delta
Accumulates QC metrics for the different channels.
Definition IsobaricChannelExtractor.h:210
std::vector< double > extractSingleSpec(Size spec_idx, const MSExperiment &exp, std::vector< std::pair< double, unsigned > > &channel_qc)
Extracts intensities for channels of reporter ions from isobaric tags (according to the quantitation ...
void printStats(ChannelQCSet &stats) const
bool keep_unannotated_precursor_
Flag if precursor with missing intensity value or missing precursor spectrum should be included or no...
Definition IsobaricChannelExtractor.h:189
Abstract base class describing an isobaric quantitation method in terms of the used channels and an i...
Definition IsobaricQuantitationMethod.h:35
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition MSExperiment.h:86
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
double CoordinateType
Coordinate type (of the position)
Definition Peak2D.h:39
float IntensityType
Intensity type.
Definition Peak2D.h:37
Precursor meta information.
Definition Precursor.h:37
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
int signal_not_unique
counts if more than one peak was found within the search window of each reporter position
Definition IsobaricChannelExtractor.h:27
std::map< std::string, ChannelQC > ChannelQCSet
Definition IsobaricChannelExtractor.h:30
std::vector< double > mz_deltas
m/z distance between expected and observed reporter ion closest to expected position
Definition IsobaricChannelExtractor.h:26
small quality control class, holding temporary data for reporting
Definition IsobaricChannelExtractor.h:24
Small struct to capture the current state of the purity computation.
Definition IsobaricChannelExtractor.h:143
void advanceFollowUp(const double rt)
Searches the experiment for the next MS1 spectrum with a retention time bigger then rt.
const PeakMap & baseExperiment
reference to the experiment to analyze
Definition IsobaricChannelExtractor.h:152
PeakMap::ConstIterator precursorScan
Iterator pointing to the potential MS1 precursor scan.
Definition IsobaricChannelExtractor.h:145
PeakMap::ConstIterator followUpScan
Iterator pointing to the potential follow up MS1 scan.
Definition IsobaricChannelExtractor.h:147
bool followUpValid(const double rt) const
Check if the currently selected follow up scan has a retention time bigger then the given value.
PurityState_(const PeakMap &targetExp)
C'tor taking the experiment that will be analyzed.
bool hasFollowUpScan
Indicates if a follow up scan was found.
Definition IsobaricChannelExtractor.h:150