From 9d6a84ca9c5c562b664ca10467348ba660f0497b Mon Sep 17 00:00:00 2001 From: Michael Coleman Date: Thu, 8 May 2008 22:44:54 -0500 Subject: [PATCH] fix: continue handling candidate spectra after tie When considering the candidate spectra for a particular peptide, if a "tie" was seen (basically, a situation that would cause an extra L line to be added after an M line in an SQT file), further candidates were not considered. This was a bug--all candidates need to be considered. --- cgreylag.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cgreylag.cpp b/cgreylag.cpp index f3b472b..4ce5b8e 100644 --- a/cgreylag.cpp +++ b/cgreylag.cpp @@ -584,7 +584,8 @@ evaluate_peptide(const search_context &context, match &m, for (const mass_trace_list *p=mtlp; p; p=p->next) m.mass_trace.push_back(p->item); - // If this is duplicate, just append to the existing match and return + // If this is duplicate, just append to the existing match and continue + bool duplicate = false; for (std::vector::reverse_iterator rit = sp_best_matches.rbegin(); rit != sp_best_matches.rend(); rit++) if (score_equal(rit->score, m.score) @@ -594,15 +595,18 @@ evaluate_peptide(const search_context &context, match &m, and rit->mass_trace == m.mass_trace) { rit->peptide_begin.push_back(m.peptide_begin[0]); rit->sequence_name.push_back(m.sequence_name[0]); - return; + duplicate = true; + break; } // Otherwise, insert this match in the correct position - assert(sp_best_matches.size() >= 1); - std::vector::reverse_iterator rit = sp_best_matches.rbegin(); - for (;rit+1 != sp_best_matches.rend() and (rit+1)->score > m.score; rit++) - *rit = *(rit+1); - *rit = m; + if (not duplicate) { + assert(sp_best_matches.size() >= 1); + std::vector::reverse_iterator rit = sp_best_matches.rbegin(); + for (;rit+1 != sp_best_matches.rend() and (rit+1)->score > m.score; rit++) + *rit = *(rit+1); + *rit = m; + } } } -- 2.11.4.GIT