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

Method applyBasic

src/openms/source/ANALYSIS/ID/FalseDiscoveryRate.cpp:996–1070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

994 }
995
996 void FalseDiscoveryRate::applyBasic(ConsensusMap & cmap, bool include_unassigned_peptides)
997 {
998 bool q_value = !param_.getValue("no_qvalues").toBool();
999 const string& score_type = q_value ? "q-value" : "FDR";
1000 bool all_hits = param_.getValue("use_all_hits").toBool();
1001
1002 bool treat_runs_separately = param_.getValue("treat_runs_separately").toBool();
1003 bool split_charge_variants = param_.getValue("split_charge_variants").toBool();
1004
1005 //TODO this assumes all used search engine scores have the same score orientation
1006 // include the determination of orientation in the getScores methods instead
1007 bool higher_score_better = false;
1008 for (const auto& cf : cmap)
1009 {
1010 const auto& pep_ids = cf.getPeptideIdentifications();
1011 if (!pep_ids.empty())
1012 {
1013 higher_score_better = pep_ids[0].isHigherScoreBetter();
1014 break;
1015 }
1016 }
1017 if (cmap.empty())
1018 {
1019 for (const auto& id : cmap.getUnassignedPeptideIdentifications())
1020 {
1021 higher_score_better = id.isHigherScoreBetter();
1022 break;
1023 }
1024 }
1025
1026 bool add_decoy_peptides = param_.getValue("add_decoy_peptides").toBool();
1027 ScoreToTgtDecLabelPairs scores_labels;
1028
1029 //Warning: this assumes that there are no dangling identifier references in the PeptideIDs
1030 // because this disables checking
1031 if (cmap.getProteinIdentifications().size() == 1)
1032 {
1033 treat_runs_separately = false;
1034 }
1035
1036 if (treat_runs_separately)
1037 {
1038 for (const auto& protID : cmap.getProteinIdentifications())
1039 {
1040 if (split_charge_variants)
1041 {
1042 pair<int, int> chargeRange = protID.getSearchParameters().getChargeRange();
1043 for (int c = chargeRange.first; c <= chargeRange.second; ++c)
1044 {
1045 if (c == 0) continue;
1046 IDScoreGetterSetter::getPeptideScoresFromMap_(scores_labels, cmap, include_unassigned_peptides,
1047 [&protID](const PeptideIdentification& id){return protID.getIdentifier() == id.getIdentifier();}, all_hits,
1048 [&c](const PeptideHit& hit){return c == hit.getCharge();});
1049 map<double, double> scores_to_fdr;
1050 calculateFDRBasic_(scores_to_fdr, scores_labels, q_value, higher_score_better);
1051 IDScoreGetterSetter::setPeptideScoresForMap_(scores_to_fdr, cmap, include_unassigned_peptides, score_type, higher_score_better, add_decoy_peptides, c, protID.getIdentifier());
1052 }
1053 }

Callers 4

inferProteinGroups_Method · 0.80
main_Method · 0.80
main_Method · 0.80
main_Method · 0.80

Calls 13

getChargeRangeMethod · 0.80
metaValueExistsMethod · 0.80
getMetaValueMethod · 0.80
getAccessionMethod · 0.80
toBoolMethod · 0.45
getValueMethod · 0.45
emptyMethod · 0.45
isHigherScoreBetterMethod · 0.45
sizeMethod · 0.45
getChargeMethod · 0.45
reserveMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected