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);
                }
            }
        }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
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);
                    }
                }
            }
        }
        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);
        }
Beispiel #5
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());
        }
        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());
        }
Beispiel #7
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());
        }
        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());
        }
        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();
        }
Beispiel #10
0
        public void basicCreatorTest2()
        {
            Run run = new UIMFRun(uimfFilepath);

            FrameSetCollectionCreator creator = new FrameSetCollectionCreator(run, 1200, 1300, 3, 1);

            creator.Create();

            UIMFRun uimfRun = (UIMFRun)run;

            Assert.AreEqual(101, uimfRun.FrameSetCollection.FrameSetList.Count);
            Assert.AreEqual(1200, uimfRun.FrameSetCollection.FrameSetList[0].PrimaryFrame);
            Assert.AreEqual(new int[] { 1199, 1200, 1201 }, uimfRun.FrameSetCollection.FrameSetList[0].IndexValues.ToArray());
        }
Beispiel #11
0
        public void basicCreatorTest1()
        {
            Run run = new UIMFRun(uimfFilepath);

            FrameSetCollectionCreator creator = new FrameSetCollectionCreator(run, 3, 1);

            creator.Create();

            UIMFRun uimfRun = (UIMFRun)run;

            Assert.AreEqual(1950, uimfRun.FrameSetCollection.FrameSetList.Count);
            Assert.AreEqual(3, uimfRun.FrameSetCollection.FrameSetList[2].PrimaryFrame);
            Assert.AreEqual(new int[] { 2, 3, 4 }, uimfRun.FrameSetCollection.FrameSetList[2].IndexValues.ToArray());
            Assert.AreEqual(new int[] { 1, 2 }, uimfRun.FrameSetCollection.FrameSetList[0].IndexValues.ToArray());
            Assert.AreEqual(new int[] { 1949, 1950 }, uimfRun.FrameSetCollection.FrameSetList.Last().IndexValues.ToArray());
        }
        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);
                }
            }
        }
        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);
        }
Beispiel #14
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);
                }
            }
        }
Beispiel #15
0
        public void examineFPGAUIMFTest1()
        {
            Run run = new DeconTools.Backend.Runs.UIMFRun(fpgaUIMFFilePath);

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

            ffcc.Create();

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

            sscc.Create();

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

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector();

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

            HornDeconvolutor decon = new HornDeconvolutor();

            decon.MinPeptideBackgroundRatio = 5;


            foreach (var scanset in run.ScanSetCollection.ScanSetList)
            {
                run.CurrentScanSet             = scanset;
                ((UIMFRun)run).CurrentFrameSet = new FrameSet(1);
                msgen.Execute(run.ResultCollection);

                peakDet.Execute(run.ResultCollection);

                decon.Execute(run.ResultCollection);
            }
        }
        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);
        }
Beispiel #17
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();
        }
        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();
        }
        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());
        }
Beispiel #20
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");
            }
        }
Beispiel #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);
        }