예제 #1
0
        public void OldDeconvolutorTest_temp1()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

#if !Disable_DeconToolsV2
            var parameters = new DeconEngineClasses.OldDecon2LSParameters();
            var paramFile  =
                @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\ParameterFiles\LTQ_Orb_SN2_PeakBR1pt3_PeptideBR1_Thrash_MaxFit1.xml";
            parameters.Load(paramFile);

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

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

            var deconvolutor = new HornDeconvolutor(parameters.GetDeconToolsParameters());
            run.CurrentScanSet = scanSet;
            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            deconvolutor.Execute(run.ResultCollection);

            run.ResultCollection.ResultList = run.ResultCollection.ResultList.OrderByDescending(p => p.IntensityAggregate).ToList();

            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            //IsosResult testIso = run.ResultCollection.ResultList[0];

            //TestUtilities.DisplayIsotopicProfileData(testIso.IsotopicProfile);

            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
            //TestUtilities.DisplayPeaks(run.PeakList);
#endif
        }
        public void deconWithTHRASH_Then_ValidateTest1()
        {
            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();
            var validator    = new ResultValidatorTask();

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

            Assert.AreEqual(93, run.ResultCollection.ResultList.Count);
            var testResult = run.ResultCollection.ResultList[0];

            Assert.AreEqual(0.0532199478712594m, (decimal)testResult.InterferenceScore);

            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
        }
        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 PeakDetectorOnCentroidedDataTest2()
        {
            var run = new RunFactory().CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

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


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

            // Note that setting the PeakFitType to Apex will not matter since RawDataType is Centroided
            // It would only matter if the RawDataType was Profile

            var peakDetector = new DeconToolsPeakDetectorV2(0, 0, Globals.PeakFitType.APEX, true);

            peakDetector.RawDataType            = Globals.RawDataType.Centroided;
            peakDetector.SignalToNoiseThreshold = 0;
            peakDetector.PeakToBackgroundRatio  = 0;
            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);
        }
예제 #5
0
        public void test1()
        {
            Run run = new XCaliburRun(bsaO16O18file1);

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

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            O16O18FeatureFinder finder = new O16O18FeatureFinder();


            List <MassTag> massTagList = TestUtilities.CreateO16O18TestMassTagList1();

            run.CurrentMassTag = massTagList[0];

            TomTheorFeatureGenerator theorFeatureGen = new TomTheorFeatureGenerator();

            theorFeatureGen.GenerateTheorFeature(run.CurrentMassTag);

            run.CurrentScanSet = new ScanSet(3294);

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

            IsotopicProfile o16O18profile = finder.FindFeature(run.PeakList, run.CurrentMassTag.IsotopicProfile, 10, true);

            TestUtilities.DisplayIsotopicProfileData(o16O18profile);
        }
        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);
        }
예제 #7
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>();
        }
예제 #8
0
        public void agilentDeconTest1()
        {
            RunFactory runFact = new RunFactory();
            Run        run     = runFact.CreateRun(agilentFile);

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

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

            peakDet.PeakBackgroundRatio = 7;
            peakDet.SigNoiseThreshold   = 3;

            HornDeconvolutor decon    = new HornDeconvolutor();
            ScanSet          scan1821 = new ScanSet(1821);

            run.CurrentScanSet = scan1821;

            msgen.Execute(run.ResultCollection);
            run.XYData = run.XYData.TrimData(450, 520, TODO);

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

            TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
        }
예제 #9
0
        public List <Task> getStandardTaskList(Run run)
        {
            Task peakChromGen = new PeakChromatogramGenerator(chromPPMTolerance);
            Task smoother     = new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(11, 11, 2);
            Task peakDet      = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector(0.5, 0.5);
            Task chromPeakSel = new DeconTools.Backend.ProcessingTasks.ChromPeakSelector(1, 0.01, Globals.PeakSelectorMode.CLOSEST_TO_TARGET);
            MSGeneratorFactory msgenFactory = new MSGeneratorFactory();
            Task msgen = msgenFactory.CreateMSGenerator(run.MSFileType);

            DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 3, false, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC);
            Task mspeakDet       = new DeconToolsPeakDetector(peakParams);
            Task theorFeatureGen = new TomTheorFeatureGenerator();
            Task finder          = new N14N15TFFTask(5);
            Task quant           = new N14N15QuantifierTask(1);
            Task fitScoreCalc    = new IsotopicProfileFitScoreCalculator();

            List <Task> taskList = new List <Task>();

            taskList.Add(peakChromGen);
            taskList.Add(smoother);
            taskList.Add(peakDet);
            taskList.Add(chromPeakSel);
            taskList.Add(msgen);
            taskList.Add(mspeakDet);
            taskList.Add(theorFeatureGen);
            taskList.Add(finder);
            taskList.Add(quant);
            taskList.Add(fitScoreCalc);

            return(taskList);
        }
        public void deconWithRAPID_Then_ValidateTest1()
        {
            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);
            RapidDeconvolutor        decon        = new RapidDeconvolutor();
            ResultValidatorTask      validator    = new ResultValidatorTask();

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

            Assert.AreEqual(190, run.ResultCollection.ResultList.Count);
            IsosResult testResult = run.ResultCollection.ResultList[0];

            Assert.AreEqual(0.0213668719893332m, (decimal)testResult.InterferenceScore);

            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
        }
예제 #11
0
        public void Test1()
        {
            string testfile = @"D:\Data\From_Nicola\AC2_Neg_highpH_14Apr13_Sauron_13-04-03.raw";

            Run run = new RunFactory().CreateRun(testfile);

            TestUtilities.DisplayRunInformation(run);

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

            ScanSet scanSet = new ScanSet(4100);

            run.CurrentScanSet = scanSet;

            msgen.Execute(run.ResultCollection);

            DeconToolsPeakDetectorV2 peakDetector = new DeconToolsPeakDetectorV2();

            peakDetector.Execute(run.ResultCollection);

            run.PeakList = run.PeakList.Where(p => p.XValue > 742 && p.XValue < 749).ToList();

            HornDeconvolutor hornDeconvolutor = new HornDeconvolutor();

            hornDeconvolutor.ChargeCarrierMass = -1.00727649;

            hornDeconvolutor.Execute(run.ResultCollection);

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

            run.ScanSetCollection.Create(run, 6000, 6020, 1, 1, false);

            Task msgen             = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            Task peakDetector      = new DeconToolsPeakDetectorV2();
            Task decon             = new ThrashDeconvolutorV2();
            Task msScanInfoCreator = new ScanResultUpdater();
            Task flagger           = new ResultValidatorTask();

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

                decon.Execute(run.ResultCollection);
                msScanInfoCreator.Execute(run.ResultCollection);
                flagger.Execute(run.ResultCollection);
            }

            return(run);
        }
예제 #13
0
        public void DetectPeaksTest1()
        {
            var    peakBR        = 1.3;
            double sigNoise      = 2;
            var    isThresholded = true;
            var    peakfitType   = DeconTools.Backend.Globals.PeakFitType.QUADRATIC;

            var testFile = FileRefs.RawDataMSFiles.OrbitrapStdFile1;

            Run run = new XCaliburRun2(testFile);

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

            run.CurrentScanSet = new ScanSet(6005);

            msgen.Execute(run.ResultCollection);

            var peakDet = new DeconToolsPeakDetectorV2(peakBR, sigNoise, peakfitType, isThresholded);

            peakDet.PeaksAreStored = true;

            var peakList = peakDet.FindPeaks(run.XYData, 0, 50000);

            TestUtilities.DisplayPeaks(peakList);
        }
예제 #14
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);
        }
예제 #15
0
 public virtual void InitializeRunRelatedTasks()
 {
     if (Run != null)
     {
         MSGenerator = MSGeneratorFactory.CreateMSGenerator(this.Run.MSFileType);
     }
 }
예제 #16
0
        public void SpeedTest1()
        {
            var fileName = FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var run      = new RunFactory().CreateRun(fileName);

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

            var peakBr       = 1.3;//0.25;
            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 (INFORMED) = " + watch.ElapsedMilliseconds / run.ScanSetCollection.ScanSetList.Count);
        }
        public override void InitializeRunRelatedTasks()
        {
            if (Run != null)
            {
                MSGenerator = MSGeneratorFactory.CreateMSGenerator(Run.MSFileType);
                int minLCScan;
                int maxLCScan;

                if (this._workflowParameters.LCScanMax == -1 || this._workflowParameters.LCScanMin == -1)
                {
                    if (Run is UIMFRun)
                    {
                        minLCScan = ((UIMFRun)Run).MinLCScan;
                        maxLCScan = ((UIMFRun)Run).MaxLCScan;
                    }
                    else
                    {
                        minLCScan = Run.MinLCScan;
                        maxLCScan = Run.MaxLCScan;
                    }
                }
                else
                {
                    minLCScan = this._workflowParameters.LCScanMin;
                    maxLCScan = this._workflowParameters.LCScanMax;
                }

                if (Run.MSFileType == DeconTools.Backend.Globals.MSFileType.PNNL_UIMF)
                {
                    var uimfRun = Run as UIMFRun;

                    uimfRun.ScanSetCollection.Create(uimfRun, minLCScan, maxLCScan,
                                                     _workflowParameters.Num_LC_TimePointsSummed, 1,
                                                     _workflowParameters.ProcessMSMS);


                    bool sumAllIMSScans = (_workflowParameters.NumIMSScansSummed == -1 ||
                                           _workflowParameters.NumIMSScansSummed > uimfRun.MaxLCScan);

                    if (sumAllIMSScans)
                    {
                        int primaryIMSScan = Run.MinLCScan;

                        uimfRun.IMSScanSetCollection.ScanSetList.Clear();
                        var imsScanset = new IMSScanSet(primaryIMSScan, uimfRun.MinIMSScan, uimfRun.MaxIMSScan);
                        uimfRun.IMSScanSetCollection.ScanSetList.Add(imsScanset);
                    }
                    else
                    {
                        uimfRun.IMSScanSetCollection.Create(Run, uimfRun.MinIMSScan, uimfRun.MaxIMSScan,
                                                            _workflowParameters.NumIMSScansSummed, 1);
                    }
                }
                else
                {
                    Run.ScanSetCollection.Create(Run, minLCScan, maxLCScan,
                                                 this._workflowParameters.Num_LC_TimePointsSummed, 1, this._workflowParameters.ProcessMSMS);
                }
            }
        }
        public void uimfTest1()
        {
            UIMFRun            run          = new UIMFRun(uimfFile1);
            MSGeneratorFactory msgenFactory = new MSGeneratorFactory();
            Task msgen           = msgenFactory.CreateMSGenerator(run.MSFileType);
            Task peakDetector    = new DeconToolsPeakDetector();
            Task decon           = new HornDeconvolutor();
            Task suspPeakFlagger = new LeftOfMonoPeakLooker();

            run.CurrentFrameSet = new FrameSet(501, 500, 502);
            run.CurrentScanSet  = new ScanSet(250, 246, 254);


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

            foreach (var result in run.ResultCollection.ResultList)
            {
                ((LeftOfMonoPeakLooker)suspPeakFlagger).CurrentResult = result;
                suspPeakFlagger.Execute(run.ResultCollection);
            }


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

            List <IsosResult> flaggedResults = run.ResultCollection.ResultList.Where(p => p.Flags.Count > 0).ToList();

            Assert.AreEqual(13, flaggedResults.Count);

            TestUtilities.DisplayIsotopicProfileData(flaggedResults[0].IsotopicProfile);
            Console.WriteLine();
            TestUtilities.DisplayIsotopicProfileData(flaggedResults[1].IsotopicProfile);
        }
예제 #19
0
        protected virtual void InitializeProcessingTasks()
        {
            MSGenerator  = MSGeneratorFactory.CreateMSGenerator(Run.MSFileType);
            PeakDetector = PeakDetectorFactory.CreatePeakDetector(NewDeconToolsParameters);
            Deconvolutor = DeconvolutorFactory.CreateDeconvolutor(NewDeconToolsParameters);

            //the new iThrash imports the _peaks.txt file
            if (Deconvolutor is DeconTools.Backend.ProcessingTasks.Deconvoluters.InformedThrashDeconvolutor)
            {
                _deconvolutorRequiresPeaksFile = true;
            }

            //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();
            ScanResultUpdater  = new ScanResultUpdater(NewDeconToolsParameters.ScanBasedWorkflowParameters.ProcessMS2);
            ResultValidator    = new ResultValidatorTask();

            IsosResultExporter = IsosExporterFactory.CreateIsosExporter(Run.ResultCollection.ResultType, ExporterType,
                                                                        IsosOutputFileName);

            ScanResultExporter = ScansExporterFactory.CreateScansExporter(Run.MSFileType, ExporterType,
                                                                          ScansOutputFileName);

            if (!_deconvolutorRequiresPeaksFile)
            {
                PeakListExporter = PeakListExporterFactory.Create(ExporterType, Run.MSFileType, PeakListExporterTriggerValue,
                                                                  PeakListOutputFileName);
            }

            PeakToMSFeatureAssociator = new PeakToMSFeatureAssociator();
        }
예제 #20
0
        public void criticalErrorInPeakDetectorTest1()
        {
            UIMFRun run = new DeconTools.Backend.Runs.UIMFRun(fpgaUIMFFilePath2);

            FrameSetCollectionCreator ffcc = new FrameSetCollectionCreator(run, 425, 432, 3, 1);

            ffcc.Create();

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 1, 500, 9, 1);

            sscc.Create();

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

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

            peakDet.PeakBackgroundRatio = 4;
            peakDet.SigNoiseThreshold   = 3;


            foreach (var frame in run.FrameSetCollection.FrameSetList)
            {
                run.CurrentFrameSet = frame;

                foreach (var scan in run.ScanSetCollection.ScanSetList)
                {
                    run.CurrentScanSet = scan;

                    msgen.Execute(run.ResultCollection);
                    peakDet.Execute(run.ResultCollection);
                }
            }
        }
예제 #21
0
        public void DetectPeaksInOrbitrapData()
        {
            var    peakBR        = 1.3;
            double sigNoise      = 2;
            var    isThresholded = true;
            var    peakfitType   = DeconTools.Backend.Globals.PeakFitType.QUADRATIC;

            var testFile = FileRefs.RawDataMSFiles.OrbitrapStdFile1;

            Run run = new XCaliburRun2(testFile);

            //create list of target scansets
            run.ScanSetCollection.Create(run, 6000, 6015, 1, 1);


            //in the 'run' object there is now a list of scans : run.ScanSetCollection
            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);


            var peakDet = new DeconToolsPeakDetectorV2(peakBR, sigNoise, peakfitType, isThresholded);

            peakDet.PeaksAreStored = true;

            foreach (var scan in run.ScanSetCollection.ScanSetList)
            {
                //set the target scan:
                run.CurrentScanSet = scan;

                msgen.Execute(run.ResultCollection);
                peakDet.Execute(run.ResultCollection);
            }
        }
        public void peak_interference_UIMF_expectInterference_test1()
        {
            var uimfFrame1200_142 = FileRefs.RawDataBasePath + @"\UIMF\Sarc_MS_90_21Aug10_Cheetah_10-08-02_0000_frame1200_scan142.txt";

            Run run = new DeconTools.Backend.Runs.MSScanFromTextFileRun(uimfFrame1200_142);

            var scanSet = new ScanSet(0);

            run.CurrentScanSet = scanSet;

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

            msgen.MinMZ = 200;
            msgen.MaxMZ = 2000;

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

            var decon = new HornDeconvolutor();

            decon.MinIntensityForScore     = 10;
            decon.DeleteIntensityThreshold = 10;
            decon.MaxFitAllowed            = 0.4;
            decon.MinMZ         = 200;
            decon.MaxMZ         = 2000;
            decon.IsMZRangeUsed = false;


            var zeroFiller = new DeconToolsZeroFiller();

            msgen.Execute(run.ResultCollection);
            zeroFiller.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 > 428 && p.IsotopicProfile.MonoPeakMZ < 430).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);
        }
예제 #23
0
        public void PeakDetectorDemo1()
        {
            //In this list on Scan 6005 we can see what the peak of the parent is. Slide 4 1059.45898 is the Monoisotopic peak of Scan 6009
            var run = new RunFactory().CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var testScan = new ScanSet(6009);

            run.CurrentScanSet = testScan;

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

            var peakDetector = new DeconToolsPeakDetectorV2();

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

            var sb = new StringBuilder();

            foreach (var peak in run.PeakList)
            {
                sb.Append(peak.XValue + "\t" + peak.Height + "\t" + peak.Width + "\n");
            }

            Console.WriteLine("----------------------PeakList---------------");
            Console.WriteLine("m/z\tintensity\twidth");
            Console.WriteLine(sb.ToString());
        }
예제 #24
0
        public void getMSMSDataTest1()
        {
            //Create the run
            var runFactory = new RunFactory();
            var run        = runFactory.CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            //Create the task
            Task msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            var peakdetector = new DeconToolsPeakDetectorV2();

            var startScan = 6000;
            var stopScan  = 7000;

            for (var i = startScan; i < stopScan; i++)
            {
                if (run.GetMSLevel(i) == 2)
                {
                    var scanset = new ScanSet(i);
                    run.CurrentScanSet = scanset;
                    msgen.Execute(run.ResultCollection);
                    peakdetector.Execute(run.ResultCollection);

                    Console.Write("Working on Scan " + scanset.PrimaryScanNumber);
                    Console.WriteLine("; XYPair count = " + run.XYData.Xvalues.Length);

                    Console.WriteLine("num peaks= " + run.PeakList.Count);
                }
            }
        }
예제 #25
0
        public void createRunAndReadMSSpectraTest1()
        {
            //Create the run
            var runFactory = new RunFactory();
            var run        = runFactory.CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);


            //Create the task
            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            //Create the target scan list (MS1 scans from 6005 - 6020).
            run.ScanSetCollection.Create(run, 6005, 6020, 1, 1);



            //iterate over each scan in the target collection get the mass spectrum
            foreach (var scan in run.ScanSetCollection.ScanSetList)
            {
                Console.WriteLine("Working on Scan " + scan.PrimaryScanNumber);
                run.CurrentScanSet = scan;
                msgen.Execute(run.ResultCollection);

                Console.WriteLine("XYPair count = " + run.XYData.Xvalues.Length);
            }
        }
        public void findMSFeaturesInOrbitrapData_Test1()
        {
            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);

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

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

            Assert.AreEqual(13084442, testIso.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.DisplayMSFeatures(run.ResultCollection.ResultList);
            // TestUtilities.DisplayPeaks(run.PeakList);
        }
예제 #27
0
        public void ZeroFillerCompareNewAndOld()
        {
            Run run        = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_std1);
            var msgen      = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var zeroFiller = new DeconToolsZeroFiller(3);

            msgen.Execute(run.ResultCollection);
            var numZerosToFill = 3;
            var newZeroFilled  = zeroFiller.ZeroFill(run.XYData.Xvalues, run.XYData.Yvalues, numZerosToFill);
            // var oldZeroFilled = zeroFiller.ZeroFillOld(run.XYData.Xvalues, run.XYData.Yvalues, numZerosToFill);


            var lowerMZ = 625.48;
            var upperMZ = 626.18;

            run.XYData    = run.XYData.TrimData(lowerMZ, upperMZ);
            newZeroFilled = newZeroFilled.TrimData(lowerMZ, upperMZ);
            // oldZeroFilled = oldZeroFilled.TrimData(lowerMZ, upperMZ);

            Console.WriteLine("---------- before zerofilling ---------------");
            TestUtilities.DisplayXYValues(run.XYData);

            Console.WriteLine("---------- after zerofilling ---------------");
            TestUtilities.DisplayXYValues(newZeroFilled);

            // Console.WriteLine("---------- after zerofilling using DeconEngine ---------------");
            // TestUtilities.DisplayXYValues(oldZeroFilled);
        }
예제 #28
0
        public void InitializeRunRelatedTasks()
        {
            if (Run != null)
            {
                MSGenerator = MSGeneratorFactory.CreateMSGenerator(Run.MSFileType);
                int minLCScan;
                int maxLCScan;

                if (WorkflowParameters.LCScanMax == -1 || WorkflowParameters.LCScanMin == -1)
                {
                    if (Run is UIMFRun thisUimfRun)
                    {
                        minLCScan = thisUimfRun.MinLCScan;
                        maxLCScan = thisUimfRun.MaxLCScan;
                    }
                    else
                    {
                        minLCScan = Run.MinLCScan;
                        maxLCScan = Run.MaxLCScan;
                    }
                }
                else
                {
                    minLCScan = WorkflowParameters.LCScanMin;
                    maxLCScan = WorkflowParameters.LCScanMax;
                }

                if (Run.MSFileType == Globals.MSFileType.PNNL_UIMF && Run is UIMFRun uimfRun)
                {
                    uimfRun.ScanSetCollection.Create(uimfRun, minLCScan, maxLCScan,
                                                     WorkflowParameters.Num_LC_TimePointsSummed, 1,
                                                     WorkflowParameters.ProcessMSMS);

                    var sumAllIMSScans = WorkflowParameters.NumIMSScansSummed == -1 ||
                                         WorkflowParameters.NumIMSScansSummed > uimfRun.MaxLCScan;

                    if (sumAllIMSScans)
                    {
                        var primaryIMSScan = Run.MinLCScan;

                        uimfRun.IMSScanSetCollection.ScanSetList.Clear();
                        var imsScanSet = new IMSScanSet(primaryIMSScan, uimfRun.MinIMSScan, uimfRun.MaxIMSScan);
                        uimfRun.IMSScanSetCollection.ScanSetList.Add(imsScanSet);
                    }
                    else
                    {
                        uimfRun.IMSScanSetCollection.Create(Run, uimfRun.MinIMSScan, uimfRun.MaxIMSScan,
                                                            WorkflowParameters.NumIMSScansSummed, 1);
                    }
                }
                else
                {
                    Run.ScanSetCollection.Create(Run, minLCScan, maxLCScan,
                                                 WorkflowParameters.Num_LC_TimePointsSummed, 1, WorkflowParameters.ProcessMSMS);
                }
            }
        }
예제 #29
0
        public void checkIntegrityOfUIMF_RawDataTest1()
        {
            UIMFRun run = new DeconTools.Backend.Runs.UIMFRun(fpgaUIMFFilePath2);

            FrameSetCollectionCreator ffcc = new FrameSetCollectionCreator(run, 696, 696, 3, 1);

            ffcc.Create();

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 350, 500, 9, 1);

            sscc.Create();

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

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

            peakDet.PeakBackgroundRatio = 6;
            peakDet.SigNoiseThreshold   = 3;


            StringBuilder sb = new StringBuilder();


            sb.Append("frame\tscan\tmaxIntens\tnumZeros\n");

            foreach (var frame in run.FrameSetCollection.FrameSetList)
            {
                run.CurrentFrameSet = frame;

                foreach (var scan in run.ScanSetCollection.ScanSetList)
                {
                    run.CurrentScanSet = scan;

                    msgen.Execute(run.ResultCollection);

                    List <int> indices = getIndicesOf0MZValues(run.XYData.Xvalues);

                    double maxY = run.XYData.GetMaxY();


                    if (indices.Count > -1)
                    {
                        sb.Append(frame.PrimaryFrame);
                        sb.Append("\t");
                        sb.Append(scan.PrimaryScanNumber);
                        sb.Append("\t");
                        sb.Append(maxY);
                        sb.Append("\t");
                        sb.Append(indices.Count);
                        sb.Append("\n");
                    }
                }
            }

            Console.WriteLine(sb.ToString());
        }
        public void test1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            List <MassTag> mass_tagList = TestUtilities.CreateTestMassTagList();
            MassTag        mt           = mass_tagList[0];

            run.CurrentScanSet = new ScanSet(9017, new int[] { 9010, 9017, 9024 });
            run.CurrentMassTag = mt;


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

            DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 1.3, true, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC);
            Task mspeakDet = new DeconToolsPeakDetector(peakParams);

            Task theorFeatureGen       = new TomTheorFeatureGenerator();
            Task targetedFeatureFinder = new BasicTFF(0.01);

            IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator();

            msgen.Execute(run.ResultCollection);

            //run.XYData.Display();

            mspeakDet.Execute(run.ResultCollection);
            theorFeatureGen.Execute(run.ResultCollection);
            targetedFeatureFinder.Execute(run.ResultCollection);
            fitScoreCalc.Execute(run.ResultCollection);

            MassTagResultBase result = run.ResultCollection.GetMassTagResult(mt);

            TestUtilities.DisplayIsotopicProfileData(result.IsotopicProfile);
            Console.WriteLine("Fit val = " + result.IsotopicProfile.Score);

            /*
             *
             *
             * ------------------- MassTag = 24769---------------------------
             * monoMass = 2086.0595; monoMZ = 1044.0370; ChargeState = 2; NET = 0.452; Sequence = DFNEALVHQVVVAYAANAR
             *
             ****** Match ******
             ******NET =    0.452
             ******ChromPeak ScanNum = 9016.48992535631
             ******ChromPeak NETVal = 0.453
             ******ScanSet = { 9010, 9017, 9024, }
             ******Observed MZ and intensity = 1044.03290771556	1.269842E+07
             ******------------------------------ end --------------------------
             *
             *
             *
             *
             *
             */
        }