Ejemplo n.º 1
0
 public double GetScore(Sequence sequence, int charge, int scan, LcMsRun lcmsRun)
 {
     var mass = sequence.Composition.Mass + Composition.H2O.Mass;
     var spectrum = lcmsRun.GetSpectrum(scan);
     var ionTypes = _rankScore.GetIonTypes(charge, mass);
     var filteredSpectrum = SpectrumFilter.FilterIonPeaks(sequence, spectrum, ionTypes, _tolerance);
     var match = new SpectrumMatch(sequence, filteredSpectrum, charge);
     var score = 0.0;
     var rankedPeaks = new RankedPeaks(filteredSpectrum);
     foreach (var ionType in ionTypes)
     {
         var ions = match.GetCleavageIons(ionType);
         foreach (var ion in ions)
         {
             var rank = rankedPeaks.RankIon(ion, _tolerance);
             score += _rankScore.GetScore(ionType, rank, charge, mass);
         }
     }
     return score;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Add single Peptide-Spectrum match to RankTable.
 /// </summary>
 /// <param name="match"></param>
 public void AddMatch(SpectrumMatch match)
 {
     var ranks = new RankedPeaks(match.Spectrum);
     for (int i = 0; i < ranks.Peaks.Length; i++)
     {
         var index = i;
         if (index >= MaxRanks) index = MaxRanks - 1;
         _rankTotals[index]++;
         _rankTotals[MaxRanks]++;
     }
     foreach (var ionType in IonTypes)
     {
         var ions = match.GetCleavageIons(ionType);
         foreach (var ion in ions)
         {
             var rank = ranks.RankIon(ion, _tolerance);
             var rankIndex = GetRankIndex(rank);
             _rankTable[ionType][rankIndex]++;
         }
     }
 }