public void peak_interference_UIMF_expectInterference_test1()
        {
            var uimfFrame1200_142 = FileRefs.RawDataBasePath + @"\UIMF\Sarc_MS_90_21Aug10_Cheetah_10-08-02_0000_frame1200_scan142.txt";

            Run run = new DeconTools.Backend.Runs.MSScanFromTextFileRun(uimfFrame1200_142);

            var scanSet = new ScanSet(0);

            run.CurrentScanSet = scanSet;

            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            msgen.MinMZ = 200;
            msgen.MaxMZ = 2000;

            var peakDetector = new DeconToolsPeakDetectorV2(4, 3, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true);

            var decon = new HornDeconvolutor();

            decon.MinIntensityForScore     = 10;
            decon.DeleteIntensityThreshold = 10;
            decon.MaxFitAllowed            = 0.4;
            decon.MinMZ         = 200;
            decon.MaxMZ         = 2000;
            decon.IsMZRangeUsed = false;


            var zeroFiller = new DeconToolsZeroFiller();

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

            peakDetector.Execute(run.ResultCollection);
            decon.Execute(run.ResultCollection);

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

            var testResult = run.ResultCollection.ResultList.Where(p => p.IsotopicProfile.MonoPeakMZ > 428 && p.IsotopicProfile.MonoPeakMZ < 430).First();

            var monoPeak = testResult.IsotopicProfile.getMonoPeak();
            var lastPeak = testResult.IsotopicProfile.Peaklist[testResult.IsotopicProfile.Peaklist.Count - 1];

            var startIndexOfXYData = MathUtils.BinarySearchWithTolerance(run.XYData.Xvalues, monoPeak.XValue - 3, 0, (run.XYData.Xvalues.Length - 1), 2);

            //interference scorer

            var interferenceScorer = new InterferenceScorer();

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var scanPeaks         = run.PeakList.Select <Peak, MSPeak>(i => (MSPeak)i).ToList();
            var interferenceScore = interferenceScorer.GetInterferenceScore(scanPeaks, testResult.IsotopicProfile.Peaklist, monoPeak.XValue - 1.1,
                                                                            lastPeak.XValue + lastPeak.Width);

            stopwatch.Stop();

            Console.WriteLine("interference= " + interferenceScore);
            Console.WriteLine("Time taken = " + stopwatch.ElapsedMilliseconds);
        }
Example #2
0
        public Run CreateRun(string filename)
        {
            Run run;

            var fullfileName = getFullPath(filename);

            var extension = Path.GetExtension(fullfileName).ToLower();

            if (extension.Equals(".mzxml") || extension.Equals(".mzml") || extension.Equals(".mz5"))
            {
                pwiz.ProteowizardWrapper.DependencyLoader.ValidateLoader();
            }

#if !Disable_DeconToolsV2
            //check for ICR2LS type extension....
            var match = Regex.Match(extension, @"\.\d\d\d\d\d$");
            if (match.Success)
            {
                return(new ICR2LSRun(fullfileName));
            }
#endif

            var fileNameWithoutPathOrExtension = Path.GetFileNameWithoutExtension(fullfileName).ToLower();

            var dirInfo  = new DirectoryInfo(fullfileName);
            var isFolder = dirInfo.Exists;

            if (isFolder)
            {
                run = determineIfRunIsABrukerTypeAndCreateRun(fullfileName);

                if (run != null)
                {
                    return(run);
                }
                else
                {
                    // there was likely some problem... but will let the remaining code execute and see if ms filetype can
                    // be determined from the extension.
                }
            }


            switch (extension)
            {
            case ".raw":
                run = new XCaliburRun2(fullfileName);
                break;

#if !Disable_DeconToolsV2
            case ".imf":
                run = new IMFRun(fullfileName);
                break;
#endif
            case ".txt":
                run = new MSScanFromTextFileRun(fullfileName);
                break;

            case ".mzxml":
                run = new MzRun(fullfileName);
                break;

            case ".mz5":
                run = new MzRun(fullfileName);
                break;

            case ".mzml":
                run = new MzRun(fullfileName);
                break;

            case ".uimf":
                run = new UIMFRun(fullfileName);
                break;

            case ".db":                                //might want to remove this later
                run = new UIMFRun(fullfileName);
                break;

            case ".d":
                run = new AgilentDRun(fullfileName);
                break;

            // Deprecated in February 2017
            // case ".yafms":
            //     run = new YAFMSRun(fullfileName);
            //     break;

            default:
                throw new ApplicationException("File type - " + extension + " -  is not supported in DeconTools");
            }

            Check.Require(run != null, "Run failed to be initialized. Run object is empty. I'm guessing the datafile either 1) corrupt or 2) not supported by the installed instrument manufacturer's dlls, or 3) not supported by DeconTools");
            return(run);
        }
Example #3
0
        public Run CreateRun(Globals.MSFileType filetype, string f)
        {
            Run run;

            if (filetype == Globals.MSFileType.MZXML_Rawdata)
            {
                pwiz.ProteowizardWrapper.DependencyLoader.ValidateLoader();
            }

            var fileName = getFullPath(f);

            switch (filetype)
            {
            case Globals.MSFileType.Undefined:
                run = null;
                break;

            case Globals.MSFileType.Agilent_WIFF:
                run = null;
                break;

            case Globals.MSFileType.Agilent_D:
                run = new AgilentDRun(fileName);
                break;

            case Globals.MSFileType.Ascii:
                run = new MSScanFromTextFileRun(fileName);
                break;

            case Globals.MSFileType.Bruker:
                run = new BrukerV3Run(fileName);
                break;

#if !Disable_DeconToolsV2
            case Globals.MSFileType.Bruker_V2:
                run = new BrukerV2Run(fileName);
                break;
#endif
            case Globals.MSFileType.Bruker_Ascii:
                run = null;
                break;

            case Globals.MSFileType.Finnigan:
                run = new XCaliburRun2(fileName);
                break;

            case Globals.MSFileType.ICR2LS_Rawdata:
                run = null;
                break;

            case Globals.MSFileType.Micromass_Rawdata:
                run = null;
                break;

            case Globals.MSFileType.MZXML_Rawdata:
                run = new MzRun(fileName);
                break;

#if !Disable_DeconToolsV2
            case Globals.MSFileType.PNNL_IMS:
                run = new IMFRun(fileName);
                break;
#endif
            case Globals.MSFileType.PNNL_UIMF:
                run = new UIMFRun(fileName);
                break;

            case Globals.MSFileType.SUNEXTREL:
                run = null;
                break;

            // Deprecated in February 2017
            // case Globals.MSFileType.YAFMS:
            //    run = new YAFMSRun(fileName);
            //    break;
            default:
                run = null;
                break;
            }

            return(run);
        }