MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / findFeatures

Method findFeatures

src/openms/source/ANALYSIS/TOPDOWN/MassFeatureTrace.cpp:36–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 std::vector<FLASHDeconvHelperStructs::MassFeature> MassFeatureTrace::findFeatures(const PrecalculatedAveragine& averagine)
37 {
38 MSExperiment map;
39 std::map<int, MSSpectrum> index_spec_map;
40 int min_abs_charge = INT_MAX;
41 int max_abs_charge = INT_MIN;
42 bool is_positive = true;
43 std::vector<FLASHDeconvHelperStructs::MassFeature> mass_features;
44 for (auto& item : peak_group_map_)
45 {
46 double rt = item.first;
47 MSSpectrum deconv_spec;
48 deconv_spec.setRT(rt);
49 for (auto& pg : item.second)
50 {
51 is_positive = pg.second.isPositive();
52 auto [z1, z2] = pg.second.getAbsChargeRange();
53 max_abs_charge = max_abs_charge > z2 ? max_abs_charge : z2;
54 min_abs_charge = min_abs_charge < z1 ? min_abs_charge : z1;
55
56 Peak1D tp(pg.first, (float)pg.second.getIntensity());
57 deconv_spec.push_back(tp);
58 }
59 map.addSpectrum(deconv_spec);
60 }
61
62 // when map size is less than 3, MassTraceDetection aborts - too few spectra for mass tracing.
63 if (map.size() < 3)
64 {
65 return mass_features;
66 }
67
68 MassTraceDetection mtdet;
69 Param mtd_param = getParameters().copy("");
70 mtd_param.remove("min_isotope_cosine");
71
72 mtdet.setParameters(mtd_param);
73 std::vector<MassTrace> m_traces;
74
75 mtdet.run(map, m_traces); // m_traces : output of this function
76 int charge_range = max_abs_charge - min_abs_charge + 1;
77
78 for (auto& mt : m_traces)
79 {
80 double max_qscore = .0;
81 int min_feature_abs_charge = INT_MAX; // min feature charge
82 int max_feature_abs_charge = INT_MIN; // max feature charge
83
84 auto per_isotope_intensity = std::vector<float>(averagine.getMaxIsotopeIndex(), .0f);
85 auto per_charge_intensity = std::vector<float>(charge_range + min_abs_charge + 1, .0f);
86
87 double mass = mt.getCentroidMZ();
88 double max_iso = 0;
89 int max_iso_off = 0;
90 boost::dynamic_bitset<> charges(charge_range + 1);
91 std::vector<PeakGroup> pgs;
92 pgs.reserve(mt.getSize());
93

Callers 2

main_Method · 0.80

Calls 15

isPositiveMethod · 0.80
getAbsChargeRangeMethod · 0.80
addSpectrumMethod · 0.80
setParametersMethod · 0.80
getMaxIsotopeIndexMethod · 0.80
getCentroidMZMethod · 0.80
getIsotopeCosineMethod · 0.80
getChargeIntensityMethod · 0.80
getIsotopeDaDistanceMethod · 0.80
getAverageMassDeltaMethod · 0.80
countMethod · 0.80
findMaxByIntPeakMethod · 0.80

Tested by

no test coverage detected