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

Function postProcessHits_

src/topp/RNPxlSearch.cpp:1275–1446  ·  view source on GitHub ↗

Filter by top scoring hits, reconstruct original peptide from memory efficient structure, and add additional meta information.

Source from the content-addressed store, hash-verified

1273
1274 /// Filter by top scoring hits, reconstruct original peptide from memory efficient structure, and add additional meta information.
1275 void postProcessHits_(const PeakMap& exp,
1276 vector<vector<AnnotatedHit> >& annotated_hits,
1277 vector<ProteinIdentification>& protein_ids,
1278 vector<PeptideIdentification>& peptide_ids,
1279 Size top_hits,
1280 const RNPxlModificationMassesResult& mm,
1281 const ModifiedPeptideGenerator::MapToResidueType& fixed_modifications,
1282 const ModifiedPeptideGenerator::MapToResidueType& variable_modifications,
1283 Size max_variable_mods_per_peptide,
1284 const map<String, PrecursorPurity::PurityScores>& purities)
1285 {
1286 // remove all but top n scoring (Note: this is currently necessary as postScoreHits_ might reintroduce nucleotide specific hits for fast scoring)
1287#ifdef _OPENMP
1288#pragma omp parallel for
1289#endif
1290 for (SignedSize scan_index = 0; scan_index < (SignedSize)annotated_hits.size(); ++scan_index)
1291 {
1292 // sort and keeps n best elements according to score
1293 Size topn = top_hits > annotated_hits[scan_index].size() ? annotated_hits[scan_index].size() : top_hits;
1294 std::partial_sort(annotated_hits[scan_index].begin(), annotated_hits[scan_index].begin() + topn, annotated_hits[scan_index].end(), AnnotatedHit::hasBetterScore);
1295 annotated_hits[scan_index].resize(topn);
1296 annotated_hits.shrink_to_fit();
1297 }
1298
1299#ifdef _OPENMP
1300#pragma omp parallel for
1301#endif
1302 for (SignedSize scan_index = 0; scan_index < (SignedSize)annotated_hits.size(); ++scan_index)
1303 {
1304 if (!annotated_hits[scan_index].empty())
1305 {
1306 // create empty PeptideIdentification object and fill meta data
1307 PeptideIdentification pi;
1308 pi.setMetaValue("scan_index", static_cast<unsigned int>(scan_index));
1309 pi.setScoreType("hyperscore");
1310 pi.setHigherScoreBetter(true);
1311 pi.setRT(exp[scan_index].getRT());
1312 pi.setMZ(exp[scan_index].getPrecursors()[0].getMZ());
1313 pi.setMetaValue("precursor_intensity", exp[scan_index].getPrecursors()[0].getIntensity());
1314 Size charge = exp[scan_index].getPrecursors()[0].getCharge();
1315
1316 // create full peptide hit structure from annotated hits
1317 vector<PeptideHit> phs;
1318 size_t rank(0);
1319 for (auto const & ah : annotated_hits[scan_index])
1320 {
1321 PeptideHit ph;
1322 ph.setCharge(charge);
1323
1324 // get unmodified string
1325 const String & s = ah.sequence.getString();
1326
1327 OPENMS_POSTCONDITION(!s.empty(), "Error: empty sequence in annotated hits.");
1328 AASequence aas = AASequence::fromString(s);
1329
1330 // reapply modifications (because for memory reasons we only stored the index and recreation is fast)
1331 vector<AASequence> all_modified_peptides;
1332 ModifiedPeptideGenerator::applyFixedModifications(fixed_modifications, aas);

Callers 2

RNPxlSearch.cppFile · 0.85

Calls 15

getInstanceFunction · 0.85
concatenateFunction · 0.85
getPrecursorsMethod · 0.80
getStringMethod · 0.80
getNativeIDMethod · 0.80
setPeakAnnotationsMethod · 0.80
setSearchEngineMethod · 0.80
getEnzymeMethod · 0.80
setSearchParametersMethod · 0.80
StringClass · 0.50
EmpiricalFormulaFunction · 0.50

Tested by

no test coverage detected