예제 #1
0
        public void SpeedTest1()
        {
            var fileName = @"D:\Data\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW";
            var run      = new RunFactory().CreateRun(fileName);

            run.ScanSetCollection.Create(run, 5500, 5550, 1, 1, false);
            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            var peakBr       = 0.5;
            var peakDetector = new DeconToolsPeakDetectorV2(peakBr, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = peakBr;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters);

            var watch = new Stopwatch();

            watch.Start();
            foreach (var scanSet in run.ScanSetCollection.ScanSetList)
            {
                run.CurrentScanSet = scanSet;
                msgen.Execute(run.ResultCollection);
                peakDetector.Execute(run.ResultCollection);
                run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity;
                newDeconvolutor.Execute(run.ResultCollection);
            }
            watch.Stop();

            Console.WriteLine("Time per scan = " + watch.ElapsedMilliseconds / run.ScanSetCollection.ScanSetList.Count);
        }
        public void PeakDetectorOnCentroidedDataTest1()
        {
            var run = new RunFactory().CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var scan = new ScanSet(6006);   //this is a centroided MS2 scan


            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(0, 0, Globals.PeakFitType.QUADRATIC, true);

            peakDetector.RawDataType       = Globals.RawDataType.Centroided;
            peakDetector.IsDataThresholded = true;

            run.CurrentScanSet = scan;

            msgen.Execute(run.ResultCollection);

            peakDetector.Execute(run.ResultCollection);

            Console.WriteLine("Num XY datapoints in mass spectrum= " + run.XYData.Xvalues.Length);
            Console.WriteLine("numPeaks = " + run.PeakList.Count);

            Assert.AreEqual(run.XYData.Xvalues.Length, run.PeakList.Count);
            //TestUtilities.DisplayXYValues(run.XYData);
            //TestUtilities.DisplayPeaks(run.PeakList);
        }
        public void CheckBackgroundIntensityTest1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var scan = new ScanSet(6005);

            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2();

            peakDetector.PeakToBackgroundRatio  = 1.3;
            peakDetector.SignalToNoiseThreshold = 2;
            peakDetector.PeakFitType            = Globals.PeakFitType.QUADRATIC;
            peakDetector.IsDataThresholded      = true;


            var oldPeakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            peakDetector.IsDataThresholded = true;

            run.CurrentScanSet = scan;
            msgen.Execute(run.ResultCollection);

            peakDetector.Execute(run.ResultCollection);
            oldPeakDetector.Execute(run.ResultCollection);

            //Assert.AreEqual(peakDetector.BackgroundIntensity, oldPeakDetector.BackgroundIntensity);
        }
예제 #4
0
        //public override WorkflowParameters WorkflowParameters
        //{
        //    get
        //    {
        //        throw new NotImplementedException();
        //    }
        //    set
        //    {
        //        throw new NotImplementedException();
        //    }
        //}


        public void InitializeWorkflow()
        {
            NumMSScansToSumWhenBuildingMasterPeakList = 3;

            MasterPeakListPeakDetector = new DeconToolsPeakDetectorV2();
            MasterPeakListPeakDetector.PeakToBackgroundRatio  = 4;
            MasterPeakListPeakDetector.SignalToNoiseThreshold = 3;
            MasterPeakListPeakDetector.IsDataThresholded      = false;
            MasterPeakListPeakDetector.PeaksAreStored         = true;


            msgen = MSGeneratorFactory.CreateMSGenerator(DeconTools.Backend.Globals.MSFileType.PNNL_UIMF);



            this.DriftTimeProfileExtractionPPMTolerance = 15;

            this.ChromSmoother     = new SavitzkyGolaySmoother(23, 2);
            this.ChromPeakDetector = new ChromPeakDetector(0.5, 0.5);


            this.ChromGenerator = new ChromatogramGenerator();

            processedMSPeaks = new List <MSPeakResult>();
        }
예제 #5
0
        public void MSGeneratorOnUIMFTest1()
        {
            var uimfFile = FileRefs.RawDataMSFiles.UIMFStdFile3;

            var run          = new RunFactory().CreateRun(uimfFile);
            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true);
            var zeroFiller   = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3);

            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = 1;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters);

            var testLCScan       = 500;
            var testIMSScan      = 120;
            var numIMSScanSummed = 7;
            var lowerIMSScan     = testIMSScan - (numIMSScanSummed - 1) / 2;
            var upperIMSScan     = testIMSScan + (numIMSScanSummed - 1) / 2;

            var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1);

            run.CurrentScanSet = scanSet;
            ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan);

            msgen.Execute(run.ResultCollection);

            Assert.IsTrue(run.XYData.Xvalues.Length > 100);
        }
예제 #6
0
        public void Test1()
        {
            double featureFinderTol = 15;
            var    featureFinderRequiresMonoPeak = false;

            var n14n15Util = new N14N15TestingUtilities();
            //get MS
            var massSpectrum = n14n15Util.GetSpectrumAMTTag23140708_Z3_Sum3();  //this is the diff b/w previous test and this one


            var mt23140708 = n14n15Util.CreateMT23140708_Z3();


            var featureGen2 = new JoshTheorFeatureGenerator();

            featureGen2.GenerateTheorFeature(mt23140708);



            //get ms peaks
            var peakDet    = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, false);
            var msPeakList = peakDet.FindPeaks(massSpectrum, 0, 0);

            var bff        = new BasicTFF(featureFinderTol, featureFinderRequiresMonoPeak);
            var n14Profile = bff.FindMSFeature(msPeakList, mt23140708.IsotopicProfile);

            var theorXYData = mt23140708.IsotopicProfile.GetTheoreticalIsotopicProfileXYData(n14Profile.GetFWHM());


            var    theorMaxY = theorXYData.Yvalues.Max();
            double obsMaxY   = n14Profile.getMostIntensePeak().Height;


            for (var i = 0; i < theorXYData.Xvalues.Length; i++)
            {
                theorXYData.Yvalues[i] = theorXYData.Yvalues[i] * obsMaxY;
            }

            offsetDistribution(theorXYData, mt23140708.IsotopicProfile, n14Profile);


            var subtracted = XYDataUtilities.SubtractXYData(massSpectrum, theorXYData, n14Profile.MonoPeakMZ - 1,
                                                            n14Profile.MonoPeakMZ + 3, 0.01);



            var outputFileMS           = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TextFile\massSpectrum1.txt";
            var outputFileMSSubtracted = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TextFile\massSpectrum1_withDataSubtracted.txt";

            TestUtilities.WriteToFile(massSpectrum, outputFileMS);
            TestUtilities.WriteToFile(subtracted, outputFileMSSubtracted);



            // XYDataUtilities.NormalizeXYData()
        }
예제 #7
0
        public void Test1()
        {
            var peakAssociator = new PeakToMSFeatureAssociator();


            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var scanSet = new ScanSet(6005);

            run.CurrentScanSet = scanSet;


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

            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var decon = new HornDeconvolutor();


            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);

            peakAssociator.Execute(run.ResultCollection);

            var numPeaksAssociatedWithFeatures = 0;

            foreach (var msfeature in run.ResultCollection.ResultList)
            {
                foreach (var peak in msfeature.IsotopicProfile.Peaklist)
                {
                    numPeaksAssociatedWithFeatures++;
                }
            }


            var numPeaksInPeakListWithAssociations = 0;

            foreach (MSPeak peak in run.PeakList)
            {
                Console.WriteLine(peak.MSFeatureID + "\t" + peak.XValue + "\t" + peak.Height + "\t");

                if (peak.MSFeatureID != -1)
                {
                    numPeaksInPeakListWithAssociations++;
                }
            }

            //I don't think I can assume this...  msfeature1 might overlap and share a peak with msfeature2
            //Assert.AreEqual(numPeaksAssociatedWithFeatures, numPeaksInPeakListWithAssociations);

            Console.WriteLine("total peaks associated with MSFeatures = " + numPeaksAssociatedWithFeatures);
            Console.WriteLine("total peaks in original peaklist that were associated = " + numPeaksInPeakListWithAssociations);
            Console.WriteLine("fraction peaks assigned = " + (double)(numPeaksInPeakListWithAssociations / (double)run.PeakList.Count));
        }
예제 #8
0
        public void OldDeconvolutorOrbitrapTest1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            run.ScanSetCollection.Create(run, 6005, 6200, 1, 1, false);


            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var deconvolutor = new HornDeconvolutor();

            deconvolutor.MinPeptideBackgroundRatio = 3;


            //deconvolutor.IsMZRangeUsed = true;
            //deconvolutor.MinMZ = 575;
            //deconvolutor.MaxMZ = 585;


            foreach (var scanSet in run.ScanSetCollection.ScanSetList)
            {
                run.CurrentScanSet = scanSet;
                msgen.Execute(run.ResultCollection);
                peakDetector.Execute(run.ResultCollection);

                run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity;

                var stopwatch = new Stopwatch();
                stopwatch.Start();
                deconvolutor.Execute(run.ResultCollection);
                stopwatch.Stop();

                Console.WriteLine("Time for decon= \t" + stopwatch.ElapsedMilliseconds);
            }
            //Assert.AreEqual(93, run.ResultCollection.ResultList.Count);

            ////order and get the most intense msfeature
            //run.ResultCollection.ResultList = run.ResultCollection.ResultList.OrderByDescending(p => p.IsotopicProfile.IntensityAggregate).ToList();
            //IsosResult testIso = run.ResultCollection.ResultList[0];
            //Assert.AreEqual(13084442, testIso.IsotopicProfile.IntensityAggregate);
            //Assert.AreEqual(2, testIso.IsotopicProfile.ChargeState);
            //Assert.AreEqual(0.01012m, (decimal)Math.Round(testIso.IsotopicProfile.Score, 5));
            //Assert.AreEqual(3, testIso.IsotopicProfile.Peaklist.Count);
            //Assert.AreEqual(481.274105402604m, (decimal)testIso.IsotopicProfile.Peaklist[0].XValue);
            //Assert.AreEqual(481.775412188198m, (decimal)testIso.IsotopicProfile.Peaklist[1].XValue);
            //Assert.AreEqual(482.276820274024m, (decimal)testIso.IsotopicProfile.Peaklist[2].XValue);

            //TestUtilities.DisplayIsotopicProfileData(testIso.IsotopicProfile);

            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
            //TestUtilities.DisplayPeaks(run.PeakList);
        }
예제 #9
0
        public void ThrashPreferPlusOneChargeStateTest1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            run.ScanSetCollection.Create(run, 6005, 6005, 1, 1, false);

            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(0.5, 2, Globals.PeakFitType.QUADRATIC, true);

            peakDetector.IsDataThresholded = true;

            var parameters = new ThrashParameters();

            parameters.MinMSFeatureToBackgroundRatio = 1;
            parameters.MaxFit = 0.3;
            parameters.CheckAllPatternsAgainstChargeState1 = true;

            var deconvolutor = new ThrashDeconvolutorV2(parameters);

            var scan = new ScanSet(6005);

            run.CurrentScanSet = scan;
            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);

            run.PeakList = run.PeakList.Where(p => p.XValue > 750 && p.XValue < 753).ToList();


            deconvolutor.Execute(run.ResultCollection);

            Assert.IsTrue(run.ResultCollection.ResultList.Count > 0);
            var result1 = run.ResultCollection.ResultList.First();

            Assert.AreEqual(1, result1.IsotopicProfile.ChargeState);

            Console.WriteLine("--------- Prefer +1 charge state ----------------");
            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            run.ResultCollection.ResultList.Clear();
            run.ResultCollection.IsosResultBin.Clear();

            deconvolutor.Parameters.CheckAllPatternsAgainstChargeState1 = false;
            deconvolutor.Execute(run.ResultCollection);


            Console.WriteLine("\n--------- No charge state bias ----------------");
            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            Assert.IsTrue(run.ResultCollection.ResultList.Count > 0);
            result1 = run.ResultCollection.ResultList.First();

            Assert.AreEqual(3, result1.IsotopicProfile.ChargeState);
        }
        public void ComparePeakFitterVsAreaFitter()
        {
            var massTagFile1 = Path.Combine(FileRefs.RawDataBasePath, "TargetedWorkflowStandards", "QCShew_peptidesWithObsCountGreaterThan1000.txt");

            //load target
            var masstagImporter = new MassTagFromTextFileImporter(massTagFile1);
            var targets         = masstagImporter.Import().TargetList;


            var run = new RunFactory().CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true);



            var scanSet = new ScanSet(9575);

            run.CurrentScanSet = scanSet;

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

            var selectedTarget = targets.First(p => p.ID == 635428 && p.ChargeState == 3);

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

            theorFeatureGen.GenerateTheorFeature(selectedTarget);


            var peakForFWHM = run.PeakList.First(p => p.XValue > 768.38 && p.XValue < 768.39);



            var theorXYdata =
                TheorXYDataCalculationUtilities.GetTheoreticalIsotopicProfileXYData(selectedTarget.IsotopicProfile,
                                                                                    peakForFWHM.Width);

            theorXYdata.NormalizeYData();

            var areaFitter   = new AreaFitter();
            var areaFitScore = areaFitter.GetFit(theorXYdata, run.XYData, 0.1);


            var peakLeastSquaresFitter = new PeakLeastSquaresFitter();
            var peakBasedFitScore      = peakLeastSquaresFitter.GetFit(new List <Peak>(selectedTarget.IsotopicProfile.Peaklist), run.PeakList, 0.1, 25);


            Console.WriteLine("fit score based on XYData = " + areaFitScore);
            Console.WriteLine("fit score based on Peaks= " + peakBasedFitScore);

            Assert.IsTrue(peakBasedFitScore < 0.1);
        }
예제 #11
0
        public ChromPeakAnalyzer(TargetedWorkflowParameters parameters)
        {
            Parameters = parameters;

            var iterativeTffParameters = new IterativeTFFParameters();

            TargetedMSFeatureFinder = new IterativeTFF(iterativeTffParameters);
            InterferenceScorer      = new InterferenceScorer();
            MSPeakDetector          = new DeconToolsPeakDetectorV2();
            FitScoreCalc            = new IsotopicProfileFitScoreCalculator();
            ResultValidator         = new ResultValidatorTask();
        }
예제 #12
0
        public void fitterOnHornDataTest2()
        {
            Run run = new XCaliburRun2(xcaliburTestfile);

            var results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(6005);

            var  isTicRequested = false;
            Task msGen          = new GenericMSGenerator(579, 582, isTicRequested);

            msGen.Execute(results);

            Task peakDetector = new DeconToolsPeakDetectorV2(0.5, 3, Globals.PeakFitType.QUADRATIC, false);

            peakDetector.Execute(results);


            Task decon = new HornDeconvolutor();

            decon.Execute(results);


            var result1    = results.ResultList[1];
            var resolution = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM();

            var distcreator = new MercuryDistributionCreator();

            distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution);
            var sb          = new StringBuilder();
            var theorXYData = distcreator.Data;

            //TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues);



            distcreator.OffsetDistribution(result1.IsotopicProfile);



            TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues);

            //Console.WriteLine(sb.ToString());

            var areafitter = new AreaFitter();
            var fitval     = areafitter.GetFit(theorXYData, run.XYData, 10);

            Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval);
            Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score * 100);

            Assert.AreEqual(0.0763818319332606m, (decimal)fitval);
        }
예제 #13
0
        public void fitterOnHornDataTest1()
        {
            Run run = new XCaliburRun2(xcaliburTestfile);

            var results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(6067);

            var  isTicRequested = false;
            Task msGen          = new GenericMSGenerator(1154, 1158, isTicRequested);

            msGen.Execute(results);

            Task peakDetector = new DeconToolsPeakDetectorV2(0.5, 3, Globals.PeakFitType.QUADRATIC, false);

            peakDetector.Execute(results);

            var deconParameters = new DeconToolsParameters();

            deconParameters.ThrashParameters.MinMSFeatureToBackgroundRatio = 2;     // PeptideMinBackgroundRatio

            Task decon = new HornDeconvolutor(deconParameters);

            decon.Execute(results);


            var result1 = results.ResultList[0];


            var distcreator = new MercuryDistributionCreator();
            var resolution  = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM();

            distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution);
            distcreator.OffsetDistribution(result1.IsotopicProfile);



            var theorXYData = distcreator.Data;

            //StringBuilder sb = new StringBuilder();
            //TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues);

            //Console.WriteLine(sb.ToString());

            var areafitter = new AreaFitter();
            var fitval     = areafitter.GetFit(theorXYData, run.XYData, 10);

            Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval);
            Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score);

            Assert.AreEqual(0.0207350903681061m, (decimal)fitval);    //TODO: fix this test... i'm getting 0.0207350903681061m
        }
예제 #14
0
        public void fitterOnRapidDataTest1()
        {
            Run run = new XCaliburRun2(xcaliburTestfile);

            ResultCollection results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(6067);

            bool isTicRequested = false;
            Task msGen          = new GenericMSGenerator(1154, 1158, isTicRequested);

            msGen.Execute(results);

            DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detectorParams.PeakBackgroundRatio    = 0.5;
            detectorParams.PeakFitType            = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;
            detectorParams.SignalToNoiseThreshold = 3;
            detectorParams.ThresholdedData        = false;

            Task peakDetector = new DeconToolsPeakDetectorV2(detectorParams);

            peakDetector.Execute(results);


            Task decon = new RapidDeconvolutor();

            decon.Execute(results);


            IsosResult result1    = results.ResultList[0];
            double     resolution = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM();


            MercuryDistributionCreator distcreator = new MercuryDistributionCreator();

            distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution);
            distcreator.OffsetDistribution(result1.IsotopicProfile);



            XYData theorXYData = distcreator.Data;

            // theorXYData.Display();

            AreaFitter areafitter = new AreaFitter();
            double     fitval     = areafitter.GetFit(theorXYData, run.XYData, 10);

            Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval);
            Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score * 100);

            Assert.AreEqual(0.0207350903681061m, (decimal)fitval);
        }
예제 #15
0
        public void ValidateDataTest_temp()    //purpose is to compare
        {
            var testMz5File    = @"C:\Sipper\SipperDemo\RawDataFiles\Yellow_C13_070_23Mar10_Griffin_10-01-28.mz5";
            var testThermoFile =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28.raw";

            var mz5run = new RunFactory().CreateRun(testMz5File);

            mz5run.IsDataThresholded = true;

            var thermoRun = new RunFactory().CreateRun(testThermoFile);

            var testScanMz5    = 6010;
            var testScanThermo = 6011;

            var testScanSet1      = new ScanSet(testScanMz5);
            var testScanSetThermo = new ScanSet(testScanThermo);

            mz5run.CurrentScanSet    = testScanSet1;
            thermoRun.CurrentScanSet = testScanSetThermo;


            mz5run.GetMassSpectrum(testScanSet1);
            thermoRun.GetMassSpectrum(testScanSetThermo);


            Assert.AreEqual(mz5run.XYData.Xvalues.Length, thermoRun.XYData.Xvalues.Length);

            for (var i = 0; i < mz5run.XYData.Xvalues.Length; i++)
            {
                Assert.AreEqual(mz5run.XYData.Xvalues[i], thermoRun.XYData.Xvalues[i]);
            }

            var peakDetector = new DeconToolsPeakDetectorV2();

            peakDetector.PeakToBackgroundRatio  = 3;
            peakDetector.SignalToNoiseThreshold = 2;



            peakDetector.Execute(mz5run.ResultCollection);

            //peakDetector.Execute(thermoRun.ResultCollection);


            TestUtilities.DisplayPeaks(mz5run.PeakList);

            Console.WriteLine();
            Console.WriteLine();

            // TestUtilities.DisplayPeaks(thermoRun.PeakList);
        }
예제 #16
0
        public void CompareToScottsData1()
        {
            var fileName = FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var run      = new RunFactory().CreateRun(fileName);

            run.ScanSetCollection.Create(run, 5509, 5509, 1, 1, false);
            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            var peakBr       = 1.9;//1.3;
            var peakDetector = new DeconToolsPeakDetectorV2(peakBr, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = peakBr;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters);

            var scanset = new ScanSet(5509);

            run.CurrentScanSet = scanset;

            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity;
            newDeconvolutor.Execute(run.ResultCollection);


            var scottMzVals = ReadScottsAnnotationsScan5509().ToArray();

            var myMzVals = run.ResultCollection.ResultList.Select(p => p.IsotopicProfile.MonoPeakMZ).OrderBy(p => p).ToArray();

            var comparisions = new Dictionary <decimal, double>();

            foreach (var scottVal in scottMzVals)
            {
                var tolerance     = 0.01;
                var indexInThrash = MathUtils.BinarySearchWithTolerance(myMzVals, scottVal, 0, myMzVals.Length - 1, tolerance);

                var myMzVal = indexInThrash == -1 ? 0.0d : myMzVals[indexInThrash];
                comparisions.Add((decimal)scottVal, myMzVal);
            }

            var numCorrect = comparisions.Values.Count(p => p > 0);

            var numMissing = scottMzVals.Count() - numCorrect;

            Console.WriteLine("Total annotated= \t" + scottMzVals.Count());
            Console.WriteLine("Number correct = \t" + numCorrect);
            Console.WriteLine("Number missing = \t" + numMissing);
        }
예제 #17
0
        public void n14N15LabelledData_TFFTest1()
        {
            double featureFinderTol = 15;
            var    featureFinderRequiresMonoPeak = false;

            var n14n15Util = new N14N15TestingUtilities();
            //get sample MS from Test Data
            var massSpectrum = n14n15Util.GetSpectrumAMTTag23140708_Z3_Sum3();  //this is the diff b/w previous test and this one
            var mt23140708   = n14n15Util.CreateMT23140708_Z3();


            //get ms peaks
            var peakDet    = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, false);
            var msPeakList = peakDet.FindPeaks(massSpectrum, 0, 0);

            //TestUtilities.DisplayPeaks(msPeakList);

            //generate theor unlabelled profile
            var unlabelledfeatureGen = new TomTheorFeatureGenerator();

            unlabelledfeatureGen.GenerateTheorFeature(mt23140708);

            //generate theor N15-labelled profile
            var n15featureGen = new TomTheorFeatureGenerator(Globals.LabellingType.N15, 0.005);

            n15featureGen.GenerateTheorFeature(mt23140708);


            //find features in experimental data, using the theoretical profiles
            var msfeatureFinder = new BasicTFF();

            msfeatureFinder.ToleranceInPPM       = featureFinderTol;
            msfeatureFinder.NeedMonoIsotopicPeak = featureFinderRequiresMonoPeak;

            var n14profile = msfeatureFinder.FindMSFeature(msPeakList, mt23140708.IsotopicProfile);
            var n15profile = msfeatureFinder.FindMSFeature(msPeakList, mt23140708.IsotopicProfileLabelled);

            Console.WriteLine(mt23140708.GetEmpiricalFormulaFromTargetCode());


            TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfile);

            Console.WriteLine();
            TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfileLabelled);

            Console.WriteLine();
            TestUtilities.DisplayIsotopicProfileData(n14profile);

            Console.WriteLine();
            TestUtilities.DisplayIsotopicProfileData(n15profile);
        }
        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();
        }
예제 #19
0
        public void ValidateDataTest1()    //purpose is to compare
        {
            var testMz5File    = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\mzXML\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.mz5";
            var testThermoFile = FileRefs.RawDataMSFiles.OrbitrapStdFile1;

            var mz5run = new RunFactory().CreateRun(testMz5File);

            var thermoRun = new RunFactory().CreateRun(testThermoFile);

            var testScanMz5    = 6004;
            var testScanThermo = 6005;

            var testScanSet1      = new ScanSet(testScanMz5);
            var testScanSetThermo = new ScanSet(testScanThermo);

            mz5run.CurrentScanSet    = testScanSet1;
            thermoRun.CurrentScanSet = testScanSetThermo;


            mz5run.XYData    = mz5run.GetMassSpectrum(testScanSet1);
            thermoRun.XYData = thermoRun.GetMassSpectrum(testScanSetThermo);


            Assert.AreEqual(mz5run.XYData.Xvalues.Length, thermoRun.XYData.Xvalues.Length);

            for (var i = 0; i < mz5run.XYData.Xvalues.Length; i++)
            {
                Assert.AreEqual(mz5run.XYData.Xvalues[i], thermoRun.XYData.Xvalues[i]);
            }

            var peakDetector = new DeconToolsPeakDetectorV2();

            peakDetector.PeakToBackgroundRatio  = 3;
            peakDetector.SignalToNoiseThreshold = 2;

            //peakDetector.Execute(mz5run.ResultCollection);

            peakDetector.Execute(thermoRun.ResultCollection);


            //TestUtilities.DisplayPeaks(mz5run.PeakList);

            Console.WriteLine();
            Console.WriteLine();

            TestUtilities.DisplayPeaks(thermoRun.PeakList);
        }
        public void peak_interference_weakFeature_test1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var scanSet = new ScanSet(6005);

            run.CurrentScanSet = scanSet;

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


            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var decon = new HornDeconvolutor();


            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);

            Assert.AreEqual(93, run.ResultCollection.ResultList.Count);

            var testResult = run.ResultCollection.ResultList.Where(p => p.IsotopicProfile.MonoPeakMZ > 597 && p.IsotopicProfile.MonoPeakMZ < 598).First();

            var monoPeak = testResult.IsotopicProfile.getMonoPeak();
            var lastPeak = testResult.IsotopicProfile.Peaklist[testResult.IsotopicProfile.Peaklist.Count - 1];

            var startIndexOfXYData = MathUtils.BinarySearchWithTolerance(run.XYData.Xvalues, monoPeak.XValue - 3, 0, (run.XYData.Xvalues.Length - 1), 2);

            //interference scorer

            var interferenceScorer = new InterferenceScorer();

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            var scanPeaks         = run.PeakList.Select <Peak, MSPeak>(i => (MSPeak)i).ToList();
            var interferenceScore = interferenceScorer.GetInterferenceScore(scanPeaks, testResult.IsotopicProfile.Peaklist, monoPeak.XValue - 1.1,
                                                                            lastPeak.XValue + lastPeak.Width);

            stopwatch.Stop();

            Console.WriteLine("interference= " + interferenceScore);
            Console.WriteLine("Time taken = " + stopwatch.ElapsedMilliseconds);
        }
예제 #21
0
        protected override void InitializeProcessingTasks()
        {
            MSGenerator  = MSGeneratorFactory.CreateMSGenerator(Run.MSFileType);
            PeakDetector = PeakDetectorFactory.CreatePeakDetector(NewDeconToolsParameters);


            var moreSensitivePeakToBackgroundRatio = NewDeconToolsParameters.PeakDetectorParameters.PeakToBackgroundRatio / 2;
            var moreSensitiveSigNoiseThresh        = NewDeconToolsParameters.PeakDetectorParameters.SignalToNoiseThreshold;

            _moreSensitiveMS1PeakDetector = new DeconToolsPeakDetectorV2(moreSensitivePeakToBackgroundRatio,
                                                                         moreSensitiveSigNoiseThresh, NewDeconToolsParameters.PeakDetectorParameters.PeakFitType,
                                                                         NewDeconToolsParameters.PeakDetectorParameters.IsDataThresholded);

            _superSensitiveMS1PeakDetector = new DeconToolsPeakDetectorV2(0, 0, NewDeconToolsParameters.PeakDetectorParameters.PeakFitType,
                                                                          NewDeconToolsParameters.PeakDetectorParameters.IsDataThresholded);


            Deconvolutor = DeconvolutorFactory.CreateDeconvolutor(NewDeconToolsParameters);


            //Will initialize these but whether or not they are used are determined elsewhere
            ZeroFiller = new DeconToolsZeroFiller(NewDeconToolsParameters.MiscMSProcessingParameters.ZeroFillingNumZerosToFill);
            Smoother   = new SavitzkyGolaySmoother(NewDeconToolsParameters.MiscMSProcessingParameters.SavitzkyGolayNumPointsInSmooth,
                                                   NewDeconToolsParameters.MiscMSProcessingParameters.SavitzkyGolayOrder);

            FitScoreCalculator = new DeconToolsFitScoreCalculator();

            ResultValidator = new ResultValidatorTask();


            PeakToMSFeatureAssociator = new PeakToMSFeatureAssociator();


            _ms2PeakDetectorForCentroidData = new DeconToolsPeakDetectorV2(0, 0, Globals.PeakFitType.QUADRATIC, true)
            {
                RawDataType = Globals.RawDataType.Centroided
            };


            _ms2PeakDetectorForProfileData = new DeconToolsPeakDetectorV2(NewDeconToolsParameters.PeakDetectorParameters.PeakToBackgroundRatio,
                                                                          NewDeconToolsParameters.PeakDetectorParameters.SignalToNoiseThreshold,
                                                                          NewDeconToolsParameters.PeakDetectorParameters.PeakFitType,
                                                                          NewDeconToolsParameters.PeakDetectorParameters.IsDataThresholded);

            Check.Ensure(Deconvolutor is ThrashDeconvolutorV2, "Error. Currently the DeconMSn workflow only works with the ThrashV2 deconvolutor. Selected deconvolutor= " + Deconvolutor);
        }
        public void interference_allFeaturesInScan_test1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var scanSet = new ScanSet(6005);

            run.CurrentScanSet = scanSet;

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


            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var decon = new HornDeconvolutor();


            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);

            Assert.AreEqual(93, run.ResultCollection.ResultList.Count);

            foreach (var isosResult in run.ResultCollection.ResultList)
            {
                var monoPeak = isosResult.IsotopicProfile.getMonoPeak();
                var lastPeak = isosResult.IsotopicProfile.Peaklist[isosResult.IsotopicProfile.Peaklist.Count - 1];

                var startIndexOfXYData = MathUtils.BinarySearchWithTolerance(run.XYData.Xvalues, monoPeak.XValue - 3, 0, (run.XYData.Xvalues.Length - 1), 2);

                //interference scorer

                var interferenceScorer = new InterferenceScorer();

                var stopwatch = new Stopwatch();
                stopwatch.Start();
                var interferenceScore = interferenceScorer.GetInterferenceScore(run.XYData, isosResult.IsotopicProfile.Peaklist, monoPeak.XValue - 1.1,
                                                                                lastPeak.XValue + lastPeak.Width, startIndexOfXYData);
                stopwatch.Stop();

                Console.WriteLine("interference= \t" + interferenceScore);
            }

            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
        }
예제 #23
0
        public void ThrashV2OnIMSDataTest1()
        {
            var uimfFile =
                @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\UIMF\Sarc_MS2_90_6Apr11_Cheetah_11-02-19.uimf";

            var run          = new RunFactory().CreateRun(uimfFile);
            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true);
            var zeroFiller   = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3);

            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = 1;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters);

            var testLCScan       = 500;
            var testIMSScan      = 120;
            var numIMSScanSummed = 7;
            var lowerIMSScan     = testIMSScan - (numIMSScanSummed - 1) / 2;
            var upperIMSScan     = testIMSScan + (numIMSScanSummed - 1) / 2;

            var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1);

            run.CurrentScanSet = scanSet;
            ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan);

            msgen.Execute(run.ResultCollection);
            zeroFiller.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            newDeconvolutor.Execute(run.ResultCollection);

            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            Assert.IsTrue(run.ResultCollection.ResultList.Count > 0);
            Assert.AreEqual(33, run.ResultCollection.ResultList.Count);

            var result1 = run.ResultCollection.ResultList[0];

            Assert.AreEqual(13084442, (decimal)Math.Round(result1.IntensityAggregate));
            Assert.AreEqual(960.53365m, (decimal)Math.Round(result1.IsotopicProfile.MonoIsotopicMass, 5));
            Assert.AreEqual(2, result1.IsotopicProfile.ChargeState);
        }
        public override void InitializeWorkflow()
        {
            _ms1PeakDetector = new DeconToolsPeakDetectorV2(this._workflowParameters.PeakBR, this._workflowParameters.SigNoiseThreshold,
                                                            this._workflowParameters.PeakFitType, this._workflowParameters.IsDataThresholded);


            _ms2PeakDetectorForProfileData = new DeconToolsPeakDetectorV2(_workflowParameters.MS2PeakDetectorPeakBR,
                                                                          _workflowParameters.MS2PeakDetectorSigNoiseThreshold,
                                                                          _workflowParameters.PeakFitType,
                                                                          _workflowParameters.MS2PeakDetectorDataIsThresholded);


            _ms2PeakDetectorForCentroidedData             = new DeconToolsPeakDetectorV2(0, 0, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);
            _ms2PeakDetectorForCentroidedData.RawDataType = DeconTools.Backend.Globals.RawDataType.Centroided;

            _ms2PeakDetectorForProfileData.PeaksAreStored    = true;
            _ms2PeakDetectorForCentroidedData.PeaksAreStored = true;
            _ms1PeakDetector.PeaksAreStored = true;
        }
예제 #25
0
        public void Stolen_ThrashV2OnOrbitrapTest1()
        {
            //Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var fileName =
                @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw";
            //Run run = RunUtilities.CreateAndLoadPeaks(fileName);
            var run = new RunFactory().CreateRun(fileName);

            run.ScanSetCollection.Create(run, 6005, 6005, 1, 1, false);

            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true);

            peakDetector.IsDataThresholded = true;

            var parameters = new ThrashParameters();

            parameters.MinMSFeatureToBackgroundRatio = 1;
            parameters.MaxFit = 0.3;

            var deconvolutor = new InformedThrashDeconvolutor(parameters);
            //var deconvolutor2 = new

            var scan = new ScanSet(6005);

            run.CurrentScanSet = scan;
            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            deconvolutor.Execute(run.ResultCollection);
            Console.WriteLine(run.ResultCollection.MSPeakResultList);
            // TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            Assert.IsTrue(run.ResultCollection.ResultList.Count > 0);
            //Assert.AreEqual(187, run.ResultCollection.ResultList.Count);

            var result1 = run.ResultCollection.ResultList[0];

            Assert.AreEqual(13084442, (decimal)Math.Round(result1.IntensityAggregate));
            Assert.AreEqual(960.53365m, (decimal)Math.Round(result1.IsotopicProfile.MonoIsotopicMass, 5));
            Assert.AreEqual(2, result1.IsotopicProfile.ChargeState);
        }
예제 #26
0
        public void UIMFTesting1()
        {
            var uimfFile =
                @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\UIMF\Sarc_MS2_90_6Apr11_Cheetah_11-02-19.uimf";

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

            var testLCScan  = 500;
            var testIMSScan = 120;

            var numIMSScanSummed = 7;
            var lowerIMSScan     = testIMSScan - (numIMSScanSummed - 1) / 2;
            var upperIMSScan     = testIMSScan + (numIMSScanSummed - 1) / 2;

            var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1);


            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(2, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = 2;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters);


            run.CurrentScanSet = scanSet;
            ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan);

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

            //6	500	728.6907	729.69800	1	34678	0.252	0.000

            run.PeakList = (from n in run.PeakList where n.XValue > 729 && n.XValue < 731 select n).ToList();

            newDeconvolutor.Execute(run.ResultCollection);

            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
        }
        public void OldPeakDetectorTest1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var scan = new ScanSet(6005);


            var msgen        = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            peakDetector.IsDataThresholded = true;

            run.CurrentScanSet = scan;

            msgen.Execute(run.ResultCollection);

            var peaks = peakDetector.FindPeaks(run.XYData, 481.1, 481.4);

            TestUtilities.DisplayPeaks(peaks);
        }
        public SimpleMsViewerViewModel(Run run)
        {
            this.Run = run;

            PeakDetector = new DeconToolsPeakDetectorV2();
            _peakChromatogramGenerator = new PeakChromatogramGenerator();
            Peaks = new List<Peak>();

            //the order matters here. See the properties.
            MSGraphMaxX = 1500;
            MSGraphMinX = 400;
            ChromToleranceInPpm = 20;

            ChromSourcePeakDetectorSigNoise = 2;
            ChromSourcePeakDetectorPeakBr = 3;

            NumMSScansToSum = 1;
            ShowMsMsSpectra = false;

            NavigateToNextMS1MassSpectrum();
        }
        public SaturationIMSScanBasedWorkflow(DeconToolsParameters parameters, Run run, string outputDirectoryPath = null, BackgroundWorker backgroundWorker = null)
            : base(parameters, run, outputDirectoryPath, backgroundWorker)
        {
            Check.Require(run is UIMFRun, "Cannot create workflow. Run is required to be a UIMFRun for this type of workflow");

            PeakBRSaturatedPeakDetector = parameters.PeakDetectorParameters.PeakToBackgroundRatio * 0.75;

            _msGenerator  = new UIMF_MSGenerator();
            _peakDetector = new DeconToolsPeakDetectorV2(5, 3);
            _zeroFiller   = new DeconToolsZeroFiller();

            _deconvolutor = new HornDeconvolutor(parameters)
            {
                MaxFitAllowed             = 0.9,
                MinPeptideBackgroundRatio = _peakDetector.PeakToBackgroundRatio
            };

            AdjustMonoIsotopicMasses = true;

            Run.PeakList = new List <Peak>();
        }
예제 #30
0
        public static List <Peak> GeneratePeakList(ScanSet scanSet)
        {
            Run run = new XCaliburRun2(xcaliburTestfile);

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


            var peakDet = new DeconToolsPeakDetectorV2();

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

            run.CurrentScanSet = scanSet;

            msgen.Execute(run.ResultCollection);

            peakDet.Execute(run.ResultCollection);

            return(run.PeakList);
        }
        public void findMSFeaturesInOrbitrapData_Test1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            ScanSet scanSet = new ScanSet(6005);

            run.CurrentScanSet = scanSet;


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

            DeconToolsPeakDetectorV2 peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            peakDetector.IsDataThresholded = true;

            RapidDeconvolutor decon = new RapidDeconvolutor();

            decon.IsNewFitCalculationPerformed = true;


            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);

            Assert.AreEqual(192, run.ResultCollection.ResultList.Count);

            //order and get the most intense msfeature
            run.ResultCollection.ResultList = run.ResultCollection.ResultList.OrderByDescending(p => p.IntensityAggregate).ToList();
            IsosResult testIso = run.ResultCollection.ResultList[0];

            Assert.AreEqual(20986588.375, testIso.IntensityAggregate);
            Assert.AreEqual(2, testIso.IsotopicProfile.ChargeState);
            Assert.AreEqual(0.00548633562231413m, (decimal)testIso.IsotopicProfile.Score);
            Assert.AreEqual(3, testIso.IsotopicProfile.Peaklist.Count);
            Assert.AreEqual(481.274105402604m, (decimal)testIso.IsotopicProfile.Peaklist[0].XValue);
            Assert.AreEqual(481.775412188198m, (decimal)testIso.IsotopicProfile.Peaklist[1].XValue);
            Assert.AreEqual(482.276820274024m, (decimal)testIso.IsotopicProfile.Peaklist[2].XValue);

            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
        }