Exemple #1
0
        /// <summary>
        /// Finds the XIC based on the m/z and scan parameters.
        /// </summary>
        /// <param name="mz"></param>
        /// <param name="scan"></param>
        /// <returns></returns>
        public List <XYData> FindXic(double mz, int scan, bool shouldSmooth)
        {
            LcmsFeatureTarget target = new LcmsFeatureTarget();

            target.ID              = 0;
            target.MZ              = mz;
            target.ScanLCTarget    = scan;
            target.ElutionTimeUnit = Globals.ElutionTimeUnit.ScanNum;
            m_run.CurrentMassTag   = target;
            var result = m_run.ResultCollection.GetTargetedResult(m_run.CurrentMassTag);

            double chromPeakGeneratorTolInPPM = MzPpmWindow;

            Globals.ChromatogramGeneratorMode chromGeneratorMode = Globals.ChromatogramGeneratorMode.MZ_BASED;

            var chromGen = new PeakChromatogramGenerator(chromPeakGeneratorTolInPPM,
                                                         chromGeneratorMode);

            chromGen.NETWindowWidthForNonAlignedData = Convert.ToSingle(NetWindow);

            int pointsToSmooth = 5;
            var chromSmoother  = new SavitzkyGolaySmoother(pointsToSmooth, 2);

            double chromPeakDetectorPeakBR   = 1;
            double chromPeakDetectorSigNoise = 1;
            var    chromPeakDetector         = new ChromPeakDetector(chromPeakDetectorPeakBR,
                                                                     chromPeakDetectorSigNoise);

            ChromPeakSelectorParameters chromPeakSelectorParameters = new ChromPeakSelectorParameters();
            var chromPeakSelector = new BasicChromPeakSelector(chromPeakSelectorParameters);

            //this generates an extracted ion chromatogram
            // Since we are not using the built in generator,
            chromGen.Execute(m_run.ResultCollection);

            //this smooths the data - very important step!
            if (shouldSmooth)
            {
                chromSmoother.Execute(m_run.ResultCollection);
            }

            //this detects peaks within an extracted ion chromatogram
            chromPeakDetector.Execute(m_run.ResultCollection);

            //this selects the peak
            chromPeakSelector.Parameters.PeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget;
            chromPeakSelector.Execute(m_run.ResultCollection);

            //Here's the chromatogram data...
            List <XYData> data = new List <XYData>();

            for (int i = 0; i < m_run.XYData.Xvalues.Length; i++)
            {
                XYData datum = new XYData(m_run.XYData.Xvalues[i], m_run.XYData.Yvalues[i]);
                data.Add(datum);
            }

            return(data);
        }
        public PeakChromatogramGenerator(double tolerance, Globals.ChromatogramGeneratorMode chromMode,
                                         Globals.IsotopicProfileType isotopicProfileTarget, Globals.ToleranceUnit toleranceUnit = Globals.ToleranceUnit.PPM)
        {
            Tolerance = tolerance;
            ChromatogramGeneratorMode = chromMode;
            IsotopicProfileTarget     = isotopicProfileTarget;

            TopNPeaksLowerCutOff = 0.3;
            ChromWindowWidthForNonAlignedData = 0.4f;
            ChromWindowWidthForAlignedData    = 0.1f;

            ToleranceUnit = toleranceUnit;

            _chromGen = new ChromatogramGenerator();
        }
 public PeakChromatogramGenerator(double tolerance, Globals.ChromatogramGeneratorMode chromMode)
     : this(tolerance, chromMode, Globals.IsotopicProfileType.UNLABELED)
 {
 }