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

Method extractIsotopicIntensities

src/topp/MetaProSIP.cpp:2333–2380  ·  view source on GitHub ↗

collects intensities starting at seed_mz/_rt, if no peak is found at the expected position a 0 is added

Source from the content-addressed store, hash-verified

2331
2332 // collects intensities starting at seed_mz/_rt, if no peak is found at the expected position a 0 is added
2333 vector<double> extractIsotopicIntensities(Size element_count, double mass_diff, double mz_tolerance_ppm,
2334 double seed_rt, double seed_mz, double seed_charge,
2335 const PeakMap& peak_map)
2336 {
2337 vector<double> isotopic_intensities;
2338 for (Size k = 0; k != element_count; ++k)
2339 {
2340 double min_rt = seed_rt - 0.01; // feature rt
2341 double max_rt = seed_rt + 0.01;
2342 double mz = seed_mz + k * mass_diff / seed_charge;
2343
2344 double min_mz;
2345 double max_mz;
2346
2347 if (k <= 5)
2348 {
2349 double ppm = std::max(10.0, mz_tolerance_ppm); // restrict ppm to 10 for low intensity peaks
2350 min_mz = mz - mz * ppm * 1e-6;
2351 max_mz = mz + mz * ppm * 1e-6;
2352 }
2353 else
2354 {
2355 min_mz = mz - mz * mz_tolerance_ppm * 1e-6;
2356 max_mz = mz + mz * mz_tolerance_ppm * 1e-6;
2357 }
2358
2359 double found_peak_int = 0;
2360
2361 PeakMap::ConstAreaIterator aait = peak_map.areaBeginConst(min_rt, max_rt, min_mz, max_mz);
2362
2363 // find 13C/15N peak in window around theoretical predicted position
2364 vector<double> found_peaks;
2365 for (; aait != peak_map.areaEndConst(); ++aait)
2366 {
2367 double peak_int = aait->getIntensity();
2368 if (peak_int > 1) // we found a valid 13C/15N peak
2369 {
2370 found_peaks.push_back(peak_int);
2371 }
2372 }
2373
2374 found_peak_int = std::accumulate(found_peaks.begin(), found_peaks.end(), 0.0);
2375
2376 // assign peak intensity to first peak in small area around theoretical predicted position (should be usually only be 1)
2377 isotopic_intensities.push_back(found_peak_int);
2378 }
2379 return isotopic_intensities;
2380 }
2381
2382 void writePeakIntensities_(SVOutStream& out_stream, vector<double> isotopic_intensities, bool write_13Cpeaks)
2383 {

Callers

nothing calls this directly

Calls 6

areaBeginConstMethod · 0.80
areaEndConstMethod · 0.80
getIntensityMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected