| 599 | } |
| 600 | |
| 601 | void ConsensusXMLHandler::writeTo(std::ostream& os) |
| 602 | { |
| 603 | const ConsensusMap& consensus_map = *(cconsensus_map_); |
| 604 | |
| 605 | startProgress(0, 0, "storing consensusXML file"); |
| 606 | progress_ = 0; |
| 607 | setProgress(++progress_); |
| 608 | |
| 609 | setProgress(++progress_); |
| 610 | os << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; |
| 611 | os << "<?xml-stylesheet type=\"text/xsl\" href=\"https://www.openms.de/xml-stylesheet/ConsensusXML.xsl\" ?>\n"; |
| 612 | |
| 613 | setProgress(++progress_); |
| 614 | os << "<consensusXML version=\"" << version_ << "\""; |
| 615 | // file id |
| 616 | if (!consensus_map.getIdentifier().empty()) |
| 617 | { |
| 618 | os << " document_id=\"" << consensus_map.getIdentifier() << "\""; |
| 619 | } |
| 620 | // unique id |
| 621 | if (consensus_map.hasValidUniqueId()) |
| 622 | { |
| 623 | os << " id=\"cm_" << consensus_map.getUniqueId() << "\""; |
| 624 | } |
| 625 | if (!consensus_map.getExperimentType().empty()) |
| 626 | { |
| 627 | os << " experiment_type=\"" << consensus_map.getExperimentType() << "\""; |
| 628 | } |
| 629 | os |
| 630 | << " xsi:noNamespaceSchemaLocation=\"https://raw.githubusercontent.com/OpenMS/OpenMS/develop/share/OpenMS/SCHEMAS/ConsensusXML_1_7.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; |
| 631 | |
| 632 | // user param |
| 633 | writeUserParam_("UserParam", os, consensus_map, 1); |
| 634 | setProgress(++progress_); |
| 635 | |
| 636 | // write data processing |
| 637 | for (Size i = 0; i < consensus_map.getDataProcessing().size(); ++i) |
| 638 | { |
| 639 | const DataProcessing& processing = consensus_map.getDataProcessing()[i]; |
| 640 | os << "\t<dataProcessing completion_time=\"" << processing.getCompletionTime().getDate() << 'T' << processing.getCompletionTime().getTime() << "\">\n"; |
| 641 | os << "\t\t<software name=\"" << processing.getSoftware().getName() << "\" version=\"" << processing.getSoftware().getVersion() << "\" />\n"; |
| 642 | for (set<DataProcessing::ProcessingAction>::const_iterator it = processing.getProcessingActions().begin(); it != processing.getProcessingActions().end(); ++it) |
| 643 | { |
| 644 | os << "\t\t<processingAction name=\"" << DataProcessing::NamesOfProcessingAction[*it] << "\" />\n"; |
| 645 | } |
| 646 | writeUserParam_("UserParam", os, processing, 2); |
| 647 | os << "\t</dataProcessing>\n"; |
| 648 | } |
| 649 | setProgress(++progress_); |
| 650 | |
| 651 | // write identification run |
| 652 | UInt prot_count = 0; |
| 653 | |
| 654 | // throws if protIDs are not unique, i.e. PeptideIDs will be randomly assigned (bad!) |
| 655 | checkUniqueIdentifiers_(consensus_map.getProteinIdentifications()); |
| 656 | |
| 657 | for (UInt i = 0; i < consensus_map.getProteinIdentifications().size(); ++i) |
| 658 | { |
nothing calls this directly
no test coverage detected