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

Method writeMzIdentMLFile

src/openms/source/FORMAT/HANDLERS/MzIdentMLDOMHandler.cpp:305–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303 }
304
305 void MzIdentMLDOMHandler::writeMzIdentMLFile(const std::string& mzid_file)
306 {
307 DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(CONST_XMLCH("XML 1.0")); //XML 3?!
308 if (impl != nullptr)
309 {
310 try
311 {
312 xercesc::DOMDocument* xmlDoc = impl->createDocument(
313 CONST_XMLCH("http://psidev.info/psi/pi/mzIdentML/1.1"),
314 CONST_XMLCH("MzIdentML"), // root element name
315 nullptr); // document type object (DTD).
316
317 DOMElement* rootElem = xmlDoc->getDocumentElement();
318 rootElem->setAttribute(CONST_XMLCH("version"),
319 StringManager::convertPtr(schema_version_).get());
320 rootElem->setAttribute(CONST_XMLCH("xsi:schemaLocation"),
321 CONST_XMLCH("http://psidev.info/psi/pi/mzIdentML/1.1 ../../schema/mzIdentML1.1.0.xsd"));
322 rootElem->setAttribute(CONST_XMLCH("creationDate"),
323 StringManager::convertPtr(String(DateTime::now().getDate() + "T" + DateTime::now().getTime())).get());
324
325 // * cvList *
326 DOMElement* cvl_p = xmlDoc->createElement(CONST_XMLCH("cvList")); // TODO add generically
327 buildCvList_(cvl_p);
328 rootElem->appendChild(cvl_p);
329
330 // * AnalysisSoftwareList *
331 DOMElement* asl_p = xmlDoc->createElement(CONST_XMLCH("AnalysisSoftwareList"));
332 for (vector<ProteinIdentification>::const_iterator pi = cpro_id_->begin(); pi != cpro_id_->end(); ++pi)
333 {
334// search_engine_version_ = pi->getSearchEngineVersion();
335// search_engine_ = pi->getSearchEngine();
336 }
337 buildAnalysisSoftwareList_(asl_p);
338 rootElem->appendChild(asl_p);
339
340// // * AnalysisSampleCollection *
341// DOMElement* asc_p = xmlDoc->createElement(CONST_XMLCH("AnalysisSampleCollection"));
342// buildAnalysisSampleCollection_(asc_p);
343// rootElem->appendChild(asc_p);
344
345 // * SequenceCollection *
346 DOMElement* sc_p = xmlDoc->createElement(CONST_XMLCH("SequenceCollection"));
347
348 for (vector<ProteinIdentification>::const_iterator pi = cpro_id_->begin(); pi != cpro_id_->end(); ++pi)
349 {
350 String dbref = pi->getSearchParameters().db + pi->getSearchParameters().db_version + pi->getSearchParameters().taxonomy; //TODO @mths : this needs to be more unique, btw add tax etc. as cv to DBSequence
351 for (vector<ProteinHit>::const_iterator ph = pi->getHits().begin(); ph != pi->getHits().end(); ++ph)
352 {
353 CVTermList cvs;
354 DBSequence temp_struct = {ph->getSequence(), dbref, ph->getAccession(), cvs};
355 db_sq_map_.insert(make_pair(ph->getAccession(), temp_struct));
356 }
357 }
358
359 set<AASequence> pepset;
360 for (vector<PeptideIdentification>::const_iterator pi = cpep_id_->begin(); pi != cpep_id_->end(); ++pi)
361 {
362 for (vector<PeptideHit>::const_iterator ph = pi->getHits().begin(); ph != pi->getHits().end(); ++ph)

Callers

nothing calls this directly

Calls 15

convertPtrFunction · 0.85
getUniqueIdFunction · 0.85
getDateMethod · 0.80
getSequenceMethod · 0.80
getAccessionMethod · 0.80
hasSubstringMethod · 0.80
getMetaValueMethod · 0.80
getStartMethod · 0.80
getEndMethod · 0.80
getAABeforeMethod · 0.80
getAAAfterMethod · 0.80
StringClass · 0.50

Tested by

no test coverage detected