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

Method exportFeatureMapToMzTabM

src/openms/source/FORMAT/MzTabM.cpp:143–707  ·  view source on GitHub ↗

FeatureMap with associated identification data

Source from the content-addressed store, hash-verified

141
142 // FeatureMap with associated identification data
143 MzTabM MzTabM::exportFeatureMapToMzTabM(const FeatureMap& feature_map)
144 {
145 MzTabM mztabm;
146 MzTabMMetaData m_meta_data;
147
148 // extract identification data from FeatureMap
149 const IdentificationData& id_data = feature_map.getIdentificationData();
150
151 OPENMS_PRECONDITION(!id_data.empty(),
152 "The FeatureMap has to have a non empty IdentificationData object attached!")
153
154 // extract MetaValues from FeatureMap
155 std::set<String> feature_user_value_keys;
156 std::set<String> observationmatch_user_value_keys;
157 std::set<String> compound_user_value_keys;
158 MzTabM::getFeatureMapMetaValues_(feature_map, feature_user_value_keys, observationmatch_user_value_keys, compound_user_value_keys);
159
160 // ####################################################
161 // MzTabMetaData
162 // ####################################################
163
164 std::regex reg_backslash{R"(\\)"};
165 UInt64 local_id = feature_map.getUniqueId();
166 // mz_tab_id (mandatory)
167 m_meta_data.mz_tab_id.set("local_id: " + String(local_id));
168
169 // title (not mandatory)
170 // description (not mandatory)
171 // sample_processing (not mandatory)
172 // instrument-name (not mandatory)
173 // instrument-source (not mandatory)
174 // instrument-analyzer (not mandatory)
175 // instrument-detector (not mandatory)
176 // meta_software.setting[0] (not mandatory)
177
178 MzTabSoftwareMetaData meta_software;
179 ControlledVocabulary cv;
180 MzTabString reliability = MzTabString("2"); // initialize at 2 (should be valid for all tools - putatively annotated compound)
181 cv.loadFromOBO("PSI-MS", File::find("/CV/psi-ms.obo"));
182 for (const auto& software : id_data.getProcessingSoftwares())
183 {
184 if (software.metaValueExists("reliability"))
185 {
186 reliability = MzTabString(std::string(software.getMetaValue("reliability")));
187 }
188 MzTabParameter p_software;
189 ControlledVocabulary::CVTerm cvterm;
190 // add TOPP - all OpenMS Tools have TOPP attached in the PSI-OBO
191 std::string topp_tool = "TOPP " + software.getName();
192 if (cv.hasTermWithName(topp_tool)) // asses CV-term based on tool name
193 {
194 cvterm = cv.getTermByName(topp_tool);
195 }
196 else
197 {
198 // use "analysis software" instead
199 OPENMS_LOG_WARN << "The tool: " << topp_tool << " is currently not registered in the PSI-OBO.\n";
200 OPENMS_LOG_WARN << "'The general term 'analysis software' will be used instead.\n";

Callers 1

START_SECTIONFunction · 0.80

Calls 15

stringClass · 0.85
concatenateFunction · 0.85
getUniqueIdMethod · 0.80
loadFromOBOMethod · 0.80
metaValueExistsMethod · 0.80
getMetaValueMethod · 0.80
hasTermWithNameMethod · 0.80
emplace_backMethod · 0.80
atMethod · 0.80
prefixMethod · 0.80
setMSFileMethod · 0.80

Tested by 1

START_SECTIONFunction · 0.64