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

Method writeTo

src/openms/source/FORMAT/HANDLERS/TraMLHandler.cpp:470–877  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468 }
469
470 void TraMLHandler::writeTo(std::ostream& os)
471 {
472 const TargetedExperiment& exp = *(cexp_);
473 logger_.startProgress(0, exp.getTransitions().size(), "storing TraML file");
474 // int progress = 0;
475
476 os << R"(<?xml version="1.0" encoding="UTF-8"?>)" << "\n";
477 os << R"(<TraML version="1.0.0" xmlns="http://psi.hupo.org/ms/traml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/traml TraML1.0.0.xsd">)" << "\n";
478
479 //--------------------------------------------------------------------------------------------
480 // CV list
481 //--------------------------------------------------------------------------------------------
482 os << " <cvList>" << "\n";
483
484 if (exp.getCVs().empty())
485 {
486 os << R"( <cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="unknown" URI="http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo"/>)" << "\n"
487 << R"( <cv id="UO" fullName="Unit Ontology" version="unknown" URI="http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo"/>)" << "\n";
488 }
489 else
490 {
491 for (std::vector<TargetedExperiment::CV>::const_iterator it = exp.getCVs().begin(); it != exp.getCVs().end(); ++it)
492 {
493 os << " <cv id=\"" << writeXMLEscape(it->id) << "\" fullName=\"" << writeXMLEscape(it->fullname) << "\" version=\"" << writeXMLEscape(it->version) << "\" URI=\"" << writeXMLEscape(it->URI) << "\"/>" << "\n";
494 }
495 }
496 os << " </cvList>" << "\n";
497
498 // source file list
499 if (!exp.getSourceFiles().empty())
500 {
501 os << " <SourceFileList>" << "\n";
502 for (std::vector<SourceFile>::const_iterator it = exp.getSourceFiles().begin(); it != exp.getSourceFiles().end(); ++it)
503 {
504 os << " <SourceFile id=\""
505 << writeXMLEscape(it->getNativeIDType()) << "\" name=\""
506 << writeXMLEscape(it->getNameOfFile()) << "\" location=\""
507 << writeXMLEscape(it->getPathToFile()) << "\">"
508 << "\n";
509 writeCVParams_(os, *it, 3);
510 writeUserParam_(os, (MetaInfoInterface) * it, 3);
511 os << " </SourceFile>" << "\n";
512 }
513 os << " </SourceFileList>" << "\n";
514 }
515
516 // contact list
517 if (!exp.getContacts().empty())
518 {
519 os << " <ContactList>" << "\n";
520 for (std::vector<TargetedExperiment::Contact>::const_iterator it = exp.getContacts().begin(); it != exp.getContacts().end(); ++it)
521 {
522 os << " <Contact id=\"" << writeXMLEscape(it->id) << "\">" << "\n";
523 writeCVParams_(os, *it, 3);
524 writeUserParam_(os, (MetaInfoInterface) * it, 3);
525 os << " </Contact>" << "\n";
526 }
527 os << " </ContactList>" << "\n";

Callers

nothing calls this directly

Calls 15

getInstanceFunction · 0.85
precisionWrapperFunction · 0.85
getChargeStateMethod · 0.80
getIdMethod · 0.80
getPeptideRefMethod · 0.80
getCompoundRefMethod · 0.80
hasPrecursorCVTermsMethod · 0.80
hasPredictionMethod · 0.80
writeXMLEscapeFunction · 0.50
StringClass · 0.50
startProgressMethod · 0.45

Tested by

no test coverage detected