private static IsotopomerEnvelope ComputeIsotopomerEnvelope(double mass) { var numAveragines = mass / AveragineMass; var numC = (int)Math.Round(C * numAveragines); var numH = (int)Math.Round(H * numAveragines); var numN = (int)Math.Round(N * numAveragines); var numO = (int)Math.Round(O * numAveragines); var numS = (int)Math.Round(S * numAveragines); if (numH == 0) { numH = 1; } return(IsoProfilePredictor.GetIsotopomerEnvelop(numC, numH, numN, numO, numS)); }
private IsotopomerEnvelope ComputeIsotopomerEnvelope(double mass, IsoProfilePredictor isoProfilePredictor = null) { var numAveragines = mass / AveragineMass; var numC = (int)Math.Round(C * numAveragines); var numH = (int)Math.Round(H * numAveragines); var numN = (int)Math.Round(N * numAveragines); var numO = (int)Math.Round(O * numAveragines); var numS = (int)Math.Round(S * numAveragines); if (numH == 0) { numH = 1; } isoProfilePredictor = isoProfilePredictor ?? IsoProfilePredictor.Predictor; return(isoProfilePredictor.GetIsotopomerEnvelope(numC, numH, numN, numO, numS)); }
static IsoProfilePredictor() { Predictor = new IsoProfilePredictor(); }
/// <summary> /// Get the theoretical Isotope profile for <paramref name="monoIsotopeMass"/> at charge <paramref name="charge"/> using <paramref name="isoProfilePredictor"/> /// </summary> /// <param name="monoIsotopeMass"></param> /// <param name="charge"></param> /// <param name="relativeIntensityThreshold"></param> /// <param name="isoProfilePredictor"></param> /// <returns></returns> public List <Peak> GetTheoreticalIsotopeProfileInst(double monoIsotopeMass, int charge, double relativeIntensityThreshold = 0.1, IsoProfilePredictor isoProfilePredictor = null) { var peakList = new List <Peak>(); var envelope = GetIsotopomerEnvelopeInst(monoIsotopeMass, isoProfilePredictor); for (var isotopeIndex = 0; isotopeIndex < envelope.Envelope.Length; isotopeIndex++) { var intensity = envelope.Envelope[isotopeIndex]; if (intensity < relativeIntensityThreshold) { continue; } var mz = Ion.GetIsotopeMz(monoIsotopeMass, charge, isotopeIndex); peakList.Add(new Peak(mz, intensity)); } return(peakList); }
/// <summary> /// Get the Isotopomer envelope for <paramref name="monoIsotopeMass"/> using <paramref name="isoProfilePredictor"/> /// </summary> /// <param name="monoIsotopeMass"></param> /// <param name="isoProfilePredictor"></param> /// <returns></returns> public IsotopomerEnvelope GetIsotopomerEnvelopeInst(double monoIsotopeMass, IsoProfilePredictor isoProfilePredictor = null) { var nominalMass = (int)Math.Round(monoIsotopeMass * Constants.RescalingConstant); return(GetIsotopomerEnvelopeFromNominalMassInst(nominalMass, isoProfilePredictor)); }
/// <summary> /// Get the Isotopomer envelope for the nominal mass <paramref name="nominalMass"/> using <paramref name="isoProfilePredictor"/> /// </summary> /// <param name="nominalMass"></param> /// <param name="isoProfilePredictor"></param> /// <returns></returns> public IsotopomerEnvelope GetIsotopomerEnvelopeFromNominalMassInst(int nominalMass, IsoProfilePredictor isoProfilePredictor = null) { var nominalMassFound = IsotopeEnvelopMap.TryGetValue(nominalMass, out var envelope); if (nominalMassFound) { return(envelope); } var mass = nominalMass / Constants.RescalingConstant; envelope = ComputeIsotopomerEnvelope(mass, isoProfilePredictor); IsotopeEnvelopMap.AddOrUpdate(nominalMass, envelope, (key, value) => value); return(envelope); }