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

Method main_

src/topp/IDFilter.cpp:219–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217
218
219 ExitCodes main_(int, const char**) override
220 {
221 const String tmp_feature_id_metaval_ = "tmp_feature_id";
222 String inputfile_name = getStringOption_("in");
223 String outputfile_name = getStringOption_("out");
224
225 vector<ProteinIdentification> proteins;
226 vector<PeptideIdentification> peptides;
227
228 //only used for cxml
229 ConsensusMap cmap;
230 unordered_map<UInt64, ConsensusFeature*> id_to_featureref;
231
232 const auto& infiletype = FileHandler::getType(inputfile_name);
233 if (infiletype == FileTypes::IDXML)
234 {
235 IdXMLFile().load(inputfile_name, proteins, peptides);
236 }
237 else if (infiletype == FileTypes::CONSENSUSXML)
238 {
239 ConsensusXMLFile().load(inputfile_name, cmap);
240 for (auto& f : cmap)
241 {
242 UInt64 id = f.getUniqueId();
243 id_to_featureref[id] = &f;
244 for (auto& p : f.getPeptideIdentifications())
245 {
246 p.setMetaValue(tmp_feature_id_metaval_, String(id));
247 peptides.push_back(std::move(p));
248 //if ((UInt64)peptides.back().getMetaValue(tmp_feature_id_metaval_) != id) std::cout << "WHAT THE FUCK" << std::endl;
249 }
250 f.getPeptideIdentifications().clear();
251 }
252 auto& unassigned = cmap.getUnassignedPeptideIdentifications();
253 peptides.reserve(peptides.size() + unassigned.size());
254 std::move(std::begin(unassigned),std::end(unassigned),
255 std::back_inserter(peptides));
256 unassigned.clear();
257
258 std::swap(proteins, cmap.getProteinIdentifications());
259 }
260
261
262 Size n_prot_ids = proteins.size();
263 Size n_prot_hits = IDFilter::countHits(proteins);
264 Size n_pep_ids = peptides.size();
265 Size n_pep_hits = IDFilter::countHits(peptides);
266
267 // handle remove_meta
268 StringList meta_info = getStringList_("remove_peptide_hits_by_metavalue");
269 bool remove_meta_enabled = (!meta_info.empty());
270 if (remove_meta_enabled && meta_info.size() != 3)
271 {
272 writeLogError_("Param 'remove_peptide_hits_by_metavalue' has invalid number of arguments. Expected 3, got " + String(meta_info.size()) + ". Aborting!");
273 printUsage_();
274 return ILLEGAL_PARAMETERS;
275 }
276 if (remove_meta_enabled && !(meta_info[1] == "lt" || meta_info[1] == "eq" || meta_info[1] == "gt" || meta_info[1] == "ne"))

Callers

nothing calls this directly

Calls 15

getTypeFunction · 0.85
countHitsFunction · 0.85
keepHitsMatchingProteinsFunction · 0.85
filterHitsByScoreFunction · 0.85
keepNBestHitsFunction · 0.85
keepBestPerPeptideFunction · 0.85
filterHitsByRankFunction · 0.85
removeDecoyHitsFunction · 0.85
updateHitRanksFunction · 0.85
getUniqueIdMethod · 0.80

Tested by

no test coverage detected