コード例 #1
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);
        }
コード例 #2
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);
        }