/// <summary> /// Configure and call the protein mapper /// </summary> /// <returns></returns> private bool MapProteins() { // Configure the peptide to protein mapper var options = new ProteinCoverageSummarizerOptions { IgnoreILDifferences = false, MatchPeptidePrefixAndSuffixToProtein = false, OutputProteinSequence = false, PeptideFileSkipFirstLine = false, RemoveSymbolCharacters = true, ProteinInputFilePath = mFastaFilePath, SaveProteinToPeptideMappingFile = true, SearchAllProteinsForPeptideSequence = true, SearchAllProteinsSkipCoverageComputationSteps = true }; var peptideToProteinMapper = new clsPeptideToProteinMapEngine(options) { DeleteTempFiles = true, InspectParameterFilePath = string.Empty, PeptideInputFileFormat = clsPeptideToProteinMapEngine.PeptideInputFileFormatConstants.PeptideListFile, }; if (!string.IsNullOrEmpty(mOutputDirectoryPath)) { peptideToProteinMapper.LogMessagesToFile = true; peptideToProteinMapper.LogDirectoryPath = mOutputDirectoryPath; peptideToProteinMapper.LogFilePath = "PeptideToProteinMapper_Log.txt"; } else { peptideToProteinMapper.LogMessagesToFile = false; } peptideToProteinMapper.ProgressUpdate += PeptideToProteinMapper_ProgressUpdate; // Note that clsPeptideToProteinMapEngine utilizes Data.SQLite.dll var success = peptideToProteinMapper.ProcessFile(mPeptideListFilePath, mOutputDirectoryPath, string.Empty, true); peptideToProteinMapper.CloseLogFileNow(); return(success); }
public static int Main() { // Returns 0 if no error, error code if an error int returnCode; var commandLineParser = new clsParseCommandLine(); bool proceed; returnCode = 0; mPeptideInputFilePath = string.Empty; mProteinInputFilePath = string.Empty; mParameterFilePath = string.Empty; mInspectParameterFilePath = string.Empty; mIgnoreILDifferences = false; mOutputProteinSequence = true; mSaveProteinToPeptideMappingFile = true; mSaveSourceDataPlusProteinsFile = false; mSkipCoverageComputationSteps = false; mInputFileFormatCode = clsPeptideToProteinMapEngine.ePeptideInputFileFormatConstants.AutoDetermine; mLogMessagesToFile = false; mLogFilePath = string.Empty; mLogDirectoryPath = string.Empty; try { proceed = false; if (commandLineParser.ParseCommandLine()) { if (SetOptionsUsingCommandLineParameters(commandLineParser)) { proceed = true; } } if (!proceed || commandLineParser.NeedToShowHelp || commandLineParser.ParameterCount + commandLineParser.NonSwitchParameterCount == 0) { ShowProgramHelp(); returnCode = -1; } else { try { if (mVerboseLogging) { CreateVerboseLogFile(); } if (string.IsNullOrWhiteSpace(mPeptideInputFilePath)) { ShowErrorMessage("Peptide input file must be defined via /I (or by listing the filename just after the .exe)"); returnCode = -1; return(returnCode); } else if (string.IsNullOrWhiteSpace(mProteinInputFilePath)) { ShowErrorMessage("Protein input file must be defined via /R"); returnCode = -1; return(returnCode); } mPeptideToProteinMapEngine = new clsPeptideToProteinMapEngine() { ProteinInputFilePath = mProteinInputFilePath, LogMessagesToFile = mLogMessagesToFile, LogFilePath = mLogFilePath, LogDirectoryPath = mLogDirectoryPath, PeptideInputFileFormat = mInputFileFormatCode, InspectParameterFilePath = mInspectParameterFilePath, IgnoreILDifferences = mIgnoreILDifferences, OutputProteinSequence = mOutputProteinSequence, SaveProteinToPeptideMappingFile = mSaveProteinToPeptideMappingFile, SaveSourceDataPlusProteinsFile = mSaveSourceDataPlusProteinsFile, SearchAllProteinsSkipCoverageComputationSteps = mSkipCoverageComputationSteps }; mPeptideToProteinMapEngine.StatusEvent += PeptideToProteinMapEngine_StatusEvent; mPeptideToProteinMapEngine.ErrorEvent += PeptideToProteinMapEngine_ErrorEvent; mPeptideToProteinMapEngine.WarningEvent += PeptideToProteinMapEngine_WarningEvent; mPeptideToProteinMapEngine.ProgressUpdate += PeptideToProteinMapEngine_ProgressChanged; mPeptideToProteinMapEngine.ProgressReset += PeptideToProteinMapEngine_ProgressReset; mPeptideToProteinMapEngine.ProcessFilesWildcard(mPeptideInputFilePath, mOutputDirectoryPath, mParameterFilePath); if (mVerboseLogFile != null) { mVerboseLogFile.Close(); } } catch (Exception ex) { ShowErrorMessage("Error initializing the Peptide to Protein Mapper Options " + ex.Message); } } } catch (Exception ex) { ShowErrorMessage("Error occurred in modMain->Main: " + Environment.NewLine + ex.Message); returnCode = -1; } return(returnCode); }