| 17 | { |
| 18 | |
| 19 | IdentificationSummary::Result IdentificationSummary::compute(vector<ProteinIdentification>& prot_ids, vector<PeptideIdentification>& pep_ids) |
| 20 | { |
| 21 | IdentificationSummary::Result result; |
| 22 | set<String> peptides; |
| 23 | set<String> proteins; |
| 24 | |
| 25 | // PSMs and collect unique peptides in set |
| 26 | for (const auto& pep_id : pep_ids) |
| 27 | { |
| 28 | if (!pep_id.empty()) |
| 29 | { |
| 30 | result.peptide_spectrum_matches += 1; |
| 31 | const auto& temp_hits = pep_id.getHits(); |
| 32 | if (temp_hits.empty()) |
| 33 | continue; |
| 34 | peptides.insert(temp_hits[0].getSequence().toUnmodifiedString()); |
| 35 | } |
| 36 | } |
| 37 | // get sum of all peptide length for mean calculation |
| 38 | UInt peptide_length_sum = 0; |
| 39 | for (const auto& pep : peptides) |
| 40 | { |
| 41 | peptide_length_sum += pep.size(); |
| 42 | } |
| 43 | result.peptide_length_mean = (double)peptide_length_sum / peptides.size(); |
| 44 | // get missed cleavages |
| 45 | UInt missed_cleavages = 0; |
| 46 | UInt pep_count = 0; |
| 47 | MissedCleavages mc; |
| 48 | mc.compute(prot_ids, pep_ids); |
| 49 | for (const auto& m : mc.getResults()) |
| 50 | { |
| 51 | for (const auto& [key, val] : m) |
| 52 | { |
| 53 | missed_cleavages += key * val; |
| 54 | pep_count += val; |
| 55 | } |
| 56 | } |
| 57 | result.missed_cleavages_mean = (double)missed_cleavages / pep_count; |
| 58 | // collect unique proteins in sets and scores mean |
| 59 | double protein_hit_scores_sum = 0; |
| 60 | UInt protein_hit_count = 0; |
| 61 | for (const auto& prot_id : prot_ids) |
| 62 | { |
| 63 | const auto& temp_hits = prot_id.getHits(); |
| 64 | protein_hit_count += temp_hits.size(); |
| 65 | for (const auto& temp_hit : temp_hits) |
| 66 | { |
| 67 | proteins.insert(temp_hit.getAccession()); |
| 68 | protein_hit_scores_sum += temp_hit.getScore(); |
| 69 | } |
| 70 | } |
| 71 | result.protein_hit_scores_mean = protein_hit_scores_sum / protein_hit_count; |
| 72 | // unique peptides and proteins with their significance threshold (always the same in idXML file) |
| 73 | // get significance threshold if score type is FDR, else -1 |
| 74 | result.unique_peptides.count = peptides.size(); |
| 75 | result.unique_proteins.count = proteins.size(); |
| 76 | if (pep_ids.front().getScoreType() == "FDR") |
nothing calls this directly
no test coverage detected