public void getTheorIsotopicProfileXYDataTest1()
        {
            MassTag mt = new MassTag();

            mt.ID = 56488;
            mt.MonoIsotopicMass = 2275.1694779;
            mt.PeptideSequence  = "TTPSIIAYTDDETIVGQPAKR";
            mt.NETVal           = 0.3520239f;
            mt.CreatePeptideObject();
            mt.ChargeState = 2;

            Run run = new XCaliburRun();

            ResultCollection rc = new ResultCollection(run);

            rc.Run.CurrentMassTag = mt;

            Task theorGen = new TomTheorFeatureGenerator();

            theorGen.Execute(rc);

            mt.CalculateMassesForIsotopicProfile(mt.ChargeState);

            TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfile);

            XYData xydata = TheorXYDataCalculationUtilities.Get_Theoretical_IsotopicProfileXYData(mt.IsotopicProfile, 0.02);


            TestUtilities.DisplayXYValues(xydata);
        }
示例#2
0
        public void peakDetectionOnXCaliburTest2_effectOfThresholdingOnPeakDetector()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            ResultCollection results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(4003);

            Task msgen = new GenericMSGenerator(0, 2000);

            msgen.Execute(results);

            run.IsDataThresholded = true;   //fyi... by default, xcalibur runs are set to be true

            Task peakDetector = new DeconToolsPeakDetector();

            ((DeconToolsPeakDetector)(peakDetector)).PeakBackgroundRatio = 1.3;
            ((DeconToolsPeakDetector)(peakDetector)).PeakFitType         = Globals.PeakFitType.QUADRATIC;
            ((DeconToolsPeakDetector)(peakDetector)).SigNoiseThreshold   = 2;
            peakDetector.Execute(results);

            Assert.AreEqual(646, results.Run.PeakList.Count);

            run.IsDataThresholded = false;

            peakDetector = new DeconToolsPeakDetector();
            ((DeconToolsPeakDetector)(peakDetector)).PeakBackgroundRatio = 1.3;
            ((DeconToolsPeakDetector)(peakDetector)).PeakFitType         = Globals.PeakFitType.QUADRATIC;
            ((DeconToolsPeakDetector)(peakDetector)).SigNoiseThreshold   = 2;
            peakDetector.Execute(results);

            Assert.AreEqual(636, results.Run.PeakList.Count);
        }
示例#3
0
        public void test1()
        {
            Run     run = new XCaliburRun(xcaliburTestfile);
            MassTag mt  = TestUtilities.GetMassTagStandard(1);

            PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburPeakDataFile);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);

            run.CurrentMassTag = mt;

            Task theorFeatureGen = new TomTheorFeatureGenerator();

            theorFeatureGen.Execute(run.ResultCollection);


            int numPeaksForExtractingChrom = 3;
            int toleranceInPPM             = 25;

            IsotopicProfileMultiChromatogramExtractor multiChromExtractor = new IsotopicProfileMultiChromatogramExtractor(
                numPeaksForExtractingChrom, toleranceInPPM);

            List <int> ms1Levels = run.GetMSLevelScanValues();

            Dictionary <MSPeak, XYData> chromDataForIsotopicProfile = multiChromExtractor.GetChromatogramsForIsotopicProfilePeaks(run.ResultCollection.MSPeakResultList, run.CurrentMassTag.IsotopicProfile, true, ms1Levels);

            multiChromExtractor.SmoothChromatograms(chromDataForIsotopicProfile, new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(11, 11, 2));
            XYData xydata1 = chromDataForIsotopicProfile.Values.First();
            XYData xydata2 = chromDataForIsotopicProfile.Values.ElementAt(1);
            XYData xydata3 = chromDataForIsotopicProfile.Values.ElementAt(2);



            TestUtilities.DisplayXYValues(xydata3);
        }
示例#4
0
        public void exportAllPeaksInXCaliburFile()
        {
            if (File.Exists(xcaliburAllPeaksFileName))
            {
                File.Delete(xcaliburAllPeaksFileName);
            }

            Run run = new XCaliburRun(xcaliburTestfile);

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

            scansetCreator.Create();

            Task msgen = new GenericMSGenerator();

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

            ((DeconToolsPeakDetector)peakDetector).StorePeakData = true;

            Task exporter = new DeconTools.Backend.ProcessingTasks.PeakListExporters.PeakListTextExporter(run.MSFileType, 1000000, xcaliburAllPeaksFileName);     //trigger of 1E5 = 310 sec (memory = 150 MB);    trigger of 1E6 =  231 Sec (memory = 250 MB);

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

            exporter.Cleanup();
            Assert.AreEqual(true, File.Exists(xcaliburAllPeaksFileName));
        }
        public void deconvoluteXCalibur_MS_DataTest1()    //good ms data...  expect to find isotopic profiles...
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            run.MSParameters   = new DeconTools.Backend.Parameters.MSParameters();
            run.CurrentScanSet = new ScanSet(6067);

            ResultCollection rc = new ResultCollection(run);

            Task msGen = new GenericMSGenerator();

            msGen.Execute(rc);

            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);

            peakdetector.Execute(rc);

            Task rapid = new RapidDeconvolutor();

            rapid.Execute(rc);

            Assert.AreEqual(95, rc.ResultList.Count);
        }
示例#6
0
        public void tester()
        {
            Run run = new XCaliburRun(xcaliburTestfile);
            MassTagCollection        massTagColl  = new MassTagCollection();
            MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(smartMethionineMatches, '\t');

            mtidImporter.Import(massTagColl);
            Console.WriteLine("SMART matches = " + massTagColl.MassTagIDList.Count());

            MassTagCollection        matchedMassTag = new MassTagCollection();
            MassTagIDGenericImporter matchImporter  = new MassTagIDGenericImporter(targetedMethionineMatches, '\t');

            matchImporter.Import(matchedMassTag);
            Console.WriteLine("Targeted matches = " + matchedMassTag.MassTagIDList.Distinct().Count());


            //List<long> common_massTags = massTagColl.MassTagIDList.Intersect(matchedMassTag.MassTagIDList).ToList();
            List <long> common_massTags = matchedMassTag.MassTagIDList.Intersect(massTagColl.MassTagIDList).ToList();

            List <long> targetedUniqueTags = matchedMassTag.MassTagIDList.Except(massTagColl.MassTagIDList).ToList();

            List <long> smartUniqueTags = massTagColl.MassTagIDList.Except(matchedMassTag.MassTagIDList).ToList();


            string listOfMTsForSMARTUnique = getStringListOfMassTags(smartUniqueTags);

            Console.WriteLine("Common matches = " + common_massTags.Count);
            Console.WriteLine("Unique to targeted = " + targetedUniqueTags.Count);
            Console.WriteLine("Unique to SMART = " + smartUniqueTags.Count);

            Console.WriteLine();
            Console.WriteLine(listOfMTsForSMARTUnique);
        }
示例#7
0
        public void test1()
        {
            Run run = new XCaliburRun(bsaO16O18file1);

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

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

            O16O18FeatureFinder finder = new O16O18FeatureFinder();


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

            run.CurrentMassTag = massTagList[0];

            TomTheorFeatureGenerator theorFeatureGen = new TomTheorFeatureGenerator();

            theorFeatureGen.GenerateTheorFeature(run.CurrentMassTag);

            run.CurrentScanSet = new ScanSet(3294);

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

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

            TestUtilities.DisplayIsotopicProfileData(o16O18profile);
        }
示例#8
0
        public void test1()
        {
            Run run = new XCaliburRun(lowmwRawfile);

            ResultCollection results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(1);
            Task msgen = new GenericMSGenerator(0, 1000);

            msgen.Execute(results);

            DeconToolsPeakDetector peakdetector = new DeconToolsPeakDetector();

            peakdetector.PeakBackgroundRatio = 0.5;
            peakdetector.PeakFitType         = DeconTools.Backend.Globals.PeakFitType.QUADRATIC;
            peakdetector.SigNoiseThreshold   = 3;
            peakdetector.IsDataThresholded   = true;
            peakdetector.Execute(results);

            //Task rapidDecon = new RapidDeconvolutor();
            //rapidDecon.Execute(results);

            Task simpleDecon = new SimpleDecon(0.0005);

            simpleDecon.Execute(results);

            Console.WriteLine(results.Run.PeakList.Count);
            Console.WriteLine(results.ResultList.Count);


            string reportedResults = reportResults(results.ResultList);

            Console.WriteLine(reportedResults);
        }
示例#9
0
        public void peakDetectionOnXCaliburTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile, 6000, 7000);

            ScanSetCollection scansetCollection = new ScanSetCollection();

            for (int i = 6000; i < 6015; i++)
            {
                scansetCollection.ScanSetList.Add(new ScanSet(i));
            }

            ResultCollection results = new ResultCollection(run);

            foreach (ScanSet scanset in scansetCollection.ScanSetList)
            {
                run.CurrentScanSet = scanset;
                Task msgen = new GenericMSGenerator();
                msgen.Execute(results);

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

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

            Assert.AreEqual(2, results.ScanResultList.Count);
        }
        public void xcaliburTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);
            MSGeneratorFactory msgenFactory = new MSGeneratorFactory();
            Task msgen           = msgenFactory.CreateMSGenerator(run.MSFileType);
            Task peakDetector    = new DeconToolsPeakDetector();
            Task decon           = new HornDeconvolutor();
            Task suspPeakFlagger = new LeftOfMonoPeakLooker();

            run.CurrentScanSet = new ScanSet(6005);
            msgen.Execute(run.ResultCollection);
            peakDetector.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);

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


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

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

            Assert.AreEqual(2, flaggedResults.Count);

            TestUtilities.DisplayIsotopicProfileData(flaggedResults[0].IsotopicProfile);
            Console.WriteLine();
            TestUtilities.DisplayIsotopicProfileData(flaggedResults[1].IsotopicProfile);
        }
示例#11
0
        public void test2()
        {
            MassTag massTag = new MassTag();

            massTag.ID = 56488;
            massTag.MonoIsotopicMass = 2275.1694779;
            massTag.ChargeState      = 3;
            massTag.MZ = massTag.MonoIsotopicMass / massTag.ChargeState + 1.00727649;


            Run run = new XCaliburRun(xcaliburTestfile);

            PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburPeakDataFile);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);


            run.CurrentMassTag = massTag;

            Task peakChromGen = new PeakChromatogramGenerator(10);

            Task smoother = new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(2, 2, 2);
            Task peakDet  = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector();


            peakChromGen.Execute(run.ResultCollection);
            smoother.Execute(run.ResultCollection);
            peakDet.Execute(run.ResultCollection);

            TestUtilities.DisplayPeaks(run.PeakList);
            TestUtilities.DisplayXYValues(run.ResultCollection);
        }
示例#12
0
        public void fitterOnHornDataTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            ResultCollection results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(6067);


            Task msGen = new GenericMSGenerator(1154, 1158);

            msGen.Execute(results);

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

            Task peakDetector = new DeconToolsPeakDetector(detectorParams);

            peakDetector.Execute(results);


            DeconToolsV2.HornTransform.clsHornTransformParameters hornParameters = new DeconToolsV2.HornTransform.clsHornTransformParameters();
            hornParameters.PeptideMinBackgroundRatio = 2;

            Task decon = new HornDeconvolutor(hornParameters);

            decon.Execute(results);


            IsosResult result1 = results.ResultList[0];


            MercuryDistributionCreator distcreator = new MercuryDistributionCreator();
            double resolution = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM();

            distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution);
            distcreator.OffsetDistribution(result1.IsotopicProfile);



            XYData theorXYData = distcreator.Data;

            StringBuilder sb = new StringBuilder();

            TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues);

            Console.WriteLine(sb.ToString());

            AreaFitter areafitter = new AreaFitter(theorXYData, run.XYData, 10);
            double     fitval     = areafitter.getFit();

            Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval);
            Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score);

            Assert.AreEqual(0.0209385414928986, (decimal)fitval);    //TODO: fix this test... i'm getting 0.0207350903681061m
        }
        public void turnRAPIDScoreIntoHornScoreAndCompareTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile, 6000, 6050);


            int numScansSummed = 1;

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

            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 rapid = new RapidDeconvolutor();
            Task horn  = new HornDeconvolutor();

            Task fitcalc = new DeconToolsFitScoreCalculator();

            run.CurrentScanSet = run.ScanSetCollection.GetScanSet(6005);
            msgen.Execute(run.ResultCollection);
            peakDet.Execute(run.ResultCollection);
            horn.Execute(run.ResultCollection);

            //string isosData = reportIsotopicProfiles(run);
            //Console.Write(isosData);

            //First evaluate HornTransform score
            Assert.AreEqual(481.274105402604, (decimal)run.ResultCollection.ResultList[0].IsotopicProfile.GetMZ());
            Assert.AreEqual(0.0101245114907111, (decimal)run.ResultCollection.ResultList[0].IsotopicProfile.Score);

            run.ResultCollection.ClearAllResults();


            horn.Execute(run.ResultCollection);
            fitcalc.Execute(run.ResultCollection);
            Assert.AreEqual(0.00583991502104572, (decimal)run.ResultCollection.ResultList[0].IsotopicProfile.Score);

            run.ResultCollection.ClearAllResults();


            //Run RAPID and evaluate the score Rapid gives it
            rapid.Execute(run.ResultCollection);
            Assert.AreEqual(481.274105402604, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.GetMZ());
            Assert.AreEqual(1.52062147024669, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.Score);


            //Run the DeconToolsFitScoreCalculator
            fitcalc.Execute(run.ResultCollection);

            //Evaluate the score given by the fitscore calculator
            Assert.AreNotEqual(1.52062147024669, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.Score);
            Assert.AreEqual(0.00583991502104572m, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.Score);
        }
示例#14
0
        public void simpleAddTest1()
        {
            //first deconvolute with THRASH
            //then deconvolute with RAPID, using comboMode = 'simplyAddIt'
            //so there will be duplicate results
            Project.Reset();

            Run run = new XCaliburRun(xcaliburTestfile, 6000, 6050);

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


            ResultCollection results        = new ResultCollection(run);
            TaskCollection   taskCollection = new TaskCollection();

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

            scansetCreator.Create();


            Task msgen = new GenericMSGenerator();

            DeconToolsV2.Peaks.clsPeakProcessorParameters peakDetParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            peakDetParams.SignalToNoiseThreshold = 3;
            peakDetParams.PeakBackgroundRatio    = 0.5;
            Task peakDetector = new DeconToolsPeakDetector(peakDetParams);

            Task thrashDecon = new HornDeconvolutor();
            Task rapidDecon  = new RapidDeconvolutor();

            taskCollection.TaskList.Add(msgen);
            taskCollection.TaskList.Add(peakDetector);
            taskCollection.TaskList.Add(thrashDecon);


            TaskController taskcontroller = new BasicTaskController(taskCollection);

            taskcontroller.Execute(Project.getInstance().RunCollection);

            Assert.AreEqual(644, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count);


            taskCollection.TaskList.Remove(thrashDecon);
            taskCollection.TaskList.Add(rapidDecon);

            Project.getInstance().RunCollection[0].ResultCollection.ResultList.Clear();

            taskcontroller.Execute(Project.getInstance().RunCollection);
            Assert.AreEqual(2472, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count);

            Project.getInstance().RunCollection[0].ResultCollection.ResultList.Clear();
            taskCollection.TaskList.Remove(rapidDecon);
            taskCollection.TaskList.Add(thrashDecon);
            taskCollection.TaskList.Add(rapidDecon);

            taskcontroller.Execute(Project.getInstance().RunCollection);
            Assert.AreEqual(2472 + 644, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count);
        }
示例#15
0
        public void fitterOnHornDataTest2()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            ResultCollection results = new ResultCollection(run);

            run.CurrentScanSet = new ScanSet(6005);


            Task msGen = new GenericMSGenerator(579, 582);

            msGen.Execute(results);

            DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detectorParams.PeakBackgroundRatio    = 0.5;
            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 HornDeconvolutor();

            decon.Execute(results);


            IsosResult result1    = results.ResultList[1];
            double     resolution = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM();

            MercuryDistributionCreator distcreator = new MercuryDistributionCreator();

            distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution);
            StringBuilder sb          = new StringBuilder();
            XYData        theorXYData = distcreator.Data;

            //TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues);



            distcreator.OffsetDistribution(result1.IsotopicProfile);



            TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues);

            Console.WriteLine(sb.ToString());

            AreaFitter areafitter = new AreaFitter(theorXYData, run.XYData, 10);
            double     fitval     = areafitter.getFit();

            Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval);
            Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score * 100);

            Assert.AreEqual(0.0704215577242672, (decimal)fitval);
        }
示例#16
0
        public void xcaliburSpeed_RAPID_Test1()
        {
            Run run       = new XCaliburRun(xcaliburTestfile);
            int startScan = 6005;
            int stopScan  = 7000;

            int numScansSummed = 1;

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

            scanSetCreator.Create();

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

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            foreach (ScanSet scanset in run.ScanSetCollection.ScanSetList)
            {
                if (results.Run.GetMSLevel(scanset.PrimaryScanNumber) != 1)
                {
                    continue;
                }

                sw.Reset();
                timingResult timeresult = new timingResult();
                timeresult.frameNum = -1;
                timeresult.scanNum  = scanset.PrimaryScanNumber;
                sw.Start();

                run.CurrentScanSet = scanset;
                Task msgen = new GenericMSGenerator();
                msgen.Execute(results);

                timeresult.msGenTime = sw.ElapsedMilliseconds;

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

                sw.Reset();
                sw.Start();
                Task rapid = new RapidDeconvolutor();
                rapid.Execute(results);
                timeresult.deconTime = sw.ElapsedMilliseconds;

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

                timingResults.Add(timeresult);
            }
            reportTimingEachScan(timingResults);
        }
        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 examineRAWFile_Scan6757()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            run.MSParameters       = new DeconTools.Backend.Parameters.MSParameters();
            run.CurrentScanSet     = new ScanSet(6757);
            run.MSParameters.MinMZ = 0;
            run.MSParameters.MaxMZ = 10000;

            ResultCollection rc = new ResultCollection(run);

            Task msGen = new GenericMSGenerator(run.MSParameters.MinMZ, run.MSParameters.MaxMZ);

            msGen.Execute(rc);

            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 zeroFiller = new DeconToolsZeroFiller(3);
            //zeroFiller.Execute(rc);

            Task peakDetector = new DeconToolsPeakDetector(detectorParams);

            peakDetector.Execute(rc);

            Task decon = new RapidDeconvolutor();

            decon.Execute(rc);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < rc.ResultList.Count; i++)
            {
                IsosResult result = rc.ResultList[i];
                if (result.IsotopicProfile.Peaklist[0].XValue > 0 && result.IsotopicProfile.Peaklist[0].XValue < 10000)
                {
                    sb.Append(result.IsotopicProfile.Peaklist[0].XValue.ToString("0.00"));
                    sb.Append("\t");
                    sb.Append(result.IsotopicProfile.Score.ToString("0.00"));
                    sb.Append("\t");
                    sb.Append(result.IsotopicProfile.Peaklist[0].SN.ToString("0.0"));
                    sb.Append("\t");
                    sb.Append(result.Run.PeakList.Count);
                    sb.Append("\t");
                    sb.Append(result.Run.XYData.Xvalues.Length);

                    sb.Append("\n");
                }
            }
            Console.Write(sb.ToString());
        }
        public void basicCreatorTestWithAlternateConstructorTest2()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            ScanSetCollectionCreator creator = new ScanSetCollectionCreator(run, 6000, 7000, 1, 1, false);

            creator.Create();

            Assert.AreEqual(145, run.ScanSetCollection.ScanSetList.Count);
            Assert.AreEqual(new int[] { 6005 }, run.ScanSetCollection.ScanSetList[0].IndexValues.ToArray());     //first scan is 6005, a MS-level scan
        }
        public void basicCreatorTestWithAlternateConstructorTest4()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            ScanSetCollectionCreator creator = new ScanSetCollectionCreator(run, 1, 19000, 1, 1, false);     //get all MS-Level scans

            creator.Create();

            Assert.AreEqual(2695, run.ScanSetCollection.ScanSetList.Count);
            Assert.AreEqual(new int[] { 1 }, run.ScanSetCollection.ScanSetList[0].IndexValues.ToArray());
        }
        public void outputToText_xcaliburData_Test1()
        {
            string testFile = xcalibur_text_IsosResultOutputFile1;

            List <Run> runcoll = new List <Run>();
            Run        run     = new XCaliburRun(xcaliburFile1);

            runcoll.Add(run);

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 6000, 6020, 1, 1, false);

            sscc.Create();

            Task msgen        = new GenericMSGenerator();
            Task peakDetector = new DeconToolsPeakDetector();
            Task decon        = new HornDeconvolutor();
            Task flagger      = new ResultValidatorTask();
            Task isosExporter = new DeconTools.Backend.ProcessingTasks.ResultExporters.IsosResultExporters.BasicIsosResultTextFileExporter(testFile);
            Task peakExporter = new DeconTools.Backend.ProcessingTasks.PeakListExporters.PeakListSQLiteExporter(100000, peakExporter1);


            Stopwatch sw;

            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);

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

                isosExporter.Execute(run.ResultCollection);
                sw.Stop();
                if (sw.ElapsedMilliseconds > 10)
                {
                    Console.WriteLine("Exporter execution time = \t" + sw.ElapsedMilliseconds);
                }

                peakExporter.Execute(run.ResultCollection);
            }

            Assert.AreEqual(true, File.Exists(testFile));

            FileInfo fi = new FileInfo(testFile);

            //Assert.AreEqual(25881, fi.Length);
            Console.Write(fi.Length);
        }
示例#22
0
        public void test3()
        {
            MassTag massTag = new MassTag();

            massTag.ID = 56488;
            massTag.MonoIsotopicMass = 2275.1694779;
            massTag.ChargeState      = 3;
            massTag.MZ     = massTag.MonoIsotopicMass / massTag.ChargeState + 1.00727649;
            massTag.NETVal = 0.3520239f;


            Run run = new XCaliburRun(xcaliburTestfile);
            ChromAlignerUsingVIPERInfo chromAligner = new ChromAlignerUsingVIPERInfo();

            chromAligner.Execute(run);


            PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburPeakDataFile);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);


            run.CurrentMassTag = massTag;

            Task peakChromGen = new PeakChromatogramGenerator(20);

            Task smoother     = new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(2, 2, 2);
            Task peakDet      = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector();
            Task chromPeakSel = new DeconTools.Backend.ProcessingTasks.ChromPeakSelector(1, 0.1);

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



            peakChromGen.Execute(run.ResultCollection);
            smoother.Execute(run.ResultCollection);
            peakDet.Execute(run.ResultCollection);
            chromPeakSel.Execute(run.ResultCollection);


            Console.WriteLine("Now generating MS....");
            msgen.Execute(run.ResultCollection);
            Console.WriteLine("----------- RESULTS ----------------------\n");
            TestUtilities.DisplayPeaks(run.PeakList);


            MassTagResultBase massTagResult = run.ResultCollection.MassTagResultList[massTag];

            massTagResult.DisplayToConsole();
            Assert.AreEqual(5512, massTagResult.ScanSet.PrimaryScanNumber);
        }
        public void basicCreatorTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

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

            creator.Create();

            Assert.AreEqual(2695, run.ScanSetCollection.ScanSetList.Count);

            TestUtilities.DisplayScanSetData(run.ScanSetCollection.ScanSetList);
            //Assert.AreEqual(new int[] { 0, 1, 2 }, run.ScanSetCollection.ScanSetList[0].IndexValues.ToArray());
            //Assert.AreEqual(new int[] { 18504, 18505 }, run.ScanSetCollection.ScanSetList[18504].IndexValues.ToArray());
        }
示例#24
0
        public void outputToText_xcaliburData_Test1()
        {
            List <Run> runcoll = new List <Run>();
            Run        run     = new XCaliburRun(xcaliburFile1);

            runcoll.Add(run);

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

            sscc.Create();

            Task msgen                  = new GenericMSGenerator();
            Task peakDetector           = new DeconToolsPeakDetector();
            Task decon                  = new RapidDeconvolutor();
            Task textScanResultExporter = new DeconTools.Backend.ProcessingTasks.ResultExporters.ScanResultExporters.BasicScanResult_TextFileExporter(xcalibur_text_ScanResultOutputFile1);
            Task scanResultUpdater      = new ScanResultUpdater();

            Stopwatch sw;

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

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

                textScanResultExporter.Execute(run.ResultCollection);
                sw.Stop();
                if (sw.ElapsedMilliseconds > 10)
                {
                    Console.WriteLine("Exporter execution time = \t" + sw.ElapsedMilliseconds);
                }
            }



            //TaskCollection taskColl=new TaskCollection();
            //taskColl.TaskList.Add(msgen);
            //taskColl.TaskList.Add(peakDetector);
            //taskColl.TaskList.Add(decon);
            //taskColl.TaskList.Add(sqliteExporter);

            //TaskController controller = new BasicTaskController(taskColl);
            //controller.Execute(runcoll);
        }
示例#25
0
        public void xcaliburFileMSMSDataTest1()
        {
            //exploring how only MSMS data is processed...

            Project.Reset();

            Run run = new XCaliburRun(xcaliburTestfile, 6000, 6004);    //only MS/MS data here
            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, run.MinScan, run.MaxScan, 1, 1);

            sscc.Create();

            Project project = Project.getInstance();

            project.RunCollection.Add(run);

            Task msGen = new GenericMSGenerator();

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

            DeconToolsV2.HornTransform.clsHornTransformParameters hornparams = new DeconToolsV2.HornTransform.clsHornTransformParameters();
            hornparams.PeptideMinBackgroundRatio = 2;
            Task hornDecon = new HornDeconvolutor(hornparams);

            project.TaskCollection.TaskList.Add(msGen);
            project.TaskCollection.TaskList.Add(peakDetector);
            project.TaskCollection.TaskList.Add(hornDecon);

            Stopwatch sw = new Stopwatch();

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

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

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

//            Assert.AreEqual(21, project.RunCollection[0].ScanSetCollection.ScanSetList.Count);
            Assert.AreEqual(0, project.RunCollection[0].ResultCollection.ResultList.Count);

            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);
        }
示例#26
0
        public void xcaliburFile100ScanRAPIDTest1()
        {
            Project.Reset();

            Run run = new XCaliburRun(xcaliburTestfile, 6000, 6999);

            Project project = Project.getInstance();

            project.RunCollection.Add(run);

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

            sscc.Create();



            Task msGen = new GenericMSGenerator();

            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();

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

            Stopwatch sw = new Stopwatch();

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

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

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

            Assert.AreEqual(1000, project.RunCollection[0].ScanSetCollection.ScanSetList.Count);
            Assert.AreEqual(12762, project.RunCollection[0].ResultCollection.ResultList.Count);

            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);
        }
示例#27
0
        public void MSGeneratorOnXCaliburFileTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            run.CurrentScanSet = new ScanSet(6067);

            ResultCollection resultcollection = new ResultCollection(run);
            Task             msgen            = new GenericMSGenerator();

            msgen.Execute(resultcollection);

            Assert.AreEqual(27053, run.XYData.Xvalues.Length);
            Assert.AreEqual(1, run.GetMSLevel(run.CurrentScanSet.PrimaryScanNumber));
            Assert.AreEqual(3558996224, (long)run.CurrentScanSet.TICValue);
        }
        public void basicCreatorTestWithAlternateConstructor_MSMSIncludedTest1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);

            ScanSetCollectionCreator creator = new ScanSetCollectionCreator(run, 6000, 7000, 3, 1, true);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            creator.Create();
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            //Assert.AreEqual(1001, run.ScanSetCollection.ScanSetList.Count);
            Assert.AreEqual(new int[] { 5999, 6000, 6001 }, run.ScanSetCollection.ScanSetList[0].IndexValues.ToArray());
        }
示例#29
0
        public void test1()
        {
            Run run0 = new XCaliburRun(c2_blankfilePath);
            Run run1 = new XCaliburRun(c2_6FilePath);
            Run run2 = new XCaliburRun(c2_7FilePath);
            Run run3 = new XCaliburRun(c2_8FilePath);
            Run run4 = new XCaliburRun(c2_9FilePath);
            Run run5 = new XCaliburRun(c2_10FilePath);



            Project.getInstance().RunCollection.Add(run0);
            Project.getInstance().RunCollection.Add(run1);
            Project.getInstance().RunCollection.Add(run2);
            Project.getInstance().RunCollection.Add(run3);
            Project.getInstance().RunCollection.Add(run4);
            Project.getInstance().RunCollection.Add(run5);

            foreach (Run run in Project.getInstance().RunCollection)
            {
                ScanSetCollectionCreator scansetCreator = new ScanSetCollectionCreator(run, 1, 1);
                scansetCreator.Create();
            }

            Task msgen               = new GenericMSGenerator();
            Task peakDetector        = new DeconToolsPeakDetector();
            Task decon               = new SimpleDecon();
            Task isosMergerExporter  = new BasicIsosMergerExporter("..\\..\\TestFiles\\MergeTestFiles\\BasicIsosMergerExporterTest1Output_isos.csv");
            Task scansupdater        = new ScanResultUpdater();
            Task scansMergerExporter = new BasicScansMergerExporter("..\\..\\TestFiles\\MergeTestFiles\\BasicIsosMergerExporterTest1Output_scans.csv");



            Project.getInstance().TaskCollection.TaskList.Add(msgen);
            Project.getInstance().TaskCollection.TaskList.Add(peakDetector);
            Project.getInstance().TaskCollection.TaskList.Add(decon);
            Project.getInstance().TaskCollection.TaskList.Add(isosMergerExporter);
            Project.getInstance().TaskCollection.TaskList.Add(scansupdater);
            Project.getInstance().TaskCollection.TaskList.Add(scansMergerExporter);

            BasicTaskController taskController = new BasicTaskController(Project.getInstance().TaskCollection);

            taskController.Execute(Project.getInstance().RunCollection);

            TaskCleaner cleaner = new TaskCleaner(Project.getInstance().TaskCollection);

            cleaner.CleanTasks();
        }
        public void examineEffectOfIntensityCutoffOnRapidTest1()
        {
            Project project = Project.getInstance();

            project.Parameters.OldDecon2LSParameters = new OldDecon2LSParameters();


            Run run = new XCaliburRun(xcaliburTestfile, 6000, 7000);

            project.RunCollection.Add(run);

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

            scansetCreator.Create();

            ResultCollection results = new ResultCollection(run);


            foreach (ScanSet scanset in run.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);

                for (int i = 1; i < 6; i++)
                {
                    results.ResultList.Clear();

                    Task rapidDecon = new RapidDeconvolutor(i, DeconTools.Backend.ProcessingTasks.IDeconvolutor.DeconResultComboMode.simplyAddIt);
                    rapidDecon.Execute(results);

                    //Console.WriteLine(scanset.PrimaryScanNumber + "\t" + i + "\t" +
                    //     results.ResultList.Count + "\t" + results.Run.CurrentScanSet.BackgroundIntensity);
                }
            }
        }