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

Method main_

src/topp/IDExtractor.cpp:83–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82
83 ExitCodes main_(int, const char**) override
84 {
85 IdXMLFile idXML_file;
86 vector<ProteinIdentification> protein_identifications;
87 vector<ProteinIdentification> chosen_protein_identifications;
88 vector<PeptideIdentification> identifications;
89 vector<PeptideIdentification> chosen_identifications;
90 vector<Size> indices;
91 vector<PeptideHit> temp_peptide_hits;
92 vector<ProteinHit> temp_protein_hits;
93 vector<ProteinHit> chosen_protein_hits;
94 map<String, vector<PeptideIdentification> > identifiers;
95 PeptideIdentification temp_identification;
96 vector<String> chosen_ids;
97 vector<pair<double, PeptideIdentification> > identifications_with_scores;
98 vector<pair<double, PeptideIdentification> >::iterator it = identifications_with_scores.begin();
99 vector<PeptideIdentification> temp_identifications;
100
101
102 protein_identifications.push_back(ProteinIdentification());
103 //-------------------------------------------------------------
104 // parsing parameters
105 //-------------------------------------------------------------
106 String inputfile_name = getStringOption_("in");
107 String outputfile_name = getStringOption_("out");
108 Size number_of_peptides = getIntOption_("number_of_peptides");
109 Size number_of_rand_invokations = getIntOption_("number_of_rand_invokations");
110 bool best_hits = getFlag_("best_hits");
111
112 //-------------------------------------------------------------
113 // reading input
114 //-------------------------------------------------------------
115 String document_id;
116 idXML_file.load(inputfile_name, protein_identifications, identifications, document_id);
117
118 if (number_of_peptides > identifications.size())
119 {
120 writeLogError_("Number of existing peptides smaller than number of chosen peptides. Aborting!");
121 return ILLEGAL_PARAMETERS;
122 }
123
124 //-------------------------------------------------------------
125 // calculations
126 //-------------------------------------------------------------
127 if (best_hits)
128 {
129 for (Size i = 0; i < identifications.size(); ++i)
130 {
131 identifications_with_scores.emplace_back(identifications[i].getHits()[0].getScore(), identifications[i]);
132 }
133 sort(identifications_with_scores.begin(), identifications_with_scores.end(), TOPPIDExtractor::compareIDsWithScores);
134 it = identifications_with_scores.begin();
135 while (it != identifications_with_scores.end() && chosen_ids.size() < number_of_peptides)
136 {
137 if (find(chosen_ids.begin(), chosen_ids.end(), it->second.getHits()[0].getSequence().toString()) == chosen_ids.end())
138 {
139 chosen_ids.push_back(it->second.getHits()[0].getSequence().toString());
140 chosen_identifications.push_back(it->second);

Callers

nothing calls this directly

Calls 15

sortFunction · 0.85
emplace_backMethod · 0.80
getSequenceMethod · 0.80
getAccessionMethod · 0.80
StringClass · 0.50
beginMethod · 0.45
push_backMethod · 0.45
loadMethod · 0.45
sizeMethod · 0.45
getScoreMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected