예제 #1
0
        /// <summary>
        /// Gets the appropriate IMassSpecDataReader for the supplied path.
        /// It is recommended that "NormalizeDatasetPath" be called prior to calling this function, and that the returned string be used instead of the original path
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        /// <remarks>It is recommended that "NormalizeDatasetPath" be called prior to calling this function, and that the returned string be used instead of the original path</remarks>
        public static IMassSpecDataReader GetMassSpecDataReader(string filePath)
        {
            filePath = NormalizeDatasetPath(filePath);
            var type = GetMassSpecDataType(filePath);
            IMassSpecDataReader reader = null;
            switch (type)
            {
                case MassSpecDataType.XCaliburRun:
                    reader = new XCaliburReader(filePath);
                    break;
                case MassSpecDataType.MzMLFile:
                    reader = new MzMLReader(filePath);
                    break;
                case MassSpecDataType.PbfFile:
                    reader = new PbfLcMsRun(filePath);
                    break;
                case MassSpecDataType.Unknown:
                    if (_pwizAvailable)
                    {
                        reader = new ProteoWizardReader(filePath);
                    }
                    break;
            }

            return reader;
        }
예제 #2
0
        /// <summary>
        /// Gets the appropriate IMassSpecDataReader for the supplied path.
        /// It is recommended that "NormalizeDatasetPath" be called prior to calling this function, and that the returned string be used instead of the original path
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        /// <remarks>It is recommended that "NormalizeDatasetPath" be called prior to calling this function, and that the returned string be used instead of the original path</remarks>
        public static IMassSpecDataReader GetMassSpecDataReader(string filePath)
        {
            filePath = NormalizeDatasetPath(filePath);
            var type = GetMassSpecDataType(filePath);
            IMassSpecDataReader reader = null;

            switch (type)
            {
            case MassSpecDataType.XCaliburRun:
                reader = new XCaliburReader(filePath);
                break;

            case MassSpecDataType.MzMLFile:
                reader = new MzMLReader(filePath);
                break;

            case MassSpecDataType.PbfFile:
                reader = new PbfLcMsRun(filePath);
                break;

            case MassSpecDataType.Unknown:
                if (_pwizAvailable)
                {
                    reader = new ProteoWizardReader(filePath);
                }
                break;
            }

            return(reader);
        }
예제 #3
0
        public void TestLoadingProteoWizardWrapper()
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            TestUtils.ShowStarting(methodName);

            //try
            //{
            var reader = new ProteoWizardReader(TestRawFilePath);
            reader.ReadMassSpectrum(1);

            //}
            //catch (FileNotFoundException e)
            //{
            //    Console.WriteLine("FileNotFound: {0}", e.FileName);
            //}
            //var mzs = new[] {1.0};
            //var intensities = new[] {10000.0};
            //var centroider = new Centroider(mzs, intensities);
            //centroider.GetCentroidedData(out mzs, out intensities);
        }
예제 #4
0
        /// <summary>
        /// Gets the appropriate IMassSpecDataReader for the supplied path.
        /// It is recommended that "NormalizeDatasetPath" be called prior to calling this function, and that the returned string be used instead of the original path
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        /// <remarks>It is recommended that "NormalizeDatasetPath" be called prior to calling this function, and that the returned string be used instead of the original path</remarks>
        public static IMassSpecDataReader GetMassSpecDataReader(string filePath)
        {
            filePath = NormalizeDatasetPath(filePath);
            var type = GetMassSpecDataType(filePath);
            IMassSpecDataReader reader = null;

            switch (type)
            {
            case MassSpecDataType.XCaliburRun:
                reader = new XCaliburReader(filePath);
                break;

            case MassSpecDataType.MzMLFile:
                reader = new MzMLReader(filePath);
                break;

            case MassSpecDataType.PbfFile:
                reader = new PbfLcMsRun(filePath);
                break;

            case MassSpecDataType.DeconvolutedPbfFile:
                reader = new DPbfLcMsRun(filePath);
                break;

            case MassSpecDataType.Unknown:
                if (_pwizAvailable)
                {
                    reader = new ProteoWizardReader(filePath);
                }
                else
                {
                    ConsoleMsgUtils.ShowWarning(string.Format("WARNING: Could not find a reader for file \"{0}\"." +
                                                              " Is MSFileReader and/or ProteoWizard installed?", filePath));
                }
                break;
            }

            return(reader);
        }
예제 #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="filePath"></param>
        /// <remarks>To avoid assembly resolving errors, the ProteoWizardAssemblyResolver should be added as an AssemblyResolve event handler, as follows:
        /// <code>AppDomain.CurrentDomain.AssemblyResolve += ProteoWizardReader.ProteoWizardAssemblyResolver;</code>
        /// </remarks>
        public ProteoWizardReaderImplementation(string filePath)
        {
            AppDomain.CurrentDomain.AssemblyResolve += ProteoWizardAssemblyResolver;

            FilePath = ProteoWizardReader.CheckForDirectoryDataset(filePath);
        }
예제 #6
0
 /// <summary>
 /// Get the normalized dataset path; only returns a different string when the given path is to a file/folder in a folder-type dataset
 /// </summary>
 /// <param name="path"></param>
 /// <returns>Normalized dataset path</returns>
 public static string NormalizeDatasetPath(string path)
 {
     return(ProteoWizardReader.CheckForDirectoryDataset(path));
 }
예제 #7
0
 /// <summary>
 /// Utility function: Gets the actual dataset name, needed in cases when a file in a folder-type dataset is given.
 /// </summary>
 /// <param name="path"></param>
 /// <returns>The path to the dataset, or the path to the dataset directory</returns>
 public static string GetDatasetName(string path)
 {
     return(ProteoWizardReader.CheckForDirectoryDataset(path));
 }