Example #1
0
        public void instiatateRunTest1()
        {
            Run run = new IMFRun(FileRefs.RawDataMSFiles.IMFStdFile1);

            Assert.AreEqual(Path.GetDirectoryName(FileRefs.RawDataMSFiles.IMFStdFile1), run.DataSetPath);
            Assert.AreEqual("50ugpmlBSA_CID_QS_16V_0000.Accum_1", run.DatasetName);
        }
Example #2
0
        public void GetMassSpectrumTest1()
        {
            Run run = new IMFRun(FileRefs.RawDataMSFiles.IMFStdFile1);

            var xydata = run.GetMassSpectrum(new ScanSet(233), 200, 2000);

            var numscans = run.GetNumMSScans();

            Assert.AreEqual(600, numscans);

            var xvals = new float[1];
            var yvals = new float[1];

            xydata.GetXYValuesAsSingles(ref xvals, ref yvals);


            var sb = new StringBuilder();

            for (var i = 0; i < xvals.Length; i++)
            {
                sb.Append(xvals[i]);
                sb.Append("\t");
                sb.Append(yvals[i]);
                sb.Append(Environment.NewLine);
            }
            Console.Write(sb.ToString());

            Assert.AreEqual(2595, xvals.Length);
            Assert.AreEqual(2595, yvals.Length);
        }
        public void exporterTest1()
        {
            Run run = new IMFRun(imfFilepath);

            run.CurrentScanSet = new ScanSet(233);

            ResultCollection results = new ResultCollection(run);
            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);

            DeconToolsV2.HornTransform.clsHornTransformParameters hornParams = new DeconToolsV2.HornTransform.clsHornTransformParameters();
            Task decon = new HornDeconvolutor(hornParams);

            decon.Execute(results);

            Exporter <ResultCollection> exporter = new BasicIsosExporter(exporterTest1OutputName);

            exporter.Export(results);
        }
Example #4
0
        public void GetSpectrumTypesTest1()
        {
            Run run = new IMFRun(FileRefs.RawDataMSFiles.IMFStdFile1);

            Assert.AreEqual(1, run.GetMSLevel(233));    //this function hasn't yet been implemented for IMF files
            Assert.AreEqual(1, run.GetMSLevel(234));
            Assert.AreEqual(1, run.GetMSLevel(235));
        }
        public void examineIMFFile_Scan233MZ630()
        {
            Run run = new IMFRun(imfFilepath);

            run.MSParameters       = new DeconTools.Backend.Parameters.MSParameters();
            run.CurrentScanSet     = new ScanSet(233, 229, 237);
            run.MSParameters.MinMZ = 100;
            run.MSParameters.MaxMZ = 631.5;

            int numPeaks = 0;

            for (double n = 629; n < 630; n = n + 0.01)
            {
                ResultCollection rc = new ResultCollection(run);

                Task msGen = new GenericMSGenerator(n, 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 > 629 && result.IsotopicProfile.Peaklist[0].XValue < 631)
                    {
                        sb.Append(n.ToString("0.00"));
                        sb.Append("\t");
                        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.Run.PeakList.Count);
                        sb.Append("\t");
                        sb.Append(result.Run.XYData.Xvalues.Length);

                        sb.Append("\n");
                    }
                }
                Console.Write(sb.ToString());
            }
        }
Example #6
0
        public void MSGeneratorOnIMFFileTest1()
        {
            Run run = new IMFRun(imfFilepath);

            run.CurrentScanSet = new ScanSet(233, 229, 237);

            run.GetMassSpectrum(run.CurrentScanSet, 200, 2000);

            Assert.AreEqual(9908, run.XYData.Xvalues.Length);
        }
Example #7
0
        public void GetMassSpectrumAndSumAllTest()
        {
            Run run    = new IMFRun(FileRefs.RawDataMSFiles.IMFStdFile1);
            var xydata = run.GetMassSpectrum(new ScanSet(10000, 1, 20000), 200, 2000);      // this will sum scans 1 through 20000 (if <20000 scans, then will sum all available)

            var numscans = run.GetNumMSScans();

            Assert.AreEqual(600, numscans);
            Assert.AreEqual(38326, xydata.Xvalues.Length);
            Assert.AreEqual(38326, xydata.Yvalues.Length);
        }
        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);
        }
Example #9
0
        public void MSGeneratorOnIMFFileTest2()
        {
            Run run = new IMFRun(imfFilepath);

            run.CurrentScanSet = new ScanSet(233, 229, 237);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(run.ResultCollection);

            Assert.AreEqual(9917, run.XYData.Xvalues.Length);
            Assert.AreEqual(1, run.GetMSLevel(run.CurrentScanSet.PrimaryScanNumber));
        }
Example #10
0
        public void imfFile100ScansTest1()
        {
            Project.Reset();
            Project project = Project.getInstance();

            Run run = new IMFRun(imfFilepath, 200, 299);

            project.RunCollection.Add(run);

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

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

            scanSetCreator.Create();



            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(100, project.RunCollection[0].ScanSetCollection.ScanSetList.Count);
            Assert.AreEqual(1070, 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);
        }
Example #11
0
        public void FindMSPeaksTest1()
        {
            ParameterLoader loader = new ParameterLoader();

            loader.LoadParametersFromFile(parameterFilename);

            Run run = new IMFRun(imfFilepath);


            run.CurrentScanSet = new ScanSet(1, 1, 100000);

            ResultCollection resultcollection = new ResultCollection(run);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(resultcollection);

            DeconToolsPeakDetector peakfinder = new DeconToolsPeakDetector(loader.PeakParameters);

            peakfinder.Execute(resultcollection);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < resultcollection.Run.PeakList.Count; i++)
            {
                MSPeak mspeak = (MSPeak)resultcollection.Run.PeakList[i];


                sb.Append(resultcollection.Run.PeakList[i].XValue);
                sb.Append("\t");
                sb.Append(resultcollection.Run.PeakList[i].Height);
                sb.Append("\t");
                sb.Append(mspeak.SN);
                sb.Append("\t");
                sb.Append(resultcollection.Run.PeakList[i].Width);
                sb.Append("\t");
                sb.Append(Environment.NewLine);
            }
            Console.Write(sb.ToString());

            Assert.AreEqual(2438, resultcollection.Run.PeakList.Count);
            Assert.AreEqual(547.316411323136, Convert.ToDecimal(resultcollection.Run.PeakList[982].XValue));
            Assert.AreEqual(100385, resultcollection.Run.PeakList[982].Height);
        }
        public void deconvoluteIMFDataTest1()
        {
            Run run = new IMFRun(imfFilepath);

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

            ResultCollection results = new ResultCollection(run);

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

            rapid.Execute(results);

            Assert.AreEqual(9, results.ResultList.Count);
            Assert.AreEqual(582.820684517665, Convert.ToDecimal(results.ResultList[0].IsotopicProfile.Peaklist[0].XValue));
            Assert.AreEqual(2984.0, results.ResultList[0].IsotopicProfile.Peaklist[0].Height);
            Assert.AreEqual(0.05905123, (decimal)results.ResultList[0].IsotopicProfile.Peaklist[0].Width);
            Assert.AreEqual(157.0526, (decimal)results.ResultList[0].IsotopicProfile.Peaklist[0].SN);


            Assert.AreEqual(4593, results.ResultList[0].IsotopicProfile.GetAbundance());

            Assert.AreEqual(1, results.ResultList[8].IsotopicProfile.GetNumOfIsotopesInProfile());
            Assert.AreEqual(2488.07303881522, Convert.ToDecimal(results.ResultList[8].IsotopicProfile.AverageMass));
            Assert.AreEqual(3, results.ResultList[8].IsotopicProfile.ChargeState);
            Assert.AreEqual(18802, Convert.ToDecimal(results.ResultList[8].IsotopicProfile.IntensityAggregate));
            Assert.AreEqual(2486.09777364184, Convert.ToDecimal(results.ResultList[8].IsotopicProfile.MonoIsotopicMass));
            Assert.AreEqual(829.711934128853, Convert.ToDecimal(results.ResultList[8].IsotopicProfile.MonoPeakMZ));
        }
Example #13
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");
            }
        }
Example #14
0
        public void compareUIMF_and_IMF_XYDataPoints2()
        {
            Run uimfRun = new UIMFRun(uimfFilepath2);
            ResultCollection uimfResults = new ResultCollection(uimfRun);

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

            FrameSet uimfFrame = new FrameSet(391);


            ((UIMFRun)uimfRun).CurrentFrameSet = uimfFrame;



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



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

            scanSetCollectionCreator.Create();

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

            int scanStart = 200;
            int scanStop  = 400;

            StringBuilder sb = new StringBuilder();

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


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

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

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

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


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

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


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

            Console.Write(sb.ToString());
        }
        public void imf_projectRef_horn_test2()
        {
            Project.Reset();
            //Project.getInstance().RunCollection = new List<Run>();



            Run run = new IMFRun(imfFilePath);

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

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

            sscc.Create();



            Task msGen      = new GenericMSGenerator(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);

            HornDeconvolutor horn = (HornDeconvolutor)decon;



            Task scanResultsUpdater = new ScanResultUpdater();

            TaskCollection tc = new TaskCollection();

            tc.TaskList.Add(msGen);
            tc.TaskList.Add(zeroFiller);

            tc.TaskList.Add(peakDetector);
            tc.TaskList.Add(decon);
            tc.TaskList.Add(scanResultsUpdater);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            TaskController controller = new BasicTaskController(tc);

            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.Sum(p => p.NumPeaks));



            StringBuilder sb = new StringBuilder();
        }
Example #16
0
        public void multiIMFFileDeconTest1()
        {
            imfFileList.Clear();
            imfFileList.Add("..\\..\\TestFiles\\50ugpmlBSA_CID_QS_16V_0000.Accum_1.IMF");
            imfFileList.Add("..\\..\\TestFiles\\50ugpmlBSA_CID_QS_16V_0000.Accum_2.IMF");
            imfFileList.Add("..\\..\\TestFiles\\50ugpmlBSA_CID_SQ_14V_0000.Accum_1.IMF");


            Project.Reset();
            Project project = Project.getInstance();

            foreach (string strItem in imfFileList)
            {
                Run run = new IMFRun(strItem, 233, 233);
                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);

            DeconToolsV2.HornTransform.clsHornTransformParameters hornparams = new DeconToolsV2.HornTransform.clsHornTransformParameters();
            hornparams.PeptideMinBackgroundRatio = 5;
            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(3, Project.getInstance().RunCollection.Count);
            Assert.AreEqual(3, project.TaskCollection.TaskList.Count);

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


            int totalScans    = 0;
            int totalFeatures = 0;

            for (int i = 0; i < project.RunCollection.Count; i++)
            {
                Console.WriteLine("Run name = " + project.RunCollection[i].Filename);
                Console.WriteLine("Scans analyzed = " + project.RunCollection[i].ScanSetCollection.ScanSetList.Count);
                Console.WriteLine("Features found = " + project.RunCollection[i].ResultCollection.ResultList.Count);

                totalFeatures += project.RunCollection[i].ResultCollection.ResultList.Count;
                totalScans    += project.RunCollection[i].ScanSetCollection.ScanSetList.Count;
            }
            Console.WriteLine("------------------------------------------------");
            Console.WriteLine("Total Features found = " + totalFeatures);
            Console.WriteLine("Total Scans = " + totalScans);
            Console.WriteLine("Total Time required (ms) = " + sw.ElapsedMilliseconds);
        }
Example #17
0
        public void IMFcompareToCanonicalResults_noSumming()
        {
            //generate results using new framework

            int numScansSummed = 1;

            Run run = new IMFRun(imfFilepath);

            ResultCollection results = new ResultCollection(run);

            ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 231, 233, numScansSummed, 1, false);

            sscc.Create();

            ParameterLoader loader = new ParameterLoader();

            loader.LoadParametersFromFile(qtParameterfile1);

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


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

                Task horndecon = new HornDeconvolutor(loader.TransformParameters);
                horndecon.Execute(results);

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

            //read in results from canonical _isos
            List <IsosResult> canonIsos = readInIsos(canonIMFIsosFilename, Globals.MSFileType.PNNL_IMS);

            Assert.AreEqual(canonIsos.Count, results.ResultList.Count);

            //compare numbers

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < results.ResultList.Count; i++)
            {
                sb.Append("scanmass\t");
                sb.Append(results.ResultList[i].ScanSet.PrimaryScanNumber);
                sb.Append("\t");
                sb.Append(canonIsos[i].ScanSet.PrimaryScanNumber);
                sb.Append("\n");

                sb.Append("monoMass\t");
                sb.Append(results.ResultList[i].IsotopicProfile.MonoIsotopicMass.ToString("0.0000"));
                sb.Append("\t");
                sb.Append(canonIsos[i].IsotopicProfile.MonoIsotopicMass);
                sb.Append("\n");

                sb.Append("intens\t");
                sb.Append(results.ResultList[i].IsotopicProfile.IntensityAggregate);
                sb.Append("\t");
                sb.Append(canonIsos[i].IsotopicProfile.IntensityAggregate);
                sb.Append("\n");

                sb.Append("score\t");
                sb.Append(results.ResultList[i].IsotopicProfile.Score.ToString("0.0000"));
                sb.Append("\t");
                sb.Append(canonIsos[i].IsotopicProfile.Score);
                sb.Append("\n");

                sb.Append("FWHM\t");
                sb.Append(results.ResultList[i].IsotopicProfile.GetFWHM().ToString("0.0000"));
                sb.Append("\t");
                sb.Append(canonIsos[i].IsotopicProfile.GetFWHM());
                sb.Append("\n");

                sb.Append("s/n\t");
                sb.Append(results.ResultList[i].IsotopicProfile.GetSignalToNoise().ToString("0.0000"));
                sb.Append("\t");
                sb.Append(canonIsos[i].IsotopicProfile.GetSignalToNoise());
                sb.Append("\n");

                sb.Append("\n");
            }

            Console.Write(sb.ToString());
        }