Пример #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="inputDirectoryPath">Input directory path</param>
        /// <param name="resultToSeqMapFilename">ResultToSeqMap filename</param>
        /// <param name="seqToProteinMapFilename"></param>
        /// <param name="seqInfoFilename">SeqInfo filename</param>
        public PHRPSeqMapReader(string inputDirectoryPath, string resultToSeqMapFilename, string seqToProteinMapFilename, string seqInfoFilename)
        {
            InputDirectoryPath = inputDirectoryPath;

            if (string.IsNullOrEmpty(InputDirectoryPath))
            {
                InputDirectoryPath = string.Empty;
            }

            PeptideHitResultType = ReaderFactory.AutoDetermineResultType(resultToSeqMapFilename);
            if (PeptideHitResultType == PeptideHitResultTypes.Unknown)
            {
                ErrorMessage = "Unable to auto-determine the PeptideHit result type based on filename " + resultToSeqMapFilename;
                throw new Exception(ErrorMessage);
            }

            DatasetName = ReaderFactory.AutoDetermineDatasetName(resultToSeqMapFilename);
            if (string.IsNullOrEmpty(DatasetName))
            {
                ErrorMessage = "Unable to auto-determine the dataset name using filename '" + resultToSeqMapFilename + "'";
                throw new Exception(ErrorMessage);
            }

            ResultToSeqMapFilename  = resultToSeqMapFilename;
            SeqToProteinMapFilename = seqToProteinMapFilename;
            mSeqInfoFilename        = seqInfoFilename;

            MaxProteinsPerSeqID = 0;
        }
        protected bool InitializeReader(FileInfo inputFile)
        {
            try
            {
                var peptideHitResultType = ReaderFactory.AutoDetermineResultType(inputFile.FullName);

                if (peptideHitResultType == PeptideHitResultTypes.Unknown)
                {
                    OnErrorEvent("Error: Could not determine the format of the PHRP data file: " + inputFile.FullName);
                    return(false);
                }

                // Open the data file and read the data
                mPHRPReader = new ReaderFactory(inputFile.FullName, PeptideHitResultTypes.Unknown, false, false, false)
                {
                    EchoMessagesToConsole = false,
                    SkipDuplicatePSMs     = false
                };

                if (!mPHRPReader.CanRead)
                {
                    OnErrorEvent("Aborting since PHRPReader is not ready: " + mPHRPReader.ErrorMessage);
                    return(false);
                }

                // Attach the events
                RegisterEvents(mPHRPReader);
            }
            catch (Exception ex)
            {
                OnErrorEvent("Error in InitializeReader: " + ex.Message);
                return(false);
            }

            return(true);
        }
Пример #3
0
 public static PeptideHitResultTypes AutoDetermineResultType(string filePath)
 {
     return(ReaderFactory.AutoDetermineResultType(filePath));
 }