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

Method writeTopFDFeatures

src/openms/source/FORMAT/FLASHDeconvFeatureFile.cpp:103–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 }
102
103 void FLASHDeconvFeatureFile::writeTopFDFeatures(const std::vector<FLASHDeconvHelperStructs::MassFeature>& mass_features, const std::map<int, PeakGroup>& precursor_peak_groups,
104 const std::map<int, double>& scan_rt_map, const String& file_name, std::vector<std::fstream>& fs)
105 {
106 int topid = 1;
107 std::unordered_map<int, int> mtid_topid;
108
109 for (Size l = 0; l < mass_features.size(); l++)
110 {
111 auto mass_feature = mass_features[l];
112 double sum_intensity = .0;
113 for (auto& m : mass_feature.mt)
114 {
115 sum_intensity += m.getIntensity();
116 }
117 for (Size i = 0; i < fs.size(); i++)
118 {
119 if (i == 0)
120 {
121 fs[i] << "0\t" << topid << "\t" << mass_feature.mt.getCentroidMZ() << "\t" << sum_intensity << "\t" << mass_feature.mt.begin()->getRT() << "\t" << mass_feature.mt.rbegin()->getRT() << "\t"
122 << mass_feature.mt[mass_feature.mt.findMaxByIntPeak()].getRT() << "\t" << mass_feature.min_charge << "\t" << mass_feature.max_charge << "\t0\t0\n";
123 mtid_topid[(int)l] = topid;
124 }
125 }
126 topid++;
127 }
128
129 for (auto& precursor : precursor_peak_groups)
130 {
131 int ms1_scan_number = precursor.second.getScanNumber();
132 int ms2_scan_number = precursor.first;
133 double rt = scan_rt_map.at(ms2_scan_number);
134 bool selected = false;
135 int selected_index = -1;
136 for (Size l = 0; l < mass_features.size(); l++)
137 {
138 auto mass_feature = mass_features[l];
139 auto mt = mass_feature.mt;
140 if (abs(precursor.second.getMonoMass() - mt.getCentroidMZ()) > 1.5)
141 {
142 continue;
143 }
144 if (rt < mt.begin()->getRT() || rt > mt.rbegin()->getRT())
145 {
146 continue;
147 }
148 selected = true;
149 selected_index = (int)l;
150 break;
151 }
152
153 if (selected)
154 {
155 for (Size i = 1; i < fs.size(); i++)
156 {
157 double sum_intensity = .0;
158 for (auto& m : mass_features[selected_index].mt)
159 {
160 sum_intensity += m.getIntensity();

Callers

nothing calls this directly

Calls 12

getCentroidMZMethod · 0.80
findMaxByIntPeakMethod · 0.80
atMethod · 0.80
getAbsChargeRangeMethod · 0.80
isPositiveMethod · 0.80
sizeMethod · 0.45
getIntensityMethod · 0.45
getRTMethod · 0.45
beginMethod · 0.45
rbeginMethod · 0.45
getScanNumberMethod · 0.45
getMonoMassMethod · 0.45

Tested by

no test coverage detected