コード例 #1
0
        public void weirdZeroValuesForMZsAtEarlyFramesTest1()
        {
            UIMFRun run = new UIMFRun(uimfTestfile1);

            FrameSetCollectionCreator framecreator = new FrameSetCollectionCreator(run, 1, 10, 5, 1);

            framecreator.Create();

            ScanSetCollectionCreator scanCreator = new ScanSetCollectionCreator(run, 1, 1);

            scanCreator.Create();

            Task msgen   = new UIMF_MSGenerator(0, 5000);
            Task peakDet = new DeconToolsPeakDetector();


            int scanstop  = 599;
            int scanstart = 0;

            for (int i = scanstart; i < scanstop; i++)
            {
                run.CurrentFrameSet = run.FrameSetCollection.GetFrameSet(1);
                run.CurrentScanSet  = run.ScanSetCollection.GetScanSet(i);
                msgen.Execute(run.ResultCollection);

                if (run.XYData != null && run.XYData.Xvalues != null && run.XYData.Xvalues[0] == 0)
                {
                    reportXYValues(run);
                }
            }
        }
コード例 #2
0
        public void outputToSqlite_uimf_test1()
        {
            List <Run> runcoll = new List <Run>();
            Run        run     = new UIMFRun(uimfFile1);

            runcoll.Add(run);


            FrameSetCollectionCreator fsc = new FrameSetCollectionCreator(run, 800, 809, 3, 1);

            fsc.Create();

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 200, 220, 9, 1);

            sscc.Create();


            Task msgen              = new UIMF_MSGenerator();
            Task peakDetector       = new DeconToolsPeakDetector();
            Task decon              = new RapidDeconvolutor();
            Task driftTimeExtractor = new DeconTools.Backend.ProcessingTasks.UIMFDriftTimeExtractor();
            Task origIntensExtr     = new DeconTools.Backend.ProcessingTasks.OriginalIntensitiesExtractor();
            Task ticExtractor       = new DeconTools.Backend.ProcessingTasks.UIMF_TICExtractor();

            Task scanResultUpdater = new ScanResultUpdater();


            Task sqliteExporter = new DeconTools.Backend.ProcessingTasks.ResultExporters.ScanResultExporters.UIMFScanResult_SqliteExporter(uimf_Sqlite_ScanResultOutputFile1);

            Stopwatch sw;

            foreach (FrameSet frame in ((UIMFRun)run).FrameSetCollection.FrameSetList)
            {
                ((UIMFRun)run).CurrentFrameSet = frame;
                foreach (ScanSet scan in run.ScanSetCollection.ScanSetList)
                {
                    run.CurrentScanSet = scan;
                    msgen.Execute(run.ResultCollection);
                    peakDetector.Execute(run.ResultCollection);

                    decon.Execute(run.ResultCollection);
                    ticExtractor.Execute(run.ResultCollection);
                    scanResultUpdater.Execute(run.ResultCollection);


                    driftTimeExtractor.Execute(run.ResultCollection);
                    origIntensExtr.Execute(run.ResultCollection);

                    sw = new Stopwatch();
                    sw.Start();

                    sqliteExporter.Execute(run.ResultCollection);
                    sw.Stop();
                    if (sw.ElapsedMilliseconds > 10)
                    {
                        Console.WriteLine("SqliteExporter execution time = \t" + sw.ElapsedMilliseconds);
                    }
                }
            }
        }
コード例 #3
0
        public void serializeUIMFDataTest1()
        {
            Run        run           = new UIMFRun(uimfFilepath2);
            List <Run> runCollection = new List <Run>();

            runCollection.Add(run);

            int startFrame = 1200;
            int stopFrame  = 1205;

            int numFramesSummed = 3;
            int numScansSummed  = 3;


            FrameSetCollectionCreator framesetCreator = new FrameSetCollectionCreator(run, startFrame, stopFrame, numFramesSummed, 1);

            framesetCreator.Create();

            ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(run, numScansSummed, 1);

            scanSetCreator.Create();

            Task msgen = new UIMF_MSGenerator();

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

            Task peakdetector = new DeconToolsPeakDetector(detectorParams);

            Task decon = new RapidDeconvolutor();

            TaskCollection taskcollection = new TaskCollection();

            taskcollection.TaskList.Add(msgen);
            taskcollection.TaskList.Add(peakdetector);
            taskcollection.TaskList.Add(decon);


            TaskController taskcontroller = new UIMF_TaskController(taskcollection);

            taskcontroller.IsosResultThresholdNum = 50;
            taskcontroller.Execute(runCollection);


            ResultCollection       results;
            IsosResultDeSerializer deserializer = new IsosResultDeSerializer(run.Filename + "_tmp.bin");
            int counter = 0;

            do
            {
                counter++;
                results = deserializer.GetNextSetOfResults();
            } while (results != null);

            Assert.AreEqual(8, counter);
        }
コード例 #4
0
        public void uimf_data_preLoaded()        // in this case, data is preloaded, preventing re-accessing the same drifttimes over and over
        {
            Run run = new UIMFRun(uimfFilepath);

            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, 800, 801, 3, 1);

            fscc.Create();

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 220, 270, 9, 1);

            sscc.Create();

            ((UIMFRun)run).GetFrameDataAllFrameSets();    // this is the key line... loads data necessary for drift time calc and correction



            UIMF_MSGenerator       msgen   = new UIMF_MSGenerator();
            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

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

            HornDeconvolutor       decon = new HornDeconvolutor();
            UIMFDriftTimeExtractor driftTimeExtractor = new UIMFDriftTimeExtractor();

            StringBuilder sb = new StringBuilder();

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

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

                    msgen.Execute(run.ResultCollection);
                    peakDet.Execute(run.ResultCollection);
                    decon.Execute(run.ResultCollection);
                    driftTimeExtractor.Execute(run.ResultCollection);
                }
            }

            foreach (var item in run.ResultCollection.ResultList)
            {
                UIMFIsosResult isosresult = (UIMFIsosResult)item;

                sb.Append(isosresult.FrameSet.PrimaryFrame);
                sb.Append("\t");
                sb.Append(isosresult.ScanSet.PrimaryScanNumber);
                sb.Append("\t");
                sb.Append(isosresult.IsotopicProfile.MonoPeakMZ.ToString("0.000"));
                sb.Append("\t");
                sb.Append(isosresult.DriftTime.ToString("0.000"));
                sb.Append(Environment.NewLine);
            }

            Console.Write(sb.ToString());
        }
コード例 #5
0
        public void uimf_data_not_preLoaded()        // in this case the drift time is calculated every time by looking up sqlite data from uimf file
        {
            Run run = new UIMFRun(uimfFilepath);

            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, 800, 801, 3, 1);

            fscc.Create();

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 220, 270, 9, 1);

            sscc.Create();



            UIMF_MSGenerator       msgen   = new UIMF_MSGenerator();
            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

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

            HornDeconvolutor       decon = new HornDeconvolutor();
            UIMFDriftTimeExtractor driftTimeExtractor = new UIMFDriftTimeExtractor();

            StringBuilder sb = new StringBuilder();

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

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

                    msgen.Execute(run.ResultCollection);
                    peakDet.Execute(run.ResultCollection);
                    decon.Execute(run.ResultCollection);
                    driftTimeExtractor.Execute(run.ResultCollection);
                }
            }

            foreach (var item in run.ResultCollection.ResultList)
            {
                UIMFIsosResult isosresult = (UIMFIsosResult)item;

                sb.Append(isosresult.FrameSet.PrimaryFrame);
                sb.Append("\t");
                sb.Append(isosresult.ScanSet.PrimaryScanNumber);
                sb.Append("\t");
                sb.Append(isosresult.IsotopicProfile.MonoPeakMZ.ToString("0.000"));
                sb.Append("\t");
                sb.Append(isosresult.DriftTime.ToString("0.000"));
                sb.Append(Environment.NewLine);
            }

            Console.Write(sb.ToString());
        }
コード例 #6
0
        public void test1_summing()
        {
            Project.Reset();
            Project project = Project.getInstance();

            UIMFRun run = new UIMFRun(uimfFilepath, 1201, 1201);

            project.RunCollection.Add(run);

            int numFramesSummed = 3;
            int numScansSummed  = 3;

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 250, 270, numScansSummed, 1);

            sscc.Create();

            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, run.MinFrame, run.MaxFrame, numFramesSummed, 1);

            fscc.Create();

            Task msGen = new UIMF_MSGenerator(200, 2000);

            DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detectorParams.PeakBackgroundRatio    = 3;
            detectorParams.PeakFitType            = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;
            detectorParams.SignalToNoiseThreshold = 3;
            Task peakDetector = new DeconToolsPeakDetector(detectorParams);

            Task decon = new HornDeconvolutor();

            Task scanResultsUpdater = new ScanResultUpdater();

            Task originalIntensitiesExtractor = new OriginalIntensitiesExtractor();


            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(decon);
            project.TaskCollection.TaskList.Add(scanResultsUpdater);
            project.TaskCollection.TaskList.Add(originalIntensitiesExtractor);

            TaskController controller = new UIMF_TaskController(project.TaskCollection);

            controller.Execute(project.RunCollection);

            ResultCollection rc = project.RunCollection[0].ResultCollection;

            Assert.AreEqual(180, rc.ResultList.Count);

            StringBuilder sb = new StringBuilder();

            IsosResultUtilities.DisplayResults(sb, rc.ResultList);
            Console.Write(sb.ToString());
        }
コード例 #7
0
        public void multipleFrames_horn_test1()
        {
            Project.Reset();
            Project project = Project.getInstance();

            project.LoadOldDecon2LSParameters(uimfParameters1);

            UIMFRun run = new UIMFRun(uimfFilepath, 1201, 1203);

            project.RunCollection.Add(run);

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

            sscc.Create();

            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, run.MinFrame, run.MaxFrame, 1, 1);

            fscc.Create();

            Task msGen      = new UIMF_MSGenerator(0, 5000);
            Task zeroFiller = new DeconToolsZeroFiller(3);

            Task peakDetector = new DeconToolsPeakDetector(project.Parameters.OldDecon2LSParameters.PeakProcessorParameters);

            Task decon = new HornDeconvolutor(project.Parameters.OldDecon2LSParameters.HornTransformParameters);

            Task scanResultsUpdater = new ScanResultUpdater();

            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(zeroFiller);

            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(decon);
            project.TaskCollection.TaskList.Add(scanResultsUpdater);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            TaskController controller = new UIMF_TaskController(project.TaskCollection);

            controller.Execute(project.RunCollection);
            sw.Stop();

            Console.WriteLine("Time required (ms) = " + sw.ElapsedMilliseconds);
            Console.WriteLine("Scans analyzed = " + project.RunCollection[0].ScanSetCollection.ScanSetList.Count);
            Console.WriteLine("Features found = " + project.RunCollection[0].ResultCollection.ResultList.Count);
            Console.WriteLine("Peaks found = " + project.RunCollection[0].ResultCollection.ScanResultList[0].NumPeaks);



            StringBuilder sb = new StringBuilder();
        }
コード例 #8
0
        public void examineFPGAFileTest1()
        {
            UIMFRun run = new UIMFRun(uimfFPGAFilePath);

            Task msGen = new UIMF_MSGenerator(200, 2000);

            DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detectorParams.PeakBackgroundRatio    = 3;
            detectorParams.PeakFitType            = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;
            detectorParams.SignalToNoiseThreshold = 3;
            Task peakDetector = new DeconToolsPeakDetector(detectorParams);

            Task decon = new HornDeconvolutor();

            Task scanResultsUpdater = new ScanResultUpdater();

            Task originalIntensitiesExtractor = new OriginalIntensitiesExtractor();



            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 300, 300, 1, 1);

            sscc.Create();


            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, 5, 5, 1, 1);

            fscc.Create();

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

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

                    msGen.Execute(run.ResultCollection);

                    //TestUtilities.DisplayXYValues(run.XYData);

                    originalIntensitiesExtractor.Execute(run.ResultCollection);
                    TestUtilities.DisplayXYValues(run.XYData);
                }
            }
        }
コード例 #9
0
        public void GenerateUIMFSpectrumTest2()
        {
            Run run = new UIMFRun(uimfTestfile1);
            ResultCollection results = new ResultCollection(run);

            run.CurrentScanSet    = new ScanSet(300);
            run.ScanSetCollection = new ScanSetCollection();
            run.ScanSetCollection.ScanSetList.Add(run.CurrentScanSet);

            ((UIMFRun)run).CurrentFrameSet = new FrameSet(1206);

            Task msGen = new UIMF_MSGenerator(200, 2000);

            msGen.Execute(results);

            Assert.AreEqual(578, results.Run.XYData.Xvalues.Length);
            Assert.AreEqual(578, results.Run.XYData.Yvalues.Length);
        }
コード例 #10
0
        public void test1()
        {
            Project project = Project.getInstance();
            //TODO:  add project parameters  (for summing)

            Run run = new UIMFRun(uimfFilepath, 1200, 1202, 300, 400);

            project.RunCollection.Add(run);

            FrameSetCollectionCreator framesetCreator = new FrameSetCollectionCreator(run, ((UIMFRun)run).MinFrame, ((UIMFRun)run).MaxFrame, 1, 1);

            framesetCreator.Create();

            ScanSetCollectionCreator scanSetcreator = new ScanSetCollectionCreator(run, run.MinScan, run.MaxScan, 1, 1, false);

            scanSetcreator.Create();

            Task msGen = new UIMF_MSGenerator(200, 2000);

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

            Task rapidDecon = new RapidDeconvolutor();

            Task scanresultUpdater = new ScanResultUpdater();


            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(rapidDecon);
            project.TaskCollection.TaskList.Add(scanresultUpdater);

            TaskController controller = new UIMF_TaskController(project.TaskCollection);

            controller.Execute(project.RunCollection);

            UIMFScansExporter scansExporter = new UIMFScansExporter(uimfScansExporterTest1output);

            scansExporter.Export(project.RunCollection[0].ResultCollection);
        }
コード例 #11
0
        private void createPeaks(Run run)
        {
            UIMF_MSGenerator msgen = new UIMF_MSGenerator();

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

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

            for (int i = 0; i < run.ScanSetCollection.ScanSetList.Count; i++)
            {
                ScanSet s = run.ScanSetCollection.ScanSetList[i];
                run.CurrentScanSet = s;

                msgen.Execute(run.ResultCollection);
                peakDet.Execute(run.ResultCollection);
            }
        }
コード例 #12
0
        public void GenerateMassSpectraForRanges(Backend.Runs.UIMFRun run, int startFrame, int stopFrame, int startScan, int stopScan)
        {
            StringBuilder sb = new StringBuilder();

            run.ScanSetCollection.Create(run, startFrame, stopFrame, 1, 1);
            run.IMSScanSetCollection.Create(run, startScan, stopScan, 1, 1);

            UIMF_MSGenerator msgen = new UIMF_MSGenerator();


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

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

                    sb.Append(frame.PrimaryScanNumber);
                    sb.Append("\t");

                    sb.Append(scan.PrimaryScanNumber);
                    sb.Append("\t");
                    try
                    {
                        msgen.Execute(run.ResultCollection);

                        sb.Append("Passed");
                    }
                    catch (Exception ex)
                    {
                        sb.Append("FAILED. \t" + ex.Message);
                    }

                    sb.Append(Environment.NewLine);
                }
            }
            Console.WriteLine(sb.ToString());
        }
コード例 #13
0
        public void uimfPeakDetectionErrorTest1()
        {
            UIMFRun run = new UIMFRun(uimfTestfile1);

            FrameSetCollectionCreator framecreator = new FrameSetCollectionCreator(run, 1, 10, 3, 1);

            framecreator.Create();

            ScanSetCollectionCreator scanCreator = new ScanSetCollectionCreator(run, 1, 1);

            scanCreator.Create();

            Task msgen   = new UIMF_MSGenerator(10, 5000);
            Task peakDet = new DeconToolsPeakDetector();


            int scanstop  = 599;
            int scanstart = 0;

            for (int i = scanstart; i < scanstop; i++)
            {
                run.CurrentFrameSet = run.FrameSetCollection.GetFrameSet(1);
                run.CurrentScanSet  = run.ScanSetCollection.GetScanSet(i);
                msgen.Execute(run.ResultCollection);


                try
                {
                    peakDet.Execute(run.ResultCollection);
                }
                catch (Exception)
                {
                    Console.WriteLine("--------Report of scan " + run.CurrentScanSet.PrimaryScanNumber + "-------------------------");
                    reportXYValues(run);
                }
            }
        }
コード例 #14
0
        public static Run CreateResultsFromTwoFramesOfStandardUIMFData()
        {
            var run = new UIMFRun(FileRefs.RawDataMSFiles.UIMFStdFile1);

            run.ResultCollection.ResultType = Globals.ResultType.UIMF_TRADITIONAL_RESULT;
            run.ScanSetCollection.Create(run, 500, 501, 3, 1);

            run.IMSScanSetCollection.Create(run, 250, 270, 9, 1);

            Task msgen              = new UIMF_MSGenerator();
            Task peakDetector       = new DeconToolsPeakDetectorV2();
            Task decon              = new ThrashDeconvolutorV2();
            Task msScanInfoCreator  = new ScanResultUpdater();
            Task flagger            = new ResultValidatorTask();
            Task ticExtractor       = new DeconTools.Backend.ProcessingTasks.UIMF_TICExtractor();
            Task driftTimeextractor = new UIMFDriftTimeExtractor();

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

                foreach (IMSScanSet scan in run.IMSScanSetCollection.ScanSetList)
                {
                    run.CurrentIMSScanSet = scan;
                    msgen.Execute(run.ResultCollection);
                    peakDetector.Execute(run.ResultCollection);
                    decon.Execute(run.ResultCollection);
                    flagger.Execute(run.ResultCollection);
                    driftTimeextractor.Execute(run.ResultCollection);
                    msScanInfoCreator.Execute(run.ResultCollection);
                    ticExtractor.Execute(run.ResultCollection);
                }
            }

            return(run);
        }
コード例 #15
0
        public void smallExportTest1()
        {
            Project project = Project.getInstance();

            //TODO:  add project parameters  (for summing)

            project.RunCollection.Add(new UIMFRun(uimfFilepath, 1200, 1202, 250, 300));

            Task msGen = new UIMF_MSGenerator(200, 2000);

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

            Task decon = new HornDeconvolutor();

            Task driftTimeExtractor = new UIMFDriftTimeExtractor();


            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(decon);
            project.TaskCollection.TaskList.Add(driftTimeExtractor);


            TaskController controller = new UIMF_TaskController(project.TaskCollection);

            controller.Execute(project.RunCollection);

            UIMFIsosExporter isosExporter = new UIMFIsosExporter(uimfIsosExporterTest1output);

            isosExporter.Export(project.RunCollection[0].ResultCollection);
        }
コード例 #16
0
        public void msGeneratorSummingTest1()
        {
            Run run        = new UIMFRun(uimfFilePath3);
            int startFrame = 800;
            int stopFrame  = 802;

            int numFramesSummed = 3;
            int numScansSummed  = 9;


            FrameSetCollectionCreator framesetCreator = new FrameSetCollectionCreator(run, startFrame, stopFrame, numFramesSummed, 1);

            framesetCreator.Create();

            ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(run, numScansSummed, 1);

            scanSetCreator.Create();

            ResultCollection    results       = new ResultCollection(run);
            List <timingResult> timingResults = new List <timingResult>();

            Task msgen              = new UIMF_MSGenerator();
            Task peakDetector       = new DeconToolsPeakDetector();
            Task decon              = new HornDeconvolutor();
            Task scanResultUpdater  = new ScanResultUpdater();
            Task uimfTicExtractor   = new UIMF_TICExtractor();
            Task driftTimeExtractor = new DeconTools.Backend.ProcessingTasks.UIMFDriftTimeExtractor();


            ((HornDeconvolutor)decon).MinPeptideBackgroundRatio = 4;

            foreach (FrameSet frameset in ((UIMFRun)run).FrameSetCollection.FrameSetList)
            {
                System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();



                ((UIMFRun)run).CurrentFrameSet = frameset;
                foreach (ScanSet scanset in run.ScanSetCollection.ScanSetList)
                {
                    sw.Reset();
                    timingResult timeresult = new timingResult();
                    timeresult.frameNum = frameset.PrimaryFrame;
                    timeresult.scanNum  = scanset.PrimaryScanNumber;
                    sw.Start();

                    run.CurrentScanSet = scanset;

                    msgen.Execute(results);
                    timeresult.msGenTime = sw.ElapsedMilliseconds;

                    sw.Reset();
                    sw.Start();
                    peakDetector.Execute(results);
                    timeresult.peakDetectorTime = sw.ElapsedMilliseconds;

                    sw.Reset();
                    sw.Start();
                    decon.Execute(results);
                    timeresult.deconTime = sw.ElapsedMilliseconds;

                    sw.Reset();
                    sw.Start();
                    scanResultUpdater.Execute(results);
                    timeresult.resultUpdaterTime = sw.ElapsedMilliseconds;

                    sw.Reset();
                    sw.Start();
                    uimfTicExtractor.Execute(results);
                    timeresult.ticExtractorTime = sw.ElapsedMilliseconds;


                    sw.Reset();
                    sw.Start();
                    driftTimeExtractor.Execute(results);

                    timeresult.driftTimeExtractorTime = sw.ElapsedMilliseconds;

                    timingResults.Add(timeresult);
                }
            }

            //reportTimingEachFrameEachScan(timingResults);

            Console.WriteLine("Total _isos = " + results.ResultList.Count);
            Console.WriteLine("PeptideBR = " + ((HornDeconvolutor)decon).MinPeptideBackgroundRatio);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            reportTiming_FrameAggregate(timingResults, startFrame, stopFrame);
            Project.Reset();
        }
コード例 #17
0
        public void outputToText_uimf_test1()
        {
            if (File.Exists(uimf_text_IsosResultOutputFile1))
            {
                File.Delete(uimf_text_IsosResultOutputFile1);
            }

            List <Run> runcoll = new List <Run>();
            Run        run     = new UIMFRun(uimfFile1);

            runcoll.Add(run);

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 200, 240, 9, 1, false);

            sscc.Create();

            FrameSetCollectionCreator fsc = new FrameSetCollectionCreator(run, 800, 801, 3, 1);

            fsc.Create();


            Task msgen              = new UIMF_MSGenerator();
            Task peakDetector       = new DeconToolsPeakDetector();
            Task decon              = new HornDeconvolutor();
            Task driftTimeExtractor = new DeconTools.Backend.ProcessingTasks.UIMFDriftTimeExtractor();
            Task origIntensExtr     = new DeconTools.Backend.ProcessingTasks.OriginalIntensitiesExtractor();
            Task isosExporter       = new DeconTools.Backend.ProcessingTasks.ResultExporters.IsosResultExporters.UIMFIsosResultTextFileExporter(uimf_text_IsosResultOutputFile1, 1000000);
            Task flagger            = new ResultValidatorTask();

            Stopwatch sw;

            foreach (FrameSet frame in ((UIMFRun)run).FrameSetCollection.FrameSetList)
            {
                ((UIMFRun)run).CurrentFrameSet = frame;
                foreach (ScanSet scan in run.ScanSetCollection.ScanSetList)
                {
                    run.CurrentScanSet = scan;
                    msgen.Execute(run.ResultCollection);
                    peakDetector.Execute(run.ResultCollection);

                    decon.Execute(run.ResultCollection);
                    flagger.Execute(run.ResultCollection);
                    driftTimeExtractor.Execute(run.ResultCollection);
                    origIntensExtr.Execute(run.ResultCollection);

                    sw = new Stopwatch();
                    sw.Start();

                    isosExporter.Execute(run.ResultCollection);
                    sw.Stop();
                    if (sw.ElapsedMilliseconds > 10)
                    {
                        Console.WriteLine("execution time = \t" + sw.ElapsedMilliseconds);
                    }
                }
            }
            Assert.AreEqual(true, File.Exists(uimf_text_IsosResultOutputFile1));

            FileInfo fi = new FileInfo(uimf_text_IsosResultOutputFile1);

            Assert.AreEqual(99743, fi.Length);
            Console.Write(fi.Length);
        }
コード例 #18
0
        public void updateScanResultsUIMFFileTest1()
        {
            UIMFRun run = new UIMFRun(uimfFilepath);

            run.FrameSetCollection = new FrameSetCollection();
            for (int i = 1200; i < 1203; i++)
            {
                run.FrameSetCollection.FrameSetList.Add(new FrameSet(i));
            }

            run.ScanSetCollection = new ScanSetCollection();
            for (int i = 200; i < 304; i++)
            {
                run.ScanSetCollection.ScanSetList.Add(new ScanSet(i));
            }
            StreamWriter     sw;
            ResultCollection results = new ResultCollection(run);

            Task msgen             = new UIMF_MSGenerator();
            Task peakDetector      = new DeconToolsPeakDetector();
            Task rapid             = new RapidDeconvolutor();
            Task scanResultUpdater = new ScanResultUpdater();
            Task peakListExporter  = new PeakListTextExporter(run.MSFileType, peakListoutputPath);


            foreach (FrameSet frameset in run.FrameSetCollection.FrameSetList)
            {
                ((UIMFRun)run).CurrentFrameSet = frameset;

                foreach (ScanSet scanset in run.ScanSetCollection.ScanSetList)
                {
                    run.CurrentScanSet = scanset;
                    msgen.Execute(results);

                    peakDetector.Execute(results);

                    rapid.Execute(results);

                    scanResultUpdater.Execute(results);

                    peakListExporter.Execute(results);
                }
            }
            peakListExporter.Cleanup();

            Assert.AreEqual(3, results.ScanResultList.Count);
            Assert.AreEqual(1, results.ScanResultList[0].SpectrumType);
            Assert.AreEqual(670.990710325132, (decimal)results.ScanResultList[0].BasePeak.XValue);
            Assert.AreEqual(183, results.ScanResultList[0].NumIsotopicProfiles);

            Assert.AreEqual(7097, results.ScanResultList[0].NumPeaks);
            Assert.AreEqual(-1, (decimal)results.ScanResultList[0].ScanTime);

            UIMFScanResult uimfScanresult1 = (UIMFScanResult)(results.ScanResultList[0]);


            Assert.AreEqual(4.0, uimfScanresult1.FramePressureFront);
            Assert.AreEqual(4.016, uimfScanresult1.FramePressureBack);
            Assert.AreEqual(1200, uimfScanresult1.Frameset.PrimaryFrame);

            Assert.AreEqual(504, results.ResultList.Count);
        }
コード例 #19
0
        public void test1()
        {
            Project.Reset();
            Project project = Project.getInstance();

            UIMFRun run = new UIMFRun(uimfFilepath, 1200, 1202);

            project.RunCollection.Add(run);

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

            sscc.Create();

            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, run.MinFrame, run.MaxFrame, 1, 1);

            fscc.Create();

            Task msGen = new UIMF_MSGenerator(200, 2000);

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

            Task rapidDecon = new RapidDeconvolutor();

            Task scanResultsUpdater = new ScanResultUpdater();

            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(rapidDecon);
            project.TaskCollection.TaskList.Add(scanResultsUpdater);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            TaskController controller = new UIMF_TaskController(project.TaskCollection);

            controller.Execute(project.RunCollection);
            sw.Stop();

            Console.WriteLine("Time required (ms) = " + sw.ElapsedMilliseconds);
            Console.WriteLine("Scans analyzed = " + project.RunCollection[0].ScanSetCollection.ScanSetList.Count);
            Console.WriteLine("Features found = " + project.RunCollection[0].ResultCollection.ResultList.Count);



            Assert.AreEqual(1, Project.getInstance().RunCollection.Count);
            Assert.AreEqual(4, project.TaskCollection.TaskList.Count);

            Assert.AreEqual(600, project.RunCollection[0].ScanSetCollection.ScanSetList.Count);

            UIMFRun uimfRun = (UIMFRun)(project.RunCollection[0]);

            Assert.AreEqual(3, uimfRun.FrameSetCollection.FrameSetList.Count);


            StringBuilder sb = new StringBuilder();

            foreach (IsosResult result in project.RunCollection[0].ResultCollection.ResultList)
            {
                Assert.IsInstanceOfType(typeof(UIMFIsosResult), result);
                UIMFIsosResult uimfResult = (UIMFIsosResult)result;
                sb.Append(uimfResult.FrameSet.PrimaryFrame);
                sb.Append("\t");
                sb.Append(uimfResult.ScanSet.PrimaryScanNumber);
                sb.Append("\t");
                sb.Append(uimfResult.IsotopicProfile.Peaklist[0].XValue);
                sb.Append("\t");
                sb.Append(uimfResult.IsotopicProfile.GetAbundance());
                sb.Append("\t");
                //sb.Append(uimfResult.IsotopicProfile.
                sb.Append(Environment.NewLine);
            }
            Console.Write(sb.ToString());
        }
コード例 #20
0
        public void multipleFrames_horn_test4()
        {
            Project.Reset();

            //Project.getInstance().LoadOldDecon2LSParameters(uimfParameters1);

            UIMFRun run = new UIMFRun(uimfFilepath, 1202, 1202);

            Project.getInstance().RunCollection.Add(run);


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

            sscc.Create();

            FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, run.MinFrame, run.MaxFrame, 1, 1);

            fscc.Create();

            Task msGen      = new UIMF_MSGenerator(0, 5000);
            Task zeroFiller = new DeconToolsZeroFiller(3);


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


            Task peakDetector = new DeconToolsPeakDetector(detectorParams);


            DeconToolsV2.HornTransform.clsHornTransformParameters hornParams = new DeconToolsV2.HornTransform.clsHornTransformParameters();
            hornParams.CompleteFit               = true;
            hornParams.LeftFitStringencyFactor   = 2.5;
            hornParams.RightFitStringencyFactor  = 0.5;
            hornParams.PeptideMinBackgroundRatio = 4;
            hornParams.MaxFit            = 0.4;
            hornParams.UseMZRange        = false;
            hornParams.UseMercuryCaching = true;

            Task decon = new HornDeconvolutor(hornParams);

            Task scanResultsUpdater = new ScanResultUpdater();

            Project.getInstance().TaskCollection.TaskList.Add(msGen);
            Project.getInstance().TaskCollection.TaskList.Add(zeroFiller);

            Project.getInstance().TaskCollection.TaskList.Add(peakDetector);
            Project.getInstance().TaskCollection.TaskList.Add(decon);
            Project.getInstance().TaskCollection.TaskList.Add(scanResultsUpdater);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            TaskController controller = new UIMF_TaskController(Project.getInstance().TaskCollection);

            controller.Execute(Project.getInstance().RunCollection);
            sw.Stop();

            Console.WriteLine("Time required (ms) = " + sw.ElapsedMilliseconds);
            Console.WriteLine("Scans analyzed = " + Project.getInstance().RunCollection[0].ScanSetCollection.ScanSetList.Count);
            Console.WriteLine("Features found = " + Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count);
            Console.WriteLine("Peaks found = " + Project.getInstance().RunCollection[0].ResultCollection.ScanResultList[0].NumPeaks);



            StringBuilder sb = new StringBuilder();
        }
コード例 #21
0
        public void test1()
        {
            Run uimfrun    = new UIMFRun(inputUIMFFile1);
            int startFrame = 800;
            int stopFrame  = 800;

            int numFramesSummed = 3;
            int numScansSummed  = 9;

            FrameSetCollectionCreator framesetCreator = new FrameSetCollectionCreator(uimfrun, startFrame, stopFrame, numFramesSummed, 1);

            framesetCreator.Create();

            ScanSetCollectionCreator scansetCreator = new ScanSetCollectionCreator(uimfrun, 230, 240, numScansSummed, 1, false);

            scansetCreator.Create();

            Project project = Project.getInstance();

            project.RunCollection.Add(uimfrun);

            Task msGen = new UIMF_MSGenerator(200, 2000);


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

            Task decon = new HornDeconvolutor();



            Task driftTimeExtractor = new UIMFDriftTimeExtractor();


            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(decon);
            project.TaskCollection.TaskList.Add(driftTimeExtractor);


            TaskController controller = new UIMF_TaskController(project.TaskCollection);

            controller.Execute(project.RunCollection);

            Assert.AreEqual(252, project.RunCollection[0].ResultCollection.ResultList.Count);


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


            Stopwatch sw = new Stopwatch();

            sw.Start();
            UIMFSQLiteIsosExporter isosExporter = new UIMFSQLiteIsosExporter(outputFile1);

            isosExporter.Export(project.RunCollection[0].ResultCollection);

            sw.Stop();
            Console.Write("\n\n----------- Time taken for UIMFSQLiteIsosExporter (milliseconds) = \t" + sw.ElapsedMilliseconds);
        }
コード例 #22
0
        public void compareUIMF_and_IMF_XYDataPoints2()
        {
            Run uimfRun = new UIMFRun(uimfFilepath2);
            ResultCollection uimfResults = new ResultCollection(uimfRun);

            Run imfRun = new IMFRun(imf2Frame391);
            ResultCollection imfResults = new ResultCollection(imfRun);

            FrameSet uimfFrame = new FrameSet(391);


            ((UIMFRun)uimfRun).CurrentFrameSet = uimfFrame;



            Task uimfMSGen = new UIMF_MSGenerator();
            Task imfMSGen  = new GenericMSGenerator();



            ScanSetCollectionCreator scanSetCollectionCreator = new ScanSetCollectionCreator(uimfRun, 9, 1);

            scanSetCollectionCreator.Create();

            scanSetCollectionCreator = new ScanSetCollectionCreator(imfRun, 9, 1);
            scanSetCollectionCreator.Create();

            int scanStart = 200;
            int scanStop  = 400;

            StringBuilder sb = new StringBuilder();

            for (int n = scanStart; n < scanStop; n++)
            {
                uimfRun.CurrentScanSet = uimfRun.ScanSetCollection.ScanSetList[n];
                imfRun.CurrentScanSet  = imfRun.ScanSetCollection.ScanSetList[n + 1];
                uimfMSGen.Execute(uimfResults);
                imfMSGen.Execute(imfResults);


                Assert.AreEqual(imfResults.Run.XYData.Xvalues.Length, uimfResults.Run.XYData.Xvalues.Length);

                double[] ppmDiffValues = new double[imfResults.Run.XYData.Xvalues.Length];

                for (int i = 0; i < uimfResults.Run.XYData.Xvalues.Length; i++)
                {
                    double imfXval  = imfResults.Run.XYData.Xvalues[i];
                    double uimfXval = uimfResults.Run.XYData.Xvalues[i];
                    double imfYval  = imfResults.Run.XYData.Yvalues[i];
                    double uimfYval = uimfResults.Run.XYData.Yvalues[i];

                    Assert.AreEqual(imfYval, uimfYval);
                    Assert.AreEqual(Math.Round(imfXval, 8), Math.Round(uimfXval, 8));


                    //double ppmDiff = Math.Abs(imfXval - uimfXval) / imfXval * 1e6;
                    //ppmDiffValues[i] = ppmDiff;

                    //Assert.Less(ppmDiff, 0.25);
                }


                for (int i = 0; i < imfResults.Run.XYData.Xvalues.Length; i++)
                {
                    sb.Append(n);
                    sb.Append("\t");
                    sb.Append(imfResults.Run.XYData.Xvalues[i].ToString("0.00000"));
                    sb.Append("\t");
                    sb.Append(uimfResults.Run.XYData.Xvalues[i].ToString("0.00000"));
                    sb.Append("\t");
                    sb.Append(ppmDiffValues[i].ToString("0.00"));
                    sb.Append("\t");
                    sb.Append(imfResults.Run.XYData.Yvalues[i]);
                    sb.Append("\t");
                    sb.Append(uimfResults.Run.XYData.Yvalues[i]);
                    sb.Append("\n");
                }
            }

            Console.Write(sb.ToString());
        }
コード例 #23
0
        public void UIMF_and_IMF_Nosumming_Test1()
        {
            Run uimfrun = new UIMFRun(uimfFilepath);
            Run imfRun  = new IMFRun(imfFrame1200filepath);

            int startFrame = 1200;
            int stopFrame  = 1200;

            int numFramesSummed = 1;
            int numScansSummed  = 1;

            FrameSetCollectionCreator framesetCreator = new FrameSetCollectionCreator(uimfrun, startFrame, stopFrame, numFramesSummed, 1);

            framesetCreator.Create();

            ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(uimfrun, numScansSummed, 1);

            scanSetCreator.Create();

            ResultCollection uimfResults = new ResultCollection(uimfrun);

            //first analyze the UIMF file....
            foreach (FrameSet frameset in ((UIMFRun)uimfrun).FrameSetCollection.FrameSetList)
            {
                System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

                ((UIMFRun)uimfrun).CurrentFrameSet = frameset;
                foreach (ScanSet scanset in uimfrun.ScanSetCollection.ScanSetList)
                {
                    uimfrun.CurrentScanSet = scanset;
                    Task msgen = new UIMF_MSGenerator(0, 2000);
                    msgen.Execute(uimfResults);

                    Task peakDetector = new DeconToolsPeakDetector();
                    peakDetector.Execute(uimfResults);

                    Task rapid = new RapidDeconvolutor();
                    rapid.Execute(uimfResults);

                    Task scanResultUpdater = new ScanResultUpdater();
                    scanResultUpdater.Execute(uimfResults);
                }
            }

            //next analyze the IMF file for the corresponding frame
            scanSetCreator = new ScanSetCollectionCreator(imfRun, 0, 599, numScansSummed, 1);
            scanSetCreator.Create();

            ResultCollection imfResults = new ResultCollection(imfRun);

            foreach (ScanSet scanset in imfRun.ScanSetCollection.ScanSetList)
            {
                imfRun.CurrentScanSet = scanset;
                Task msgen = new GenericMSGenerator(0, 2000);
                msgen.Execute(imfResults);

                Task peakDetector = new DeconToolsPeakDetector();
                peakDetector.Execute(imfResults);

                Task rapid = new RapidDeconvolutor();
                rapid.Execute(imfResults);

                Task scanResultUpdater = new ScanResultUpdater();
                scanResultUpdater.Execute(imfResults);
            }

            Console.WriteLine("imfScanSetCount = " + imfResults.Run.ScanSetCollection.ScanSetList.Count);
            Console.WriteLine("UIMFScanSetCount = " + uimfResults.Run.ScanSetCollection.ScanSetList.Count);

            Console.WriteLine("IMF scan0 peaks = " + imfResults.ScanResultList.Sum(p => p.NumPeaks));
            Console.WriteLine("UIMF scan0 peaks = " + uimfResults.ScanResultList[0].NumPeaks);

            Console.WriteLine("imfResultCount = " + imfResults.ResultList.Count);
            Console.WriteLine("UIMFResultCount = " + uimfResults.ResultList.Count);


            for (int i = 0; i < uimfResults.ResultList.Count; i++)
            {
                Console.Write(getResultSummary(uimfResults.ResultList[i]));
                Console.Write(getResultSummary(imfResults.ResultList[i]));
                Console.Write("\n");
            }
        }