示例#1
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();
        }
        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();
        }
示例#3
0
        public void CompareOldAndNew2()
        {
            var newResultsFile =
                @"C:\Users\d3x720\Documents\PNNL\My_DataAnalysis\Standard_Testing\DeconTools\Orbitrap\Test_Results\Version_1.0.XX_Jan6_AfterThrashRefining\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_isos.csv";

            var oldResultsFile =
                @"C:\Users\d3x720\Documents\PNNL\My_DataAnalysis\Standard_Testing\DeconTools\Orbitrap\Test_Results\Version_1.0.4745_Dec28_AfterThrashRefactor\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_isos.csv";

            var importer   = new IsosImporter(newResultsFile, Globals.MSFileType.Finnigan);
            var newResults = importer.Import();

            importer = new IsosImporter(oldResultsFile, Globals.MSFileType.Finnigan);
            var oldResults = importer.Import();

            //newResults = newResults.Where(p => p.ScanSet.PrimaryScanNumber == 6005).ToList();
            //oldResults = oldResults.Where(p => p.ScanSet.PrimaryScanNumber == 6005).ToList();

            var sharedIsos  = new List <IsosResult>();
            var uniqueToNew = new List <IsosResult>();
            var uniqueToOld = new List <IsosResult>();


            GetComparisons(newResults, oldResults, sharedIsos, uniqueToNew, uniqueToOld);


            Console.WriteLine("Summary----------------------------");
            Console.WriteLine("Shared =\t" + sharedIsos.Count);
            Console.WriteLine("Unique to new =\t" + uniqueToNew.Count);
            Console.WriteLine("Unique to old =\t" + uniqueToOld.Count);

            Console.WriteLine("\n--------------Common to new and Old ------------------");
            TestUtilities.DisplayMSFeatures(sharedIsos);


            Console.WriteLine("\n--------------Unique to new ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToNew);

            var outputFilename = @"D:\temp\exportedIsos.csv";
            var exporter       = IsosExporterFactory.CreateIsosExporter(Globals.ResultType.BASIC_TRADITIONAL_RESULT, Globals.ExporterType.Text, outputFilename);

            exporter.ExportIsosResults(uniqueToNew);


            Console.WriteLine("\n--------------Unique to old ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToOld);
        }
示例#4
0
        public void Stolen_CompareOldAndNewDeconvolutorsOrbitrap()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            //string fileName = @"C:\Users\Klin638\Documents\Visual Studio 2010\Backup Files\New folder\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW";
            //@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw";
            //@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\Vorbi\Yellow_C12_099_18Mar10_Griffin_10-01-13.raw";

            //@"C:\Users\Klin638\Documents\Visual Studio 2010\Backup Files\New folder\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW";
            //
            //Run run = RunUtilities.CreateAndLoadPeaks(fileName);
            //Run run = new RunFactory().CreateRun(fileName);

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

            //to sum
            //run.ScanSetCollection.Create(run, 6005, 6005, 5, 1, false);


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



            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = 3;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters);
            //var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters);

            var scanset = new ScanSet(6005);

            //For summing mass spectra:
            //scanset = new ScanSetFactory().CreateScanSet(run, 6005, 5);

            run.CurrentScanSet = scanset;

            var oldDeconvolutor = new HornDeconvolutor();

            oldDeconvolutor.MinPeptideBackgroundRatio = 3;
            oldDeconvolutor.MaxFitAllowed             = 0.4;

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


            //run.PeakList = run.PeakList.Where(p => p.XValue > 634 && p.XValue < 642).ToList();
            //run.DeconToolsPeakList = run.DeconToolsPeakList.Where(p => p.mdbl_mz > 634 && p.mdbl_mz < 642).ToArray();

            run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity;

            newDeconvolutor.Execute(run.ResultCollection);

            //Console.WriteLine("\n--------------New decon ------------------");
            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            var newResults = new List <IsosResult>(run.ResultCollection.ResultList);

            //TestUtilities.DisplayMSFeatures(newResults);
            //return;

            // DisplayPPMErrorsForeachPeakOfMSFeature(newResults);

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

            var oldResults = new List <IsosResult>(run.ResultCollection.ResultList);


            //Console.WriteLine("\n--------------Old decon ------------------");
            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);


            var sharedIsos  = new List <IsosResult>();
            var uniqueToNew = new List <IsosResult>();
            var uniqueToOld = new List <IsosResult>();


            GetComparisons(newResults, oldResults, sharedIsos, uniqueToNew, uniqueToOld);


            Console.WriteLine("\n--------------Common to new and Old ------------------");
            TestUtilities.DisplayMSFeatures(sharedIsos);


            Console.WriteLine("\n--------------Unique to new ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToNew);

            var outputFilename = @"C:\Temp\ThrashTesting\exportedIsos.csv";
            var exporter       = IsosExporterFactory.CreateIsosExporter(run.ResultCollection.ResultType, Globals.ExporterType.Text, outputFilename);

            exporter.ExportIsosResults(uniqueToNew);


            Console.WriteLine("\n--------------Unique to old ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToOld);
        }
示例#5
0
        public void TestAndComparingScottsData()
        {
            var fileName = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw";
            var run      = new RunFactory().CreateRun(fileName);

            run.ScanSetCollection.Create(run, 5509, 5509, 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;//3;
            thrashParameters.MaxFit = 0.4;

            //var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters);
            var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters);

            var scanset = new ScanSet(5509);

            //For summing mass spectra:
            //scanset = new ScanSetFactory().CreateScanSet(run, 6005, 5);

            run.CurrentScanSet = scanset;

            var oldDeconvolutor = new HornDeconvolutor();

            oldDeconvolutor.MinPeptideBackgroundRatio = peakBr;
            oldDeconvolutor.MaxFitAllowed             = 0.4;

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

            //run.PeakList = run.PeakList.Where(p => p.XValue > 634 && p.XValue < 642).ToList();
            //run.DeconToolsPeakList = run.DeconToolsPeakList.Where(p => p.mdbl_mz > 634 && p.mdbl_mz < 642).ToArray();

            run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity;

            newDeconvolutor.Execute(run.ResultCollection);

            //Console.WriteLine("\n--------------New decon ------------------");
            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            var newResults = new List <IsosResult>(run.ResultCollection.ResultList);

            //TestUtilities.DisplayMSFeatures(newResults);
            //return;

            // DisplayPPMErrorsForeachPeakOfMSFeature(newResults);

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

            var oldResults = new List <IsosResult>(run.ResultCollection.ResultList);

            //Console.WriteLine("\n--------------Old decon ------------------");
            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            var sharedIsos  = new List <IsosResult>();
            var uniqueToNew = new List <IsosResult>();
            var uniqueToOld = new List <IsosResult>();

            GetComparisons(newResults, oldResults, sharedIsos, uniqueToNew, uniqueToOld);
            var scottsData      = GetScottsData();
            var scottsDataArray = scottsData.ToArray();

            GetScottComparisons(sharedIsos, uniqueToNew, uniqueToOld, scottsDataArray);

            Console.WriteLine("\n--------------Common to new and Old ------------------");
            TestUtilities.DisplayMSFeatures(sharedIsos);

            Console.WriteLine("\n--------------Unique to new ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToNew);

            var outputFilename = @"C:\Temp\ThrashTesting\exportedIsos.csv";
            var exporter       = IsosExporterFactory.CreateIsosExporter(run.ResultCollection.ResultType, Globals.ExporterType.Text, outputFilename);

            exporter.ExportIsosResults(uniqueToNew);

            Console.WriteLine("\n--------------Unique to old ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToOld);
        }
示例#6
0
        public void CompareOldAndNewDeconvolutorsOrbitrap()
        {
            Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

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

            //to sum
            run.ScanSetCollection.Create(run, 6005, 6005, 5, 1, false);


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



            var thrashParameters = new ThrashParameters();

            thrashParameters.MinMSFeatureToBackgroundRatio = 3;
            thrashParameters.MaxFit = 0.4;

            var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters);

            var scanset = new ScanSet(6005);

            //For summing mass spectra:
            //scanset = new ScanSetFactory().CreateScanSet(run, 6005, 5);

            run.CurrentScanSet = scanset;

            var oldDeconvolutor = new HornDeconvolutor();

            oldDeconvolutor.MinPeptideBackgroundRatio = 3;
            oldDeconvolutor.MaxFitAllowed             = 0.4;

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


            //run.PeakList = run.PeakList.Where(p => p.XValue > 634 && p.XValue < 642).ToList();
            //run.DeconToolsPeakList = run.DeconToolsPeakList.Where(p => p.mdbl_mz > 634 && p.mdbl_mz < 642).ToArray();

            run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity;

            newDeconvolutor.Execute(run.ResultCollection);

            //Console.WriteLine("\n--------------New decon ------------------");
            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);

            var newResults = new List <IsosResult>(run.ResultCollection.ResultList);

            //TestUtilities.DisplayMSFeatures(newResults);
            //return;

            // DisplayPPMErrorsForeachPeakOfMSFeature(newResults);

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

            var oldResults = new List <IsosResult>(run.ResultCollection.ResultList);


            //Console.WriteLine("\n--------------Old decon ------------------");
            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);


            var sharedIsos  = new List <IsosResult>();
            var uniqueToNew = new List <IsosResult>();
            var uniqueToOld = new List <IsosResult>();


            GetComparisons(newResults, oldResults, sharedIsos, uniqueToNew, uniqueToOld);


            Console.WriteLine("\n--------------Common to new and Old ------------------");
            TestUtilities.DisplayMSFeatures(sharedIsos);


            Console.WriteLine("\n--------------Unique to new ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToNew);

            var diOutputFolder = new DirectoryInfo(@"C:\Temp\ThrashTesting");

            if (!diOutputFolder.Exists)
            {
                diOutputFolder.Create();
            }

            var outputFilename = Path.Combine(diOutputFolder.FullName, "exportedIsos.csv");
            var exporter       = IsosExporterFactory.CreateIsosExporter(run.ResultCollection.ResultType, Globals.ExporterType.Text, outputFilename);

            exporter.ExportIsosResults(uniqueToNew);


            Console.WriteLine("\n--------------Unique to old ------------------");
            TestUtilities.DisplayMSFeatures(uniqueToOld);
        }