コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public SpectraManagerCache(PHRPReader.PeptideMassCalculator peptideMassCalculator)
 {
     _mzMLManager = new MzMLManager(peptideMassCalculator);
     _dtaManager  = new DtaManager(peptideMassCalculator);
     RegisterEvents(_dtaManager);
     RegisterEvents(_mzMLManager);
 }
コード例 #2
0
        /// <summary>
        /// Determine the input spectrum file path, given psmResultsFilePath
        /// </summary>
        /// <param name="psmResultsFilePath">_fht.txt or _syn.txt file</param>
        /// <param name="datasetName">Dataset name</param>
        /// <returns></returns>
        public string GetSpectrumFilePath(string psmResultsFilePath, string datasetName)
        {
            var psmResultsFile = new FileInfo(psmResultsFilePath);

            if (psmResultsFile.Directory == null)
            {
                throw new DirectoryNotFoundException("Unable to determine the parent directory for " + psmResultsFilePath);
            }

            var directoriesToCheck = new List <DirectoryInfo> {
                psmResultsFile.Directory
            };

            if (psmResultsFile.Directory.Parent != null)
            {
                directoriesToCheck.Add(psmResultsFile.Directory.Parent);
            }

            foreach (var directory in directoriesToCheck)
            {
                var mzMLFile = MzMLManager.GetFilePath(directory, datasetName);
                var dtaFile  = DtaManager.GetFilePath(directory, datasetName);

                if (File.Exists(mzMLFile))
                {
                    return(mzMLFile);
                }
                if (File.Exists(dtaFile))
                {
                    return(dtaFile);
                }
            }

            // _dta.txt or .mzML file not found (checked both the directory with the dataset file and the parent directory)

            OnErrorEvent(string.Format("Could not find the spectra file for dataset \"{0}\" in {1} or one directory up", datasetName, psmResultsFile.Directory.FullName));

            return(null);
        }