OpenMS
Loading...
Searching...
No Matches
FeatureFinderAlgorithmMetaboIdent.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg, Hendrik Weisser $
7// --------------------------------------------------------------------------
8
9#pragma once
10
19
20#include <map>
21#include <vector>
22
23namespace OpenMS
24{
25class IsotopeDistribution;
26
29{
30public:
33 {
35 const String& _formula,
36 double _mass,
37 const std::vector<int>& _charges,
38 const std::vector<double>& _rts,
39 const std::vector<double>& _rt_ranges,
40 const std::vector<double>& _iso_distrib,
41 const std::vector<double>& _ion_mobilities = {}):
42 name_(_name),
43 formula_(_formula),
44 mass_(_mass),
45 charges_(_charges),
46 rts_(_rts),
47 rt_ranges_(_rt_ranges),
48 iso_distrib_(_iso_distrib),
49 ion_mobilities_(_ion_mobilities)
50 {
51 }
52
53 private:
56 double mass_;
57 std::vector<int> charges_;
58 std::vector<double> rts_;
59 std::vector<double> rt_ranges_;
60 std::vector<double> iso_distrib_;
61 std::vector<double> ion_mobilities_;
62
63 public:
64 const String& getName() const {
65 return name_;
66 }
67
68 const String& getFormula() const {
69 return formula_;
70 }
71
72 double getMass() const {
73 return mass_;
74 }
75
76 const std::vector<int>& getCharges() const {
77 return charges_;
78 }
79
80 const std::vector<double>& getRTs() const {
81 return rts_;
82 }
83
84 const std::vector<double> getRTRanges() const {
85 return rt_ranges_;
86 }
87
88 const std::vector<double>& getIsotopeDistribution() const {
89 return iso_distrib_;
90 }
91
92 const std::vector<double>& getIonMobilities() const {
93 return ion_mobilities_;
94 }
95 };
96
99
109 void run(const std::vector<FeatureFinderMetaboIdentCompound>& metaboIdentTable, FeatureMap& features, const String& spectra_file = "");
110
112 PeakMap& getMSData() { return ms_data_; }
113 const PeakMap& getMSData() const { return ms_data_; }
114
116 void setMSData(const PeakMap& m); // needed because pyOpenMS can't wrap the non-const reference version
117
118 void setMSData(PeakMap&& m); // moves peak data and saves the copy. Note that getMSData() will give back a processed/modified version.
119
121 const PeakMap& getChromatograms() const { return chrom_data_; }
122 PeakMap& getChromatograms() { return chrom_data_; }
123
125 const TargetedExperiment& getLibrary() const { return library_; }
126
128 const TransformationDescription& getTransformations() const { return trafo_; }
129
131 size_t getNShared() const { return n_shared_; }
132
134protected:
135
138 {
140 double rt_min, rt_max, mz_min, mz_max;
141 };
142
144 typedef std::map<UInt64, std::vector<MassTraceBounds> > FeatureBoundsMap;
145
148
149 typedef std::vector<Feature*> FeatureGroup;
150
153 {
154 bool operator()(const Feature& feature)
155 {
156 return feature.metaValueExists("FFMetId_remove");
157 }
158 } feature_filter_;
159
162 {
163 bool operator()(const Feature& f1, const Feature& f2)
164 {
165 const String& ref1 = f1.getMetaValue("PeptideRef");
166 const String& ref2 = f2.getMetaValue("PeptideRef");
167 if (ref1 == ref2)
168 {
169 return f1.getRT() < f2.getRT();
170 }
171 return ref1 < ref2;
172 }
173 } feature_compare_;
174
175
176 void extractTransformations_(const FeatureMap& features);
177
179 void addTargetToLibrary_(const String& name, const String& formula,
180 double mass, const std::vector<Int>& charges,
181 const std::vector<double>& rts,
182 std::vector<double> rt_ranges,
183 const std::vector<double>& iso_distrib,
184 const std::vector<double>& ion_mobilities = {});
185
188
190
192 double calculateMZ_(double mass, Int charge) const;
193
194 void generateTransitions_(const String& target_id, double mz, Int charge,
195 const IsotopeDistribution& iso_dist);
196
198
199 void ensureConvexHulls_(Feature& feature) const;
200
202
205 void runSingleGroup_(const std::vector<FeatureFinderMetaboIdentCompound>& metaboIdentTable,
206 FeatureMap& features,
207 const String& spectra_file);
208
209 double rt_window_;
210 double mz_window_;
212 double im_window_;
213
216
220
222
223 // output file (before filtering)
225
227
228 void updateMembers_() override;
229
232
234
236
238
240 std::map<String, double> isotope_probs_;
241 std::map<String, double> target_rts_;
242
243 size_t n_shared_ = 0;
244};
245
246} // namespace OpenMS
Isotope pattern generator for coarse isotope distributions.
Definition CoarseIsotopePatternGenerator.h:79
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Definition FeatureFinderAlgorithmMetaboIdent.h:29
static String prettyPrintCompound(const TargetedExperiment::Compound &compound)
const TargetedExperiment & getLibrary() const
Retrieve the assay library (e.g., to store as TraML, empty if run was not executed)
Definition FeatureFinderAlgorithmMetaboIdent.h:125
FeatureFinderAlgorithmPickedHelperStructs::MassTraces MassTraces
Definition FeatureFinderAlgorithmMetaboIdent.h:147
TransformationDescription trafo_
Definition FeatureFinderAlgorithmMetaboIdent.h:237
void runSingleGroup_(const std::vector< FeatureFinderMetaboIdentCompound > &metaboIdentTable, FeatureMap &features, const String &spectra_file)
double rt_window_
RT window width.
Definition FeatureFinderAlgorithmMetaboIdent.h:209
const TransformationDescription & getTransformations() const
Retrieve deviations between provided coordinates and extracted ones (e.g., to store as TrafoXML or fo...
Definition FeatureFinderAlgorithmMetaboIdent.h:128
void run(const std::vector< FeatureFinderMetaboIdentCompound > &metaboIdentTable, FeatureMap &features, const String &spectra_file="")
perform targeted feature extraction of compounds from metaboIdentTable and stores them in features....
String elution_model_
Definition FeatureFinderAlgorithmMetaboIdent.h:221
double calculateMZ_(double mass, Int charge) const
Calculate mass-to-charge ratio from mass and charge.
MRMFeatureFinderScoring feat_finder_
OpenSWATH feature finder.
Definition FeatureFinderAlgorithmMetaboIdent.h:233
void annotateFeatures_(FeatureMap &features)
double signal_to_noise_
Definition FeatureFinderAlgorithmMetaboIdent.h:219
void addTargetToLibrary_(const String &name, const String &formula, double mass, const std::vector< Int > &charges, const std::vector< double > &rts, std::vector< double > rt_ranges, const std::vector< double > &iso_distrib, const std::vector< double > &ion_mobilities={})
Add a target (from the input file) to the assay library.
TargetedExperiment library_
accumulated assays for targets
Definition FeatureFinderAlgorithmMetaboIdent.h:235
void addTargetRT_(TargetedExperiment::Compound &target, double rt)
double min_peak_width_
Definition FeatureFinderAlgorithmMetaboIdent.h:218
const PeakMap & getMSData() const
Definition FeatureFinderAlgorithmMetaboIdent.h:113
double mz_max
Definition FeatureFinderAlgorithmMetaboIdent.h:140
Size addTargetAnnotations_(FeatureMap &features)
Add "peptide" identifications with information about targets to features.
CoarseIsotopePatternGenerator iso_gen_
isotope pattern generator
Definition FeatureFinderAlgorithmMetaboIdent.h:239
void selectFeaturesFromCandidates_(FeatureMap &features)
PeakMap ms_data_
input LC-MS data
Definition FeatureFinderAlgorithmMetaboIdent.h:230
const PeakMap & getChromatograms() const
Retrieve chromatograms (empty if run was not executed)
Definition FeatureFinderAlgorithmMetaboIdent.h:121
double mz_window_
m/z window width
Definition FeatureFinderAlgorithmMetaboIdent.h:210
std::map< String, double > isotope_probs_
isotope probabilities of transitions
Definition FeatureFinderAlgorithmMetaboIdent.h:240
double peak_width_
Definition FeatureFinderAlgorithmMetaboIdent.h:217
FeatureFinderAlgorithmPickedHelperStructs::MassTrace MassTrace
Definition FeatureFinderAlgorithmMetaboIdent.h:146
PeakMap & getMSData()
Retrieve chromatograms (empty if run was not executed)
Definition FeatureFinderAlgorithmMetaboIdent.h:112
Size n_isotopes_
number of isotopes for peptide assay
Definition FeatureFinderAlgorithmMetaboIdent.h:215
void generateTransitions_(const String &target_id, double mz, Int charge, const IsotopeDistribution &iso_dist)
double im_window_
Ion mobility window width (0 = disabled)
Definition FeatureFinderAlgorithmMetaboIdent.h:212
size_t getNShared() const
Retrieve number of features with shared identifications.
Definition FeatureFinderAlgorithmMetaboIdent.h:131
Size debug_level_
Definition FeatureFinderAlgorithmMetaboIdent.h:226
std::map< UInt64, std::vector< MassTraceBounds > > FeatureBoundsMap
Boundaries for all mass traces per feature.
Definition FeatureFinderAlgorithmMetaboIdent.h:144
bool mz_window_ppm_
m/z window width is given in PPM (not Da)?
Definition FeatureFinderAlgorithmMetaboIdent.h:211
std::vector< Feature * > FeatureGroup
group of (overlapping) features
Definition FeatureFinderAlgorithmMetaboIdent.h:149
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
void extractTransformations_(const FeatureMap &features)
void setMSData(const PeakMap &m)
Set spectra.
PeakMap chrom_data_
accumulated chromatograms (XICs)
Definition FeatureFinderAlgorithmMetaboIdent.h:231
FeatureFinderAlgorithmMetaboIdent()
default constructor
void ensureConvexHulls_(Feature &feature) const
Size sub_index
Definition FeatureFinderAlgorithmMetaboIdent.h:139
PeakMap & getChromatograms()
Definition FeatureFinderAlgorithmMetaboIdent.h:122
String candidates_out_
Definition FeatureFinderAlgorithmMetaboIdent.h:224
std::map< String, double > target_rts_
RTs of targets (assays)
Definition FeatureFinderAlgorithmMetaboIdent.h:241
double isotope_pmin_
min. isotope probability for peptide assay
Definition FeatureFinderAlgorithmMetaboIdent.h:214
Boundaries for a mass trace in a feature.
Definition FeatureFinderAlgorithmMetaboIdent.h:138
A container for features.
Definition FeatureMap.h:82
An LC-MS feature.
Definition Feature.h:46
Definition IsotopeDistribution.h:40
The MRMFeatureFinder finds and scores peaks of transitions that co-elute.
Definition MRMFeatureFinderScoring.h:67
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
bool metaValueExists(const String &name) const
Returns whether an entry with the given name exists.
const DataValue & getMetaValue(const String &name) const
Returns the value corresponding to a string, or DataValue::EMPTY if not found.
CoordinateType getRT() const
Returns the RT coordinate (index 0)
Definition Peak2D.h:185
A more convenient string class.
Definition String.h:34
Represents a compound (small molecule)
Definition TargetedExperimentHelper.h:298
A description of a targeted experiment containing precursor and production ions.
Definition TargetedExperiment.h:39
Generic description of a coordinate transformation.
Definition TransformationDescription.h:37
int Int
Signed integer type.
Definition Types.h:72
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
Comparison functor for features.
Definition FeatureFinderAlgorithmMetaboIdent.h:162
bool operator()(const Feature &f1, const Feature &f2)
Definition FeatureFinderAlgorithmMetaboIdent.h:163
Predicate for filtering features by overall quality.
Definition FeatureFinderAlgorithmMetaboIdent.h:153
bool operator()(const Feature &feature)
Definition FeatureFinderAlgorithmMetaboIdent.h:154
represents a compound in the assay library
Definition FeatureFinderAlgorithmMetaboIdent.h:33
std::vector< double > rts_
Definition FeatureFinderAlgorithmMetaboIdent.h:58
const std::vector< double > & getIsotopeDistribution() const
Definition FeatureFinderAlgorithmMetaboIdent.h:88
const String & getFormula() const
Definition FeatureFinderAlgorithmMetaboIdent.h:68
double mass_
Definition FeatureFinderAlgorithmMetaboIdent.h:56
std::vector< int > charges_
Definition FeatureFinderAlgorithmMetaboIdent.h:57
String name_
Definition FeatureFinderAlgorithmMetaboIdent.h:54
String formula_
Definition FeatureFinderAlgorithmMetaboIdent.h:55
const std::vector< double > getRTRanges() const
Definition FeatureFinderAlgorithmMetaboIdent.h:84
const std::vector< double > & getRTs() const
Definition FeatureFinderAlgorithmMetaboIdent.h:80
const std::vector< double > & getIonMobilities() const
Definition FeatureFinderAlgorithmMetaboIdent.h:92
std::vector< double > ion_mobilities_
Expected ion mobility values (optional)
Definition FeatureFinderAlgorithmMetaboIdent.h:61
std::vector< double > iso_distrib_
Definition FeatureFinderAlgorithmMetaboIdent.h:60
const String & getName() const
Definition FeatureFinderAlgorithmMetaboIdent.h:64
std::vector< double > rt_ranges_
Definition FeatureFinderAlgorithmMetaboIdent.h:59
const std::vector< int > & getCharges() const
Definition FeatureFinderAlgorithmMetaboIdent.h:76
FeatureFinderMetaboIdentCompound(const String &_name, const String &_formula, double _mass, const std::vector< int > &_charges, const std::vector< double > &_rts, const std::vector< double > &_rt_ranges, const std::vector< double > &_iso_distrib, const std::vector< double > &_ion_mobilities={})
Definition FeatureFinderAlgorithmMetaboIdent.h:34
double getMass() const
Definition FeatureFinderAlgorithmMetaboIdent.h:72
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition FeatureFinderAlgorithmPickedHelperStructs.h:54
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition FeatureFinderAlgorithmPickedHelperStructs.h:85