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

Method writeTo

src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp:69–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 }
68
69 void FeatureXMLHandler::writeTo(std::ostream& os)
70 {
71 const FeatureMap& feature_map = *(cmap_);
72
73 os << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
74 << "<featureMap version=\"" << version_ << "\"";
75 // file id
76 if (!feature_map.getIdentifier().empty())
77 {
78 os << " document_id=\"" << feature_map.getIdentifier() << "\"";
79 }
80 // unique id
81 if (feature_map.hasValidUniqueId())
82 {
83 os << " id=\"fm_" << feature_map.getUniqueId() << "\"";
84 }
85 os << " xsi:noNamespaceSchemaLocation=\"https://raw.githubusercontent.com/OpenMS/OpenMS/develop/share/OpenMS/SCHEMAS/FeatureXML_1_9.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n";
86
87 // user param
88 writeUserParam_("UserParam", os, feature_map, 1);
89
90 // write data processing
91 for (Size i = 0; i < feature_map.getDataProcessing().size(); ++i)
92 {
93 const DataProcessing& processing = feature_map.getDataProcessing()[i];
94 os << "\t<dataProcessing completion_time=\"" << processing.getCompletionTime().getDate() << 'T' << processing.getCompletionTime().getTime() << "\">\n";
95 os << "\t\t<software name=\"" << processing.getSoftware().getName() << "\" version=\"" << processing.getSoftware().getVersion() << "\" />\n";
96 for (set<DataProcessing::ProcessingAction>::const_iterator it = processing.getProcessingActions().begin(); it != processing.getProcessingActions().end(); ++it)
97 {
98 os << "\t\t<processingAction name=\"" << DataProcessing::NamesOfProcessingAction[*it] << "\" />\n";
99 }
100 writeUserParam_("UserParam", os, processing, 2);
101 os << "\t</dataProcessing>\n";
102 }
103
104 // throws if protIDs are not unique, i.e. PeptideIDs will be randomly assigned (bad!)
105 checkUniqueIdentifiers_(feature_map.getProteinIdentifications());
106
107 // write identification runs
108 Size prot_count = 0;
109 for (Size i = 0; i < feature_map.getProteinIdentifications().size(); ++i)
110 {
111 const ProteinIdentification& current_prot_id = feature_map.getProteinIdentifications()[i];
112 os << "\t<IdentificationRun ";
113 os << "id=\"PI_" << i << "\" ";
114 identifier_id_[current_prot_id.getIdentifier()] = String("PI_") + i;
115 os << "date=\"" << current_prot_id.getDateTime().getDate() << "T" << current_prot_id.getDateTime().getTime() << "\" ";
116 os << "search_engine=\"" << writeXMLEscape(current_prot_id.getSearchEngine()) << "\" ";
117 os << "search_engine_version=\"" << writeXMLEscape(current_prot_id.getSearchEngineVersion()) << "\">\n";
118
119 //write search parameters
120 const ProteinIdentification::SearchParameters& search_param = current_prot_id.getSearchParameters();
121 os << "\t\t<SearchParameters "
122 << "db=\"" << writeXMLEscape(search_param.db) << "\" "
123 << "db_version=\"" << writeXMLEscape(search_param.db_version) << "\" "
124 << "taxonomy=\"" << writeXMLEscape(search_param.taxonomy) << "\" ";
125 if (search_param.mass_type == ProteinIdentification::MONOISOTOPIC)
126 {

Callers

nothing calls this directly

Calls 15

getUniqueIdMethod · 0.80
getDateMethod · 0.80
toLowerMethod · 0.80
getScoreTypeMethod · 0.80
getAccessionMethod · 0.80
getCoverageMethod · 0.80
getSequenceMethod · 0.80
StringClass · 0.50
writeXMLEscapeFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
getDataProcessingMethod · 0.45

Tested by

no test coverage detected