public void Test1()
        {
            var rawfilename  = @"D:\Data\O16O18\GlueGrant\GG_MO_Trauma_374020_20May11_Sphinx_11-03-28.RAW";
            var exportedIsos = Path.Combine(Path.GetDirectoryName(rawfilename), Path.GetFileName(rawfilename).Replace(".RAW", "_test_isos.csv"));

            if (File.Exists(exportedIsos))
            {
                File.Delete(exportedIsos);
            }

            var run = new RunFactory().CreateRun(rawfilename);

            run.ResultCollection.ResultType = Backend.Globals.ResultType.O16O18_TRADITIONAL_RESULT;

            run.ScanSetCollection.Create(run, 5000, 5000, 1, 1);


            run.CurrentScanSet = run.ScanSetCollection.ScanSetList[0];

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

            var peakDet = new DeconToolsPeakDetectorV2();

            peakDet.PeakToBackgroundRatio  = 1.3;
            peakDet.SignalToNoiseThreshold = 2;

            var decon = new HornDeconvolutor();

            decon.IsO16O18Data = true;

            var appender = new O16O18PeakDataAppender();

            var exporter = IsosExporterFactory.CreateIsosExporter(run.ResultCollection.ResultType, Backend.Globals.ExporterType.Text, exportedIsos);

            msgen.Execute(run.ResultCollection);
            peakDet.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);
            appender.Execute(run.ResultCollection);

            var testResult = (O16O18IsosResult)run.ResultCollection.ResultList[1];

            Assert.AreEqual(DeconTools.Backend.Globals.ResultType.O16O18_TRADITIONAL_RESULT, run.ResultCollection.ResultType);
            Assert.AreEqual(5905390, testResult.IsotopicProfile.GetMonoAbundance());
            Assert.AreEqual(3017899, testResult.MonoPlus2Abundance);
            Assert.AreEqual(162389, testResult.MonoPlus4Abundance);
            exporter.Execute(run.ResultCollection);

            run.Close();
        }
        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);
        }