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

Method writeTopFD

src/openms/source/FORMAT/FLASHDeconvSpectrumFile.cpp:301–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299 }
300
301 void FLASHDeconvSpectrumFile::writeTopFD(DeconvolvedSpectrum& dspec, std::fstream& fs, const double snr_threshold, const uint min_ms_level, const bool randomize_precursor_mass,
302 const bool randomize_fragment_mass)
303 {
304 UInt ms_level = dspec.getOriginalSpectrum().getMSLevel();
305 if (ms_level > min_ms_level)
306 {
307 if (dspec.getPrecursorPeakGroup().empty() || dspec.getPrecursorPeakGroup().getChargeSNR(dspec.getPrecursor().getCharge()) < snr_threshold)
308 {
309 return;
310 }
311 }
312
313 if (dspec.size() < topFD_min_peak_count_)
314 {
315 return;
316 }
317
318 fs << std::fixed << std::setprecision(2);
319 fs << "BEGIN IONS\n"
320 << "ID=" << dspec.getScanNumber() << "\n"
321 << "FRACTION_ID=" << 0 << "\n"
322 << "SCANS=" << dspec.getScanNumber() << "\n"
323 << "RETENTION_TIME=" << dspec.getOriginalSpectrum().getRT() << "\n"
324 << "LEVEL=" << dspec.getOriginalSpectrum().getMSLevel() << "\n";
325
326
327 if (ms_level > 1)
328 {
329 double precursor_mass = dspec.getPrecursorPeakGroup().getMonoMass();
330 if (dspec.getActivationMethod() < Precursor::ActivationMethod::SIZE_OF_ACTIVATIONMETHOD)
331 {
332 fs << "ACTIVATION=" << Precursor::NamesOfActivationMethodShort[dspec.getActivationMethod()] << "\n";
333 }
334 fs << "MS_ONE_ID=" << dspec.getPrecursorScanNumber() << "\n"
335 << "MS_ONE_SCAN=" << dspec.getPrecursorScanNumber() << "\n"
336 << "PRECURSOR_MZ=" << std::to_string(dspec.getPrecursor().getMZ()) << "\n"
337 << "PRECURSOR_CHARGE=" << (int)(dspec.getPrecursor().getCharge()) << "\n"
338 << "PRECURSOR_MASS=" << std::to_string(precursor_mass + (randomize_precursor_mass ? (((double)rand() / (RAND_MAX)) * 200.0 - 100.0) : .0)) << "\n" // random number between 0 to 100.
339 << "PRECURSOR_INTENSITY=" << dspec.getPrecursor().getIntensity() << "\n";
340 }
341
342 fs << std::setprecision(-1);
343
344 double qscore_threshold = 0;
345 std::vector<double> qscores;
346
347 if (dspec.size() > topFD_max_peak_count_) // max peak count for TopPic = 500
348 {
349 qscores.reserve(dspec.size());
350 for (auto& pg : dspec)
351 {
352 qscores.push_back(pg.getQscore());
353 }
354 std::sort(qscores.begin(), qscores.end());
355 qscore_threshold = qscores[qscores.size() - topFD_max_peak_count_];
356 std::vector<double>().swap(qscores);
357 }
358

Callers

nothing calls this directly

Calls 15

sortFunction · 0.85
getMSLevelMethod · 0.80
getChargeSNRMethod · 0.80
isPositiveMethod · 0.80
getAbsChargeRangeMethod · 0.80
emptyMethod · 0.45
getChargeMethod · 0.45
sizeMethod · 0.45
getScanNumberMethod · 0.45
getRTMethod · 0.45
getMonoMassMethod · 0.45

Tested by

no test coverage detected