Example #1
0
 /// <summary>
 /// Get a mass value from the text string, treating the string as m/z info if we have a charge state
 /// </summary>
 private double?GetMassFromText(string text)
 {
     try
     {
         if (String.IsNullOrEmpty(text))
         {
             return(null);
         }
         else
         {
             double parsed = double.Parse(text);
             if (Charge.HasValue)
             {
                 // Convert from m/z to mass
                 return(BioMassCalc.CalculateIonMassFromMz(parsed, Charge.Value));
             }
             return(parsed);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public double GetMassI(int massIndex, int?decoyMassShift = null)
        {
            // Return the original monoisotopic mass + H, if requested to maintain an exact match.
            if (massIndex == 0 && !decoyMassShift.HasValue)
            {
                return(_monoisotopicMass);
            }
            // Otherwize use the charge to convert from the peak center m/z values
            double shift = SequenceMassCalc.GetPeptideInterval(decoyMassShift);    // Correct for shift applied to the distribution

            return(_isMassH ? SequenceMassCalc.GetMH(ExpectedPeaks[MassIndexToPeakIndex(massIndex)].Mz - shift, _charge) : BioMassCalc.CalculateIonMassFromMz(ExpectedPeaks[MassIndexToPeakIndex(massIndex)].Mz - shift, _charge));
        }
Example #3
0
 public double GetIonMass()
 {
     return(Transition.IsCustom()
         ? BioMassCalc.CalculateIonMassFromMz(Mz, Transition.Charge)
         : SequenceMassCalc.GetMH(Mz, Transition.Charge));
 }