PeakMatch MaxBy(List <IPeak> peaks, GlycanFilter glycanFilter) { PeakMatch best = new PeakMatch(); foreach (var peptide in matches_.Keys) { best[peptide] = new Dictionary <string, HashSet <int> >(); double best_score = 0; foreach (var g in matches_[peptide].Keys) { if (!glycanFilter(g)) { continue; } double score = SearchHelper.ComputePeakScore(peaks, matches_[peptide][g]); if (best_score < score) { best_score = score; best[peptide] = new Dictionary <string, HashSet <int> >(); best[peptide][g] = matches_[peptide][g]; } else if (best_score == score) { best[peptide][g] = matches_[peptide][g]; } } } return(best); }
public void Max(List <IPeak> peaks) { PeakMatch best = new PeakMatch(); GlycanFilter complexFilter = new GlycanFilter((s) => s.Length == 47); MergePeakMatch(ref best, MaxBy(peaks, complexFilter)); GlycanFilter highMannoseFilter = new GlycanFilter((s) => s.Length == 11); MergePeakMatch(ref best, MaxBy(peaks, highMannoseFilter)); MergePeakMatch(ref best, MaxByHybrid(peaks)); matches_ = best; }