Esempio n. 1
0
 public PeptideSpectrumMatch OptimizedBestPsm(Peptide peptide = null, bool checkMods = false)
 {
     if (psms.Count > 0)
     {
         if (peptide == null)
         {
             double bestScore        = psms[0].ProbabilityScore();
             int    bestProteinIndex = 0;
             double tmpScore;
             for (int i = 1; i < psms.Count; i++)
             {
                 tmpScore = psms[i].ProbabilityScore();
                 if (tmpScore > bestScore || (tmpScore == bestScore && psms[i].Target))//.ProteinScore >= proteinScore))
                 {
                     bestProteinIndex = i;
                     bestScore        = tmpScore;
                 }
             }
             return(psms[bestProteinIndex]);
         }
         else
         {
             double bestScore        = 0;
             int    bestProteinIndex = 0;
             double proteinScore     = 0;
             for (int i = 0; i < psms.Count; i++)
             {
                 if (peptide.IsSamePeptide(psms[i].Peptide, checkMods) && (psms[i].ProbabilityScore() > bestScore || (psms[i].ProbabilityScore() == bestScore && psms[i].Target)))//.ProteinScore > proteinScore)))
                 {
                     bestProteinIndex = i;
                     bestScore        = psms[i].ProbabilityScore();
                     proteinScore     = psms[i].ProteinScore;
                 }
             }
             if (bestScore > 0)
             {
                 return(psms[bestProteinIndex]);
             }
         }
     }
     return(null);
 }
Esempio n. 2
0
        public double ProbabilityScore(Peptide peptide = null, bool checkMods = false)
        {/*
          * double score = 0;
          * foreach(PeptideSpectrumMatch psm in psms)
          *     if(
          * foreach (PeptideSpectrumMatch psm in OptimizedBestPsms(peptide))
          *     score += (1 - score) * psm.OptimizedScore();
          * return score;
          * //*/
            if (peptide != null)
            {
                double score = 0;
                foreach (PeptideSpectrumMatch psm in psms)
                {
                    if (peptide.IsSamePeptide(psm.Peptide, checkMods))
                    {
                        score += psm.ProbabilityScore();
                    }
                }
                return(score);
            }
            else
            {
                return(OptimizedBestPsmScore(peptide, checkMods));//TODO Reactivate Optimized Precursor Score
            }
            //PeptideSpectrumMatch psmLeft = OptimizedBestPsm(peptide, checkMods);
            //if (psmLeft != null)
            //    return psmLeft.OptimizedScore();

            /*         (dIntensity * psmLeft.MatchingIntensityFraction +
             *                  dProduct * psmLeft.ProductScore +
             *                  dPrecursor * psmLeft.PrecursorScore +
             *                  dMatching * psmLeft.MatchingProductsFraction +
             *                  dProtein * psmLeft.ProteinScore +
             *                  dScore * psmLeft.MaxQuantScore() +
             *                  (Isotopes.Count > 0 ? dIsotope : 0) +
             *                  (Track.Invented ? dInvented : 0) +
             *                  dPeptideScore * psmLeft.PeptideScore);//*/
            //else
            //    return 0;//*/
        }