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

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

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

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

            return(taskList);
        }
        public void test1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

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

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


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

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

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

            IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator();

            msgen.Execute(run.ResultCollection);

            //run.XYData.Display();

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

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

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

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

            ScanSetCollection scanSetCollection = new ScanSetCollection();

            scanSetCollection.ScanSetList.Add(new ScanSet(232));
            scanSetCollection.ScanSetList.Add(new ScanSet(233));
            scanSetCollection.ScanSetList.Add(new ScanSet(234));

            ResultCollection results = new ResultCollection(run);

            foreach (ScanSet scanset in scanSetCollection.ScanSetList)
            {
                run.CurrentScanSet = scanset;

                Task msGen = new GenericMSGenerator();
                msGen.Execute(results);

                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);
                peakDetector.Execute(results);

                Task decon = new RapidDeconvolutor();
                decon.Execute(results);

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

            Assert.AreEqual(3, results.ScanResultList.Count);

            Assert.AreEqual(92, results.ScanResultList[0].NumPeaks);
            Assert.AreEqual(82, results.ScanResultList[1].NumPeaks);
            Assert.AreEqual(72, results.ScanResultList[2].NumPeaks);

            Assert.AreEqual(11, results.ScanResultList[0].NumIsotopicProfiles);
            Assert.AreEqual(9, results.ScanResultList[1].NumIsotopicProfiles);
            Assert.AreEqual(9, results.ScanResultList[2].NumIsotopicProfiles);

            Assert.AreEqual(830.045752112968, (Decimal)results.ScanResultList[0].BasePeak.XValue);
            Assert.AreEqual(10438, results.ScanResultList[0].BasePeak.Height);
            Assert.AreEqual(0.09454554, (Decimal)results.ScanResultList[0].BasePeak.Width);
            Assert.AreEqual(434.9167, (Decimal)results.ScanResultList[0].BasePeak.SN);

            Exporter <ResultCollection> exporter = new BasicScansExporter(scansExporterTest1output);

            exporter.Export(results);
        }
        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 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);
                }
            }
        }
Exemple #6
0
        public void test1()
        {
            Run xcalRun  = new XCaliburRun(xcaliburTestfile, 6000, 6020);
            Run mzxmlRun = new MZXMLRun(mzxmlfile1, 1, 21);

            List <Run> runCollection = new List <Run>();

            runCollection.Add(xcalRun);
            runCollection.Add(mzxmlRun);

            int numScansSummed = 1;

            ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(xcalRun, xcalRun.MinScan, xcalRun.MaxScan, numScansSummed, 1, false);

            scanSetCreator.Create();

            scanSetCreator = new ScanSetCollectionCreator(mzxmlRun, mzxmlRun.MinScan, mzxmlRun.MaxScan, numScansSummed, 1);
            scanSetCreator.Create();

            Task msgen = new GenericMSGenerator();

            DeconToolsV2.Peaks.clsPeakProcessorParameters detParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detParams.PeakBackgroundRatio    = 3;
            detParams.SignalToNoiseThreshold = 3;

            Task peakDet = new DeconToolsPeakDetector(detParams);
            Task horn    = new HornDeconvolutor();

            TaskCollection taskColl = new TaskCollection();

            taskColl.TaskList.Add(msgen);
            taskColl.TaskList.Add(peakDet);
            taskColl.TaskList.Add(horn);

            TaskController taskController = new BasicTaskController(taskColl);

            taskController.Execute(runCollection);

            Assert.AreEqual(true, TestUtilities.AreIsosResultsTheSame(xcalRun.ResultCollection.ResultList, mzxmlRun.ResultCollection.ResultList));
        }
Exemple #7
0
        public void ApplyFilter()
        {
            float[] xData = _msScan.RawMZs;
            float[] yData = _msScan.RawIntensities;
            DeconToolsV2.Peaks.clsPeakProcessor peakProcessor = new DeconToolsV2.Peaks.clsPeakProcessor();
            DeconToolsV2.Peaks.clsPeakProcessorParameters parameters = new DeconToolsV2.Peaks.clsPeakProcessorParameters();

            parameters.PeakBackgroundRatio = PeakToBackgroundRatio;
            parameters.SignalToNoiseThreshold = SignalToNoiseThreshold;
            parameters.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;

            peakProcessor.SetOptions(parameters);
            DeconToolsV2.Peaks.clsPeak[] peakList = new DeconToolsV2.Peaks.clsPeak[1];
            peakProcessor.DiscoverPeaks(ref xData, ref yData, ref peakList, 0, float.MaxValue);
            float[] mz = new float[peakList.Length];
            float[] intensity = new float[peakList.Length];
            for (int i = 0; i < peakList.Length; i++)
            {
                mz[i] = Convert.ToSingle(peakList[i].mdbl_mz);
                intensity[i] = Convert.ToSingle(peakList[i].mdbl_intensity);
            }
            _msScan.MZs = mz;
            _msScan.Intensities = intensity;
        }
Exemple #8
0
        public void ApplyFilter()
        {
            float[] xData = _msScan.RawMZs;
            float[] yData = _msScan.RawIntensities;
            DeconToolsV2.Peaks.clsPeakProcessor           peakProcessor = new DeconToolsV2.Peaks.clsPeakProcessor();
            DeconToolsV2.Peaks.clsPeakProcessorParameters parameters    = new DeconToolsV2.Peaks.clsPeakProcessorParameters();

            parameters.PeakBackgroundRatio    = PeakToBackgroundRatio;
            parameters.SignalToNoiseThreshold = SignalToNoiseThreshold;
            parameters.PeakFitType            = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;

            peakProcessor.SetOptions(parameters);
            DeconToolsV2.Peaks.clsPeak[] peakList = new DeconToolsV2.Peaks.clsPeak[1];
            peakProcessor.DiscoverPeaks(ref xData, ref yData, ref peakList, 0, float.MaxValue);
            float[] mz        = new float[peakList.Length];
            float[] intensity = new float[peakList.Length];
            for (int i = 0; i < peakList.Length; i++)
            {
                mz[i]        = Convert.ToSingle(peakList[i].mdbl_mz);
                intensity[i] = Convert.ToSingle(peakList[i].mdbl_intensity);
            }
            _msScan.MZs         = mz;
            _msScan.Intensities = intensity;
        }
        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);
        }