Example #1
0
        /// <summary>
        /// Builds the isotopic profile plot based on the selected isotope ratios.
        /// </summary>
        private void BuildIsotopicProfilePlot()
        {
            if (this.Mass.Equals(0.0))
            {   // Mass has not been set
                return;
            }

            // Set up the concentration tuner if any of the proportions changed.
            var predictor = new IsoProfilePredictor(
                this.IsotopeProportions["C"].GetProportions(),
                this.IsotopeProportions["H"].GetProportions(),
                this.IsotopeProportions["N"].GetProportions(),
                this.IsotopeProportions["O"].GetProportions(),
                this.IsotopeProportions["S"].GetProportions(),
                this.RelativeIntensityThreshold
                );
            var averagine = new Averagine();

            var theoreticalPeaks = averagine.GetTheoreticalIsotopeProfileInst(
                this.Mass,
                this.Charge,
                this.RelativeIntensityThreshold,
                predictor);

            //var actualPeaks = isotopicConcentrationTuner.AlignObservedPeaks(
            //    this.ObservedPeaks.Select(peakDataPoint => new Peak(peakDataPoint.X, peakDataPoint.Y)).ToList(),
            //    theoreticalPeaks);

            this.IsotopicEnvelopePlotViewModel.BuildPlot(
                theoreticalPeaks,
                this.ObservedPeaks.Select(pd => new Peak(pd.Item.X, pd.Item.Y)).ToList(),
                this.IsProfile);
        }
Example #2
0
        /// <summary>
        /// Gets the theoretical isotope profile calculated using Averagine with the provided
        /// isotope proportions.
        /// </summary>
        /// <param name="proportions">The proportions of each isotope.</param>
        /// <returns>The theoretical isotope profile peaks.</returns>
        public List <Peak> GetTheoreticalIsotopeProfile(double[] proportions)
        {
            // Get IsoProfilePredictor with updated proportions
            var isoProfilePredictor = new IsoProfilePredictor(
                Element.Code == "C" ? proportions : IsoProfilePredictor.DefaultProbC,
                Element.Code == "H" ? proportions : IsoProfilePredictor.DefaultProbH,
                Element.Code == "N" ? proportions : IsoProfilePredictor.DefaultProbN,
                Element.Code == "O" ? proportions : IsoProfilePredictor.DefaultProbO,
                Element.Code == "S" ? proportions : IsoProfilePredictor.DefaultProbS
                );

            var averagine = new Averagine();

            return(averagine.GetTheoreticalIsotopeProfileInst(
                       Mass,
                       Charge,
                       RelativeIntensityThreshold,
                       isoProfilePredictor));
        }