Esempio n. 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);
        }
Esempio n. 2
0
        /// <summary>
        /// Factory method for creating the key ChromPeakSelector algorithm
        /// </summary>
        /// <param name="workflowParameters"></param>
        /// <returns></returns>
        public static ChromPeakSelectorBase CreateChromPeakSelector(TargetedWorkflowParameters workflowParameters)
        {
            ChromPeakSelectorBase chromPeakSelector;
            var chromPeakSelectorParameters = new ChromPeakSelectorParameters();

            chromPeakSelectorParameters.NETTolerance     = (float)workflowParameters.ChromNETTolerance;
            chromPeakSelectorParameters.NumScansToSum    = workflowParameters.NumMSScansToSum;
            chromPeakSelectorParameters.PeakSelectorMode = workflowParameters.ChromPeakSelectorMode;
            chromPeakSelectorParameters.SummingMode      = workflowParameters.SummingMode;
            chromPeakSelectorParameters.AreaOfPeakToSumInDynamicSumming = workflowParameters.AreaOfPeakToSumInDynamicSumming;
            chromPeakSelectorParameters.MaxScansSummedInDynamicSumming  = workflowParameters.MaxScansSummedInDynamicSumming;



            switch (workflowParameters.ChromPeakSelectorMode)
            {
            case DeconTools.Backend.Globals.PeakSelectorMode.ClosestToTarget:
            case DeconTools.Backend.Globals.PeakSelectorMode.MostIntense:
            case DeconTools.Backend.Globals.PeakSelectorMode.N15IntelligentMode:
            case DeconTools.Backend.Globals.PeakSelectorMode.RelativeToOtherChromPeak:
                chromPeakSelector = new BasicChromPeakSelector(chromPeakSelectorParameters);
                break;

            case DeconTools.Backend.Globals.PeakSelectorMode.Smart:

                var smartchrompeakSelectorParameters = new SmartChromPeakSelectorParameters(chromPeakSelectorParameters);
                smartchrompeakSelectorParameters.MSFeatureFinderType                         = DeconTools.Backend.Globals.TargetedFeatureFinderType.ITERATIVE;
                smartchrompeakSelectorParameters.MSPeakDetectorPeakBR                        = workflowParameters.MSPeakDetectorPeakBR;
                smartchrompeakSelectorParameters.MSPeakDetectorSigNoiseThresh                = workflowParameters.MSPeakDetectorSigNoise;
                smartchrompeakSelectorParameters.MSToleranceInPPM                            = workflowParameters.MSToleranceInPPM;
                smartchrompeakSelectorParameters.NumChromPeaksAllowed                        = workflowParameters.NumChromPeaksAllowedDuringSelection;
                smartchrompeakSelectorParameters.MultipleHighQualityMatchesAreAllowed        = workflowParameters.MultipleHighQualityMatchesAreAllowed;
                smartchrompeakSelectorParameters.IterativeTffMinRelIntensityForPeakInclusion = 0.66;
                smartchrompeakSelectorParameters.NumMSSummedInSmartSelector                  = workflowParameters.SmartChromPeakSelectorNumMSSummed;

                chromPeakSelector = new SmartChromPeakSelector(smartchrompeakSelectorParameters);

                break;

            case DeconTools.Backend.Globals.PeakSelectorMode.SmartUIMF:
                var smartUIMFchrompeakSelectorParameters = new SmartChromPeakSelectorParameters(chromPeakSelectorParameters);
                smartUIMFchrompeakSelectorParameters.MSFeatureFinderType                         = DeconTools.Backend.Globals.TargetedFeatureFinderType.ITERATIVE;
                smartUIMFchrompeakSelectorParameters.MSPeakDetectorPeakBR                        = workflowParameters.MSPeakDetectorPeakBR;
                smartUIMFchrompeakSelectorParameters.MSPeakDetectorSigNoiseThresh                = workflowParameters.MSPeakDetectorSigNoise;
                smartUIMFchrompeakSelectorParameters.MSToleranceInPPM                            = workflowParameters.MSToleranceInPPM;
                smartUIMFchrompeakSelectorParameters.NumChromPeaksAllowed                        = workflowParameters.NumChromPeaksAllowedDuringSelection;
                smartUIMFchrompeakSelectorParameters.MultipleHighQualityMatchesAreAllowed        = workflowParameters.MultipleHighQualityMatchesAreAllowed;
                smartUIMFchrompeakSelectorParameters.IterativeTffMinRelIntensityForPeakInclusion = 0.66;

                chromPeakSelector = new SmartChromPeakSelectorUIMF(smartUIMFchrompeakSelectorParameters);

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(chromPeakSelector);
        }
Esempio n. 3
0
        public void find_targetMassTag_131959Test1()
        {
            var run = new RunFactory().CreateRun(xcaliburTestfile);

            var masstagImporter = new MassTagFromTextFileImporter(massTagTestList1);
            var massTagColl     = masstagImporter.Import();

            Assert.AreEqual(2719, massTagColl.TargetList.Count);

            var chromAligner = new ChromAlignerUsingVIPERInfo();

            chromAligner.Execute(run);

            var peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburAllPeaksFile);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);


            //int mtID = 635428;
            var mtID = 131959;

            Task peakChromGen = new PeakChromatogramGenerator(20);
            Task smoother     = new DeconTools.Backend.ProcessingTasks.Smoothers.SavitzkyGolaySmoother(23, 2);
            Task zeroFill     = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3);
            Task peakDet      = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector(0.5, 1);
            Task msPeakDet    = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true);

            var basicChromPeakSelParam = new ChromPeakSelectorParameters();

            basicChromPeakSelParam.NETTolerance     = 0.1f;
            basicChromPeakSelParam.PeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget;
            Task chromPeakSel = new BasicChromPeakSelector(basicChromPeakSelParam);


            Task msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);


            run.CurrentMassTag = massTagColl.TargetList.Find(p => p.ID == mtID);
            var mt = run.CurrentMassTag;

            mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS;

            Task theorFeatureGen       = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005);
            Task targetedFeatureFinder = new BasicTFF();
            Task fitScoreCalc          = new IsotopicProfileFitScoreCalculator();


            theorFeatureGen.Execute(run.ResultCollection);


            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------");
            Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NormalizedElutionTime.ToString("0.000") + "; Sequence = " + mt.Code + "; EmpiricalFormula= " + mt.EmpiricalFormula + "\n");

            peakChromGen.Execute(run.ResultCollection);
            smoother.Execute(run.ResultCollection);
            //TestUtilities.DisplayXYValues(run.ResultCollection);

            peakDet.Execute(run.ResultCollection);
            TestUtilities.DisplayPeaks(run.PeakList);

            chromPeakSel.Execute(run.ResultCollection);
            msgen.Execute(run.ResultCollection);
            //TestUtilities.DisplayXYValues(run.ResultCollection);
            msPeakDet.Execute(run.ResultCollection);
            targetedFeatureFinder.Execute(run.ResultCollection);
            fitScoreCalc.Execute(run.ResultCollection);

            var massTagResult = run.ResultCollection.MassTagResultList[mt];

            massTagResult.DisplayToConsole();



            //Console.WriteLine("------------------------------ end --------------------------");
        }
Esempio n. 4
0
        public void Test1()
        {
            var testFile =
                @"D:\Data\Orbitrap\BrianIQTesting\QC_Shew_11_02_pt5-b_6Jun11_Sphinx_11-03-27.RAW";
            var peaksTestFile =
                @"D:\Data\Orbitrap\BrianIQTesting\QC_Shew_11_02_pt5-b_6Jun11_Sphinx_11-03-27_peaks.txt";


            var run = RunUtilities.CreateAndLoadPeaks(testFile, peaksTestFile);

            var target = new LcmsFeatureTarget();

            target.ID = 0;


            target.MZ              = 715.39214;
            target.ScanLCTarget    = 7343;
            target.ElutionTimeUnit = Globals.ElutionTimeUnit.ScanNum;
            run.CurrentMassTag     = target;

            var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag);

            double chromPeakGeneratorTolInPPM = 20;
            var    chromGeneratorMode         = Globals.ChromatogramGeneratorMode.MZ_BASED;

            var chromGen = new PeakChromatogramGenerator(chromPeakGeneratorTolInPPM, chromGeneratorMode);

            // If we want to use the Execute Command
            //BLL .1 and .5 NET windows work.   .02 NET window does not BR and SN was set to 1 however)
            chromGen.ChromWindowWidthForNonAlignedData = .02F;


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

            //BLL We also tried to set the BR and SIG NOISE to 0.  This did not work
            var chromPeakDetectorPeakBR   = 0.5;
            var chromPeakDetectorSigNoise = 0.5;
            var chromPeakDetector         = new ChromPeakDetector(chromPeakDetectorPeakBR, chromPeakDetectorSigNoise);


            var chromPeakSelectorParameters = new ChromPeakSelectorParameters();

            chromPeakSelectorParameters.PeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget;
            var chromPeakSelector = new BasicChromPeakSelector(chromPeakSelectorParameters);

            var smartChromPeakParameters = new SmartChromPeakSelectorParameters();


            var smartChromPeakSelector = new SmartChromPeakSelector(smartChromPeakParameters);


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

            //this smooths the data - very important step!

            //BLL. This didnt work for me when we first started, instead of using the NET window above.
            //chromGen.GenerateChromatogram(run,
            //                                target.ScanLCTarget - 300,
            //                                target.ScanLCTarget + 300,
            //                                target.MZ,
            //                                chromPeakGeneratorTolInPPM);
            chromSmoother.Execute(run.ResultCollection);

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

            //this selects the peak
            chromPeakSelector.Execute(run.ResultCollection);
            //smartChromPeakSelector.Execute(run.ResultCollection);


            //TestUtilities.DisplayXYValues(run.XYData);
            TestUtilities.DisplayPeaks(run.PeakList);



            Console.WriteLine("Number of peaks detected = " + run.PeakList.Count);
            Console.WriteLine("Selected peak= " + result.ChromPeakSelected);
        }
Esempio n. 5
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<PNNLOmics.Data.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<PNNLOmics.Data.XYData> data = new List<PNNLOmics.Data.XYData>();

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

            return data;
        }
Esempio n. 6
0
        protected override void DoPostInitialization()
        {
            base.DoPostInitialization();
            ValidateParameters();

            theorFeatureGen    = new JoshTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005);
            theorN15FeatureGen = new JoshTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.N15, 0.005);

            chromGenN14 = new PeakChromatogramGenerator(_workflowParameters.ChromGenTolerance, _workflowParameters.ChromGeneratorMode);
            chromGenN14.TopNPeaksLowerCutOff = 0.333;

            chromGenN15 = new PeakChromatogramGenerator(_workflowParameters.ChromGenTolerance, DeconTools.Backend.Globals.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK, DeconTools.Backend.Globals.IsotopicProfileType.LABELLED);
            chromGenN15.TopNPeaksLowerCutOff = 0.333;

            var pointsToSmooth = (_workflowParameters.ChromSmootherNumPointsInSmooth + 1) / 2;

            chromSmoother     = new SavitzkyGolaySmoother(_workflowParameters.ChromSmootherNumPointsInSmooth, 2);
            chromPeakDetector = new ChromPeakDetector(_workflowParameters.ChromPeakDetectorPeakBR, _workflowParameters.ChromPeakDetectorSigNoise);

            var smartchrompeakSelectorParams = new SmartChromPeakSelectorParameters();

            smartchrompeakSelectorParams.MSFeatureFinderType          = DeconTools.Backend.Globals.TargetedFeatureFinderType.ITERATIVE;
            smartchrompeakSelectorParams.MSPeakDetectorPeakBR         = _workflowParameters.MSPeakDetectorPeakBR;
            smartchrompeakSelectorParams.MSPeakDetectorSigNoiseThresh = _workflowParameters.MSPeakDetectorSigNoise;
            smartchrompeakSelectorParams.MSToleranceInPPM             = _workflowParameters.MSToleranceInPPM;
            smartchrompeakSelectorParams.NETTolerance         = (float)_workflowParameters.ChromNETTolerance;
            smartchrompeakSelectorParams.NumScansToSum        = _workflowParameters.NumMSScansToSum;
            smartchrompeakSelectorParams.NumChromPeaksAllowed = 10;
            smartchrompeakSelectorParams.IterativeTffMinRelIntensityForPeakInclusion = 0.5;


            chromPeakSelectorN14 = new SmartChromPeakSelector(smartchrompeakSelectorParams);


            var chromPeakSelectorParameters = new ChromPeakSelectorParameters();

            chromPeakSelectorParameters.NumScansToSum    = _workflowParameters.NumMSScansToSum;
            chromPeakSelectorParameters.NETTolerance     = (float)_workflowParameters.ChromNETTolerance;
            chromPeakSelectorParameters.PeakSelectorMode = DeconTools.Backend.Globals.PeakSelectorMode.N15IntelligentMode;


            chromPeakSelectorN15 = new BasicChromPeakSelector(chromPeakSelectorParameters);
            chromPeakSelectorN15.IsotopicProfileType = DeconTools.Backend.Globals.IsotopicProfileType.LABELLED;

            msPeakDetector = new DeconToolsPeakDetectorV2(_workflowParameters.MSPeakDetectorPeakBR,
                                                          _workflowParameters.MSPeakDetectorSigNoise, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, false);


            var iterativeTFFParameters = new IterativeTFFParameters();

            iterativeTFFParameters.ToleranceInPPM = _n14N15Workflow2Parameters.TargetedFeatureFinderToleranceInPPM;
            iterativeTFFParameters.MinimumRelIntensityForForPeakInclusion = 0.33;
            iterativeTFFParameters.IsotopicProfileType = DeconTools.Backend.Globals.IsotopicProfileType.UNLABELLED;
            unlabelledProfilefinder = new IterativeTFF(iterativeTFFParameters);

            iterativeTFFParameters = new IterativeTFFParameters();
            iterativeTFFParameters.ToleranceInPPM = _n14N15Workflow2Parameters.TargetedFeatureFinderToleranceInPPM;
            iterativeTFFParameters.MinimumRelIntensityForForPeakInclusion = 0.33;
            iterativeTFFParameters.IsotopicProfileType = DeconTools.Backend.Globals.IsotopicProfileType.LABELLED;
            labelledProfileFinder = new IterativeTFF(iterativeTFFParameters);

            quantifier = new N14N15QuantifierTask(_n14N15Workflow2Parameters.NumPeaksUsedInQuant, _workflowParameters.MSToleranceInPPM);

            fitScoreCalc = new IsotopicProfileFitScoreCalculator();

            var minRelativeIntensityForScore = 0.2;

            resultValidatorN14 = new ResultValidatorTask(minRelativeIntensityForScore, true);

            resultValidatorN15 = new LabelledIsotopicProfileScorer(minRelativeIntensityForScore);

            ChromatogramXYData = new XYData();
            MassSpectrumXYData = new XYData();
            ChromPeaksDetected = new List <ChromPeak>();
        }
        public void smartChromPeakSelectorTest_noSumming()
        {
            var run = new RunFactory().CreateRun(xcaliburTestfile);

            run.Close();

            run = new RunFactory().CreateRun(xcaliburTestfile);


            var massTagColl = new TargetCollection();

            var masstagImporter = new MassTagFromTextFileImporter(massTagTestList1);

            massTagColl = masstagImporter.Import();

            var chromAligner = new ChromAlignerUsingVIPERInfo();

            chromAligner.Execute(run);

            var theorFeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005);

            var chromPeakDet = new ChromPeakDetector(0.5, 1);

            var smartchromParam        = new SmartChromPeakSelectorParameters();
            var smartChromPeakSelector = new SmartChromPeakSelector(smartchromParam);

            var basicChromParam        = new ChromPeakSelectorParameters();
            var basicChromPeakSelector = new BasicChromPeakSelector(basicChromParam);



            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            var iterativeTff = new IterativeTFF(new IterativeTFFParameters());

            var fitscoreCalc = new IsotopicProfileFitScoreCalculator();



            var testChromatogramDataFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TargetedWorkflowStandards\massTag635428_chromatogramData.txt";

            var xydata = TestUtilities.LoadXYDataFromFile(testChromatogramDataFile);

            Assert.IsNotNull(xydata);

            run.XYData = xydata;
            // run.XYData.Display();

            run.CurrentMassTag = massTagColl.TargetList.Where(p => p.ID == 635428).First();

            Console.WriteLine("------MT = " + run.CurrentMassTag.ToString());

            theorFeatureGen.Execute(run.ResultCollection);
            chromPeakDet.Execute(run.ResultCollection);

            var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag);

            //first run the standard peak selector
            basicChromPeakSelector.Execute(run.ResultCollection);
            Assert.AreEqual(10066, (int)Math.Round(result.ChromPeakSelected.XValue));


            //now run the smart chrom peak selector
            run.XYData = xydata;
            chromPeakDet.Execute(run.ResultCollection);
            smartChromPeakSelector.Parameters.NETTolerance = 0.025f;
            smartChromPeakSelector.Execute(run.ResultCollection);

            msgen.Execute(run.ResultCollection);
            iterativeTff.Execute(run.ResultCollection);

            TestUtilities.DisplayPeaks(run.PeakList);

            fitscoreCalc.Execute(run.ResultCollection);


            Assert.AreEqual(9579, (int)Math.Round(result.ChromPeakSelected.XValue));
            //result.DisplayToConsole();


            TestUtilities.DisplayIsotopicProfileData(result.Target.IsotopicProfile);
        }
        public void smartChromPeakSelectorTest_withDynamicSumming()
        {
            var run = new RunFactory().CreateRun(xcaliburTestfile);

            var massTagColl = new TargetCollection();

            var masstagImporter = new MassTagFromTextFileImporter(massTagTestList1);

            massTagColl = masstagImporter.Import();

            var chromAligner = new ChromAlignerUsingVIPERInfo();

            chromAligner.Execute(run);

            var theorFeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005);

            var chromPeakDet = new ChromPeakDetector(0.5, 1);

            var smartchromParam        = new SmartChromPeakSelectorParameters();
            var smartChromPeakSelector = new SmartChromPeakSelector(smartchromParam);

            var basicChromPeakSelector = new BasicChromPeakSelector(new ChromPeakSelectorParameters());



            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            var iterativeTff = new IterativeTFF(new IterativeTFFParameters());

            var fitscoreCalc = new IsotopicProfileFitScoreCalculator();



            var testChromatogramDataFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TargetedWorkflowStandards\massTag635428_chromatogramData.txt";

            var xydata = TestUtilities.LoadXYDataFromFile(testChromatogramDataFile);

            Assert.IsNotNull(xydata);

            run.XYData         = new XYData();
            run.XYData.Xvalues = xydata.Xvalues;
            run.XYData.Yvalues = xydata.Yvalues;
            // run.XYData.Display();

            run.CurrentMassTag = massTagColl.TargetList.Where(p => p.ID == 635428).First();

            Console.WriteLine("------MT = " + run.CurrentMassTag.ToString());

            theorFeatureGen.Execute(run.ResultCollection);
            chromPeakDet.Execute(run.ResultCollection);

            //first run the standard peak selector



            basicChromPeakSelector.Execute(run.ResultCollection);

            var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag);

            Assert.AreEqual(10066, (int)Math.Round(result.ChromPeakSelected.XValue));


            //now run the smart chrom peak selector
            run.XYData         = new XYData();
            run.XYData.Xvalues = xydata.Xvalues;
            run.XYData.Yvalues = xydata.Yvalues;
            chromPeakDet.Execute(run.ResultCollection);
            smartChromPeakSelector.Parameters.NETTolerance = 0.025f;
            smartChromPeakSelector.Parameters.MaxScansSummedInDynamicSumming = 51;
            smartChromPeakSelector.Parameters.SummingMode = SummingModeEnum.SUMMINGMODE_DYNAMIC;
            smartChromPeakSelector.Parameters.AreaOfPeakToSumInDynamicSumming = 1;

            smartChromPeakSelector.Execute(run.ResultCollection);

            msgen.Execute(run.ResultCollection);
            iterativeTff.Execute(run.ResultCollection);
            fitscoreCalc.Execute(run.ResultCollection);


            Console.WriteLine(result.ScanSet);
            Assert.AreEqual(14, result.ScanSet.IndexValues.Count);
            Assert.AreEqual(0.0104m, (decimal)Math.Round(result.Score, 4));
            Assert.AreEqual("9575 {9534, 9540, 9547, 9554, 9561, 9568, 9575, 9582, 9589, 9596, 9603, 9610, 9617, 9624}", result.ScanSet.ToString());

            run.XYData         = new XYData();
            run.XYData.Xvalues = xydata.Xvalues;
            run.XYData.Yvalues = xydata.Yvalues;
            chromPeakDet.Execute(run.ResultCollection);
            smartChromPeakSelector.Parameters.NETTolerance = 0.025f;
            smartChromPeakSelector.Parameters.MaxScansSummedInDynamicSumming = 51;
            smartChromPeakSelector.Parameters.SummingMode = SummingModeEnum.SUMMINGMODE_DYNAMIC;
            smartChromPeakSelector.Parameters.AreaOfPeakToSumInDynamicSumming = 2;

            smartChromPeakSelector.Execute(run.ResultCollection);

            msgen.Execute(run.ResultCollection);
            iterativeTff.Execute(run.ResultCollection);
            fitscoreCalc.Execute(run.ResultCollection);

            result.DisplayToConsole();

            Assert.AreEqual(9579, (int)Math.Round(result.ChromPeakSelected.XValue));
            Assert.AreEqual(0.025m, (decimal)(Math.Round(result.Score, 4)));
            //Console.WriteLine(result.ScanSet);
            Assert.AreEqual(26, result.ScanSet.IndexValues.Count);
            Assert.AreEqual("9575 {9493, 9500, 9506, 9513, 9520, 9527, 9534, 9540, 9547, 9554, 9561, 9568, 9575, 9582, 9589, 9596, 9603, 9610, 9617, 9624, 9631, 9638, 9645, 9652, 9658, 9665}", result.ScanSet.ToString());
        }