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

Method store

src/openms/source/FORMAT/PepXMLFile.cpp:350–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348 PepXMLFile::~PepXMLFile() = default;
349
350 void PepXMLFile::store(const String& filename, std::vector<ProteinIdentification>& protein_ids, std::vector<PeptideIdentification>& peptide_ids, const String& mz_file, const String& mz_name, bool peptideprophet_analyzed, double rt_tolerance)
351 {
352 ofstream f(filename.c_str());
353 if (!f)
354 {
355 throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename);
356 }
357
358 String search_engine_name;
359 ProteinIdentification::SearchParameters search_params;
360 if (!protein_ids.empty())
361 {
362 if (protein_ids.size() > 1)
363 {
364 warning(STORE, "More than one protein identification defined; only first search parameters are written into pepXML; search engine must be the same.");
365 }
366 search_params = protein_ids.begin()->getSearchParameters();
367 if (protein_ids.begin()->getSearchEngine() == "XTandem")
368 {
369 search_engine_name = "X! Tandem";
370 }
371 else if (protein_ids.begin()->getSearchEngine() == "Mascot")
372 {
373 search_engine_name = "MASCOT";
374 }
375 else
376 {
377 search_engine_name = protein_ids.begin()->getSearchEngine();
378 //Comet writes "Comet" in pep.xml, so this is ok
379 }
380 }
381
382 f.precision(writtenDigits<double>(0.0));
383 String raw_data;
384 String base_name;
385 SpectrumMetaDataLookup lookup;
386 lookup.rt_tolerance = rt_tolerance;
387
388 // The mz-File (if given)
389 if (!mz_file.empty())
390 {
391 base_name = FileHandler::stripExtension(File::basename(mz_file));
392 raw_data = FileTypes::typeToName(FileHandler::getTypeByFileName(mz_file));
393
394 PeakMap experiment;
395 FileHandler fh;
396 fh.loadExperiment(mz_file, experiment, FileTypes::UNKNOWN, ProgressLogger::NONE, false, false);
397 lookup.readSpectra(experiment.getSpectra());
398 }
399 else
400 {
401 base_name = FileHandler::stripExtension(File::basename(filename));
402 raw_data = "mzML";
403 }
404 // mz_name is input from IDFileConverter for 'base_name' attribute, only necessary if different from 'mz_file'.
405 if (!mz_name.empty())
406 {
407 base_name = mz_name;

Callers

nothing calls this directly

Calls 15

getInstanceFunction · 0.85
precisionWrapperFunction · 0.85
precisionMethod · 0.80
loadExperimentMethod · 0.80
readSpectraMethod · 0.80
hasSubstringMethod · 0.80
toLowerMethod · 0.80
getSequenceMethod · 0.80

Tested by

no test coverage detected