Esempio n. 1
0
        public void ConstructorError_wrongKindOfInputTest1()
        {
            var ex = Assert.Throws <PreconditionException>(delegate
            {
                Run run = new DeconTools.Backend.Runs.AgilentDRun(wrongFileExample1);
            });

            Assert.That(ex.Message, Is.EqualTo("Dataset's inputted name refers to a file, but should refer to a Folder"));
        }
Esempio n. 2
0
        public void ConstructorError_wrongKindOfInputTest3()
        {
            var ex = Assert.Throws <PreconditionException>(delegate
            {
                Run run = new DeconTools.Backend.Runs.AgilentDRun(@"J:\test");
            });

            Assert.That(ex.Message, Is.EqualTo("Dataset not found."));
        }
Esempio n. 3
0
        public void disposeTest1()
        {
            Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentDataset1);

            using (var disposedRun = run)
            {
                Assert.AreEqual(62, disposedRun.GetNumMSScans());
            }
        }
Esempio n. 4
0
        public void ConstructorTest1()
        {
            Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentDataset1);

            Assert.AreEqual("BSA_TOF4", run.DatasetName);
            Assert.AreEqual(@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\AgilentD\BSA_TOF4\BSA_TOF4.D", run.DataSetPath);

            Assert.AreEqual(61, run.MaxLCScan);
            Assert.AreEqual(0, run.MinLCScan);
            Assert.AreEqual(Globals.MSFileType.Agilent_D, run.MSFileType);
        }
Esempio n. 5
0
        public void GetSpectrumTest1()
        {
            Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentDataset1);

            var scanset = new ScanSet(25);
            var xydata  = new XYData();

            xydata = run.GetMassSpectrum(scanset, 0, 6000);
            //TestUtilities.DisplayXYValues(xydata);
            Console.WriteLine("numPoints = " + xydata.Xvalues.Length);
            Assert.AreEqual(156723, xydata.Xvalues.Length);
        }
Esempio n. 6
0
        ///  Writes three spectra files to disk so that the data can be compared before and after summing
        public void GetSummedSpectrumTestWriteToDisk()
        {
            var testfile =
                @"\\proto-5\BionetXfer\People\ScottK\2012_01_12 SPIN QTOF3\GLY06_11JAN12_LYNX_SN7980_TOP4wList_75000_SPIN_2.d";

            Run run = new DeconTools.Backend.Runs.AgilentDRun(testfile);

            var primaryScan = 10000;
            //Scan A
            var scansetA = new ScanSet(primaryScan - 1);
            var xydata   = new XYData();

            xydata = run.GetMassSpectrum(scansetA, 0, 6000);

            TestUtilities.WriteToFile(xydata, @"P:\ScanA.txt");

            TestUtilities.DisplayXYValues(xydata);
            Console.WriteLine("numPoints = " + run.XYData.Xvalues.Length);
            Assert.AreEqual(258899, run.XYData.Xvalues.Length);

            //Scan B
            var scansetB = new ScanSet(primaryScan);

            xydata = run.GetMassSpectrum(scansetB, 0, 6000);

            TestUtilities.WriteToFile(run.XYData, @"P:\ScanB.txt");

            TestUtilities.DisplayXYValues(run.XYData);
            Console.WriteLine("numPoints = " + run.XYData.Xvalues.Length);
            Assert.AreEqual(258899, run.XYData.Xvalues.Length);

            //Scan C
            var scansetC = new ScanSet(primaryScan + 1);

            xydata = run.GetMassSpectrum(scansetC, 0, 6000);

            TestUtilities.WriteToFile(run.XYData, @"P:\ScanC.txt");

            TestUtilities.DisplayXYValues(run.XYData);
            Console.WriteLine("numPoints = " + run.XYData.Xvalues.Length);
            Assert.AreEqual(258899, run.XYData.Xvalues.Length);

            //Scan ABC summed
            var scansetSum = new ScanSet(primaryScan, primaryScan - 1, primaryScan + 1);//primary, min, max

            xydata = run.GetMassSpectrum(scansetSum, 0, 6000);

            TestUtilities.WriteToFile(run.XYData, @"P:\ScanABC.txt");

            TestUtilities.DisplayXYValues(run.XYData);
            Console.WriteLine("numPoints = " + run.XYData.Xvalues.Length);
            Assert.AreEqual(258899, run.XYData.Xvalues.Length);
        }
Esempio n. 7
0
        public void ConstructorError_wrongKindOfInputTest4()
        {
            var ex = Assert.Throws <PreconditionException>(delegate
            {
                var dirinfo = new DirectoryInfo(agilentDataset1);

                var agilentFileButMissingDotD = dirinfo.Parent.FullName;

                Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentFileButMissingDotD);
            });

            Assert.That(ex.Message, Is.EqualTo("Agilent_D dataset folders must end with with the suffix '.d'. Check your folder name."));
        }
Esempio n. 8
0
        ///checks the length of a non-summed and summed spectra
        public void GetSummedSpectrumTest1()
        {
            var testfile =
                @"\\proto-5\BionetXfer\People\ScottK\2012_01_12 SPIN QTOF3\GLY06_11JAN12_LYNX_SN7980_TOP4wList_75000_SPIN_2.d";

            var stopWatch = new Stopwatch();


            Run run = new DeconTools.Backend.Runs.AgilentDRun(testfile);

            var scanset = new ScanSet(25);

            stopWatch.Start();

            var xydata = new XYData();

            xydata = run.GetMassSpectrum(scanset);

            stopWatch.Stop();
            var singleSpectraLoadTime = stopWatch.Elapsed;

            TestUtilities.DisplayXYValues(run.XYData);
            Console.WriteLine("numPoints = " + run.XYData.Xvalues.Length);
            Assert.AreEqual(258899, run.XYData.Xvalues.Length);


            var scansetSum = new ScanSet(25, 24, 26);

            stopWatch.Start();

            xydata = run.GetMassSpectrum(scansetSum);

            stopWatch.Stop();
            var threeScanSumSpectraLoadTime = stopWatch.Elapsed;


            TestUtilities.DisplayXYValues(run.XYData);
            Console.WriteLine("numPoints = " + run.XYData.Xvalues.Length);
            Console.WriteLine("This took " + singleSpectraLoadTime + " seconds to load one scan");
            Console.WriteLine("This took " + threeScanSumSpectraLoadTime + " seconds to load and sum three scans");
            Assert.AreEqual(258899, run.XYData.Xvalues.Length);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        public void getNumMSScansTest1()
        {
            Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentDataset1);

            Assert.AreEqual(62, run.GetNumMSScans());
        }
Esempio n. 12
0
        public void getTimeTest1()
        {
            Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentDataset1);

            Assert.AreEqual(0.414033333333333m, (decimal)run.GetTime(25));
        }
Esempio n. 13
0
        public void getMSLevelTest1()
        {
            Run run = new DeconTools.Backend.Runs.AgilentDRun(agilentDataset1);

            Assert.AreEqual(1, run.GetMSLevel(25));
        }