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

Method mergePepXMLProtXML_

src/topp/IDMerger.cpp:73–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72protected:
73 void mergePepXMLProtXML_(StringList filenames, vector<ProteinIdentification>&
74 proteins, vector<PeptideIdentification>& peptides)
75 {
76 IdXMLFile idxml;
77 idxml.load(filenames[0], proteins, peptides);
78 vector<ProteinIdentification> pepxml_proteins, protxml_proteins;
79 vector<PeptideIdentification> pepxml_peptides, protxml_peptides;
80
81 if (proteins[0].getProteinGroups().empty()) // first idXML contains data from the pepXML
82 {
83 proteins.swap(pepxml_proteins);
84 peptides.swap(pepxml_peptides);
85 idxml.load(filenames[1], protxml_proteins, protxml_peptides);
86 if (protxml_proteins[0].getProteinGroups().empty())
87 {
88 throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "None of the input files seems to be derived from a protXML file (information about protein groups is missing).");
89 }
90 }
91 else // first idXML contains data from the protXML
92 {
93 proteins.swap(protxml_proteins);
94 peptides.swap(protxml_peptides);
95 idxml.load(filenames[1], pepxml_proteins, pepxml_peptides);
96 }
97
98 if ((protxml_peptides.size() > 1) || (protxml_proteins.size() > 1))
99 {
100 throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "The idXML derived from a protXML file should contain only one 'ProteinIdentification' and one 'PeptideIdentification' instance.");
101 }
102
103 // peptide information comes from the pepXML (additional information in
104 // the protXML - adapted peptide hit score, "is_unique", "is_contributing"
105 // - is not transferred):
106 peptides.swap(pepxml_peptides);
107
108 // prepare scores and coverage values of protein hits from the protXML:
109 map<String, pair<double, double> > hit_values;
110 ProteinIdentification& protein = protxml_proteins[0];
111 for (ProteinHit & hit : protein.getHits())
112 {
113 hit_values[hit.getAccession()] = make_pair(hit.getScore(), hit.getCoverage());
114 }
115
116 // merge protein information:
117 proteins.swap(pepxml_proteins);
118 for (ProteinIdentification & prot : proteins)
119 {
120 prot.getProteinGroups() = protein.getProteinGroups();
121 prot.getIndistinguishableProteins() =
122 protein.getIndistinguishableProteins();
123 // TODO: since a protXML file can integrate data from several protein
124 // identification runs, the protein groups/indistinguishable proteins
125 // that we write to one identification run could contain references to
126 // proteins that are not observed in this run, but in others; also, some
127 // protein hits without enough evidence may not occur in the protXML
128 // (thus also not in the protein groups) - clean this up?
129
130 prot.setScoreType(protein.getScoreType());

Callers

nothing calls this directly

Calls 15

getAccessionMethod · 0.80
getCoverageMethod · 0.80
getScoreTypeMethod · 0.80
setCoverageMethod · 0.80
loadMethod · 0.45
emptyMethod · 0.45
swapMethod · 0.45
sizeMethod · 0.45
getScoreMethod · 0.45
setScoreTypeMethod · 0.45
setHigherScoreBetterMethod · 0.45
isHigherScoreBetterMethod · 0.45

Tested by

no test coverage detected