//public ConcurrentDictionary<string, List<Protein>> DicOfProteins = new ConcurrentDictionary<string, List<Protein>>(); private void ComputePSMs(Query query, Peptide modified_peptide) { PeptideSpectrumMatch psm = new PeptideSpectrumMatch(query, modified_peptide, options); if (psm.MatchingProducts > options.fragments.Count) { //DicOfProteins.GetOrAdd(psm.Peptide.BaseSequence, new List<Protein>()).Add(psm.Peptide.Parent); // if (!DicOfProteins.ContainsKey(psm.Peptide.BaseSequence)) // DicOfProteins.AddOrUpdate(psm.Peptide.BaseSequence, new List<Protein>()); // DicOfProteins[psm.Peptide.BaseSequence].Add(psm.Peptide.Parent); //List<PeptideSpectrumMatch> psmsOfQuery = query.psms; if (query.psms.Count < options.NbPSMToKeep) { query.psms.Add(psm); } else if (query.psms[options.NbPSMToKeep - 1].ProbabilityScore() < psm.ProbabilityScore()) { for (int i = 0; i < query.psms.Count; i++) { if (query.psms[i].ProbabilityScore() <= psm.ProbabilityScore()) { query.psms.Insert(i, psm); break; } } if (query.psms.Count > options.NbPSMToKeep) { query.psms.RemoveAt(options.NbPSMToKeep - 1); } }//*/ //TODO check optimal number of PSM to store /* * //TODO Reactivate this to save on memory space * if (psmsOfPrecursor.Count == 0 || psmsOfPrecursor[0].MaxQuantScore() == psm.MaxQuantScore()) * psmsOfPrecursor.Add(psm); * else * if (psm.MaxQuantScore() > psmsOfPrecursor[0].MaxQuantScore()) * { * psmsOfPrecursor.Clear(); * psmsOfPrecursor.Add(psm); * } * //*/ } }
public bool KeepPSM(PeptideSpectrumMatch psm) { return(psm.MatchingIntensity >= minIntensityScore && psm.MatchingIntensityFraction >= minIntensityFractionScore && psm.ProductScore >= minProductScore && psm.PrecursorScore >= minPrecursorScore && psm.MatchingProductsFraction >= minMatchingProductFractionScore && psm.MatchingProducts >= minMatchingProductScore && psm.ProteinScore >= minProteinScore && psm.PeptideScore >= minPeptideScore && psm.FragmentScore >= minFragmentScore && psm.ProbabilityScore() >= minProbabilityScore); }
public double OptimizedBestPsmScore(Peptide peptide = null, bool checkMods = false) { PeptideSpectrumMatch psm = OptimizedBestPsm(peptide, checkMods); if (psm != null) { return(psm.ProbabilityScore()); } else { return(0); } }
public static int DescendingOptimizedScoreComparison(PeptideSpectrumMatch left, PeptideSpectrumMatch right) { int comparison = -(left.ProbabilityScore().CompareTo(right.ProbabilityScore())); if (comparison != 0) { return(comparison); } else { return(left.Target.CompareTo(right.Target)); } }
public IEnumerable <PeptideSpectrumMatch> OptimizedBestPsms() { if (psms.Count > 0) { PeptideSpectrumMatch bestpsm = OptimizedBestPsm(); double score = bestpsm.ProbabilityScore(); for (int i = 0; i < psms.Count; i++) { if (psms[i].ProbabilityScore() >= score) { yield return(psms[i]); } } } }