コード例 #1
0
        static int Main(string[] args)
        {
            var objParseCommandLine = new clsParseCommandLine();

            mInputFilePath  = string.Empty;
            mOutputFilePath = string.Empty;

            mOutputOptions = clsOwlConverter.DefaultOutputOptions();

            mPrimaryKeySuffix = clsOwlConverter.DEFAULT_PRIMARY_KEY_SUFFIX;

            try
            {
                var success = false;

                if (objParseCommandLine.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(objParseCommandLine))
                    {
                        success = true;
                    }
                }

                if (!success ||
                    objParseCommandLine.NeedToShowHelp ||
                    string.IsNullOrWhiteSpace(mInputFilePath))
                {
                    ShowProgramHelp();
                    return(-1);
                }

                var converter = new clsOwlConverter(mPrimaryKeySuffix)
                {
                    OutputOptions = mOutputOptions
                };

                converter.ErrorEvent   += Converter_ErrorEvent;
                converter.StatusEvent  += Converter_StatusEvent;
                converter.WarningEvent += Converter_WarningEvent;

                success = converter.ConvertOwlFile(mInputFilePath, mOutputFilePath);

                if (!success)
                {
                    ShowErrorMessage("ConvertOwlFile returned false");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred in Program->Main: " + Environment.NewLine + ex.Message);
                Console.WriteLine(ex.StackTrace);
                return(-1);
            }

            return(0);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //if (AppUpdatesAvailableInternal())
            //{
            //    MessageBox.Show("New version of Inferno available.",
            //        "New version!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //}

            //Splasher.Show(typeof(frmSplash));

            mDanteFilePath = string.Empty;
            mLogFilePath   = string.Empty;

            try
            {
                var objParseCommandLine = new clsParseCommandLine();
                var success             = false;

                if (objParseCommandLine.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(objParseCommandLine))
                    {
                        success = true;
                    }
                }

                if (!success ||
                    objParseCommandLine.NeedToShowHelp ||
                    objParseCommandLine.ParameterCount + objParseCommandLine.NonSwitchParameterCount == 0)
                {
                    var syntaxMessage = "Supported command line switches are /F and /L \n" +
                                        "Use '/F FilePath.dnt' to load a data file \n" +
                                        "Use '/L LogFilePath' to specify a custom log file path";

                    MessageBox.Show(syntaxMessage, "InfernoRDN Syntax", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception parsing the command line arguments: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            var mfrmDAnTEmdi = new frmDAnTEmdi(mDanteFilePath, mLogFilePath);

            if (!mfrmDAnTEmdi.IsDisposed)
            {
                Application.Run(mfrmDAnTEmdi);
            }
        }
コード例 #3
0
        static int Main()
        {
            var commandLineParser = new clsParseCommandLine();

            try
            {
                mProcessingMode = eProcessingMode.TaskParallelLibrary4_5;

                // Set this to 1 for now
                // If argument /Threads is present, it will be set to that
                // Otherwise, it will be set to value returned by GetCoreCount()
                mThreadCount       = 1;
                mRuntimeSeconds    = 15;
                mUseTieredRuntimes = false;

                var success = false;

                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        success = true;
                    }
                }
                else
                {
                    if (commandLineParser.NonSwitchParameterCount + commandLineParser.ParameterCount == 0 && !commandLineParser.NeedToShowHelp)
                    {
                        // No arguments were provided; that's OK
                        success = true;
                    }
                }

                if (!success || commandLineParser.NeedToShowHelp)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                StartProcessing();
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in Program->Main", ex);
                return(-1);
            }

            return(0);
        }
コード例 #4
0
        public static int Main()
        {
            var commandLineParser = new clsParseCommandLine();

            mFileMask = string.Empty;
            mRecurse  = false;

            mOutputFilePath     = string.Empty;
            mFullPathsInResults = false;

            mPreviewMode = false;

            try
            {
                var success = false;

                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        success = true;
                    }
                }

                if (!success ||
                    commandLineParser.NeedToShowHelp ||
                    commandLineParser.ParameterCount + commandLineParser.NonSwitchParameterCount == 0)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                success = ComputeChecksums(mFileMask, mRecurse, mOutputFilePath, mFullPathsInResults, mPreviewMode);
                if (!success)
                {
                    Thread.Sleep(1000);
                    return(-2);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred in Program->Main: " + Environment.NewLine + ex.Message);
                Console.WriteLine(ex.StackTrace);
                return(-1);
            }

            return(0);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: biobright/MASIC
        public static int Main()
        {
            // Returns 0 if no error, error code if an error

            var commandLineParser = new clsParseCommandLine();

            mInputFilePath = string.Empty;

            try
            {
                var proceed = false;
                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        proceed = true;
                    }
                }
                else if (!commandLineParser.NeedToShowHelp)
                {
                    proceed = true;
                }

                if (commandLineParser.NeedToShowHelp || !proceed)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                ShowGUI();

                return(0);
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in Program->Main: " + Environment.NewLine + ex.Message);
                return(-1);
            }
        }
コード例 #6
0
        private static int Main()
        {
            // Returns 0 if no error, error code if an error
            var commandLineParser = new clsParseCommandLine();

            mInputFilePath               = string.Empty;
            mCreateDartIdInputFile       = false;
            mMageResults                 = false;
            mMergeWildcardResults        = false;
            mMASICResultsDirectoryPath   = string.Empty;
            mOutputDirectoryPath         = string.Empty;
            mRecurseDirectories          = false;
            mRecurseDirectoriesMaxLevels = 0;
            mLogMessagesToFile           = false;
            mScanNumberColumn            = MASICResultsMerger.DEFAULT_SCAN_NUMBER_COLUMN;
            mSeparateByCollisionMode     = false;

            try
            {
                var proceed = false;
                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        proceed = true;
                    }
                }

                if (!proceed ||
                    commandLineParser.NeedToShowHelp ||
                    commandLineParser.ParameterCount + commandLineParser.NonSwitchParameterCount == 0 ||
                    mInputFilePath.Length == 0)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                // Note: If a parameter file is defined, settings in that file will override the options defined here
                mMASICResultsMerger = new MASICResultsMerger
                {
                    LogMessagesToFile         = mLogMessagesToFile,
                    MASICResultsDirectoryPath = mMASICResultsDirectoryPath,
                    ScanNumberColumn          = mScanNumberColumn,
                    SeparateByCollisionMode   = mSeparateByCollisionMode,
                    CreateDartIdInputFile     = mCreateDartIdInputFile,
                    MageResults = mMageResults
                };

                mMASICResultsMerger.ErrorEvent     += MASICResultsMerger_ErrorEvent;
                mMASICResultsMerger.WarningEvent   += MASICResultsMerger_WarningEvent;
                mMASICResultsMerger.StatusEvent    += MASICResultsMerger_StatusEvent;
                mMASICResultsMerger.DebugEvent     += MASICResultsMerger_DebugEvent;
                mMASICResultsMerger.ProgressUpdate += MASICResultsMerger_ProgressUpdate;
                mMASICResultsMerger.ProgressReset  += MASICResultsMerger_ProgressReset;

                int returnCode;
                if (mRecurseDirectories)
                {
                    if (mMASICResultsMerger.ProcessFilesAndRecurseDirectories(mInputFilePath, mOutputDirectoryPath,
                                                                              mOutputDirectoryAlternatePath,
                                                                              mRecreateDirectoryHierarchyInAlternatePath, string.Empty,
                                                                              mRecurseDirectoriesMaxLevels))
                    {
                        returnCode = 0;
                    }
                    else
                    {
                        returnCode = (int)mMASICResultsMerger.ErrorCode;
                    }
                }
                else if (mMASICResultsMerger.ProcessFilesWildcard(mInputFilePath, mOutputDirectoryPath))
                {
                    returnCode = 0;
                }
                else
                {
                    returnCode = (int)mMASICResultsMerger.ErrorCode;
                    if (returnCode != 0)
                    {
                        ShowErrorMessage("Error while processing: " + mMASICResultsMerger.GetErrorMessage());
                    }
                }

                if (mMergeWildcardResults && mMASICResultsMerger.ProcessedDatasets.Count > 0)
                {
                    mMASICResultsMerger.MergeProcessedDatasets();
                }

                if (mLastProgressReportValue > 0)
                {
                    DisplayProgressPercent(mLastProgressReportValue, true);
                }

                return(returnCode);
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in modMain->Main: ", ex);
                return(-1);
            }
        }
コード例 #7
0
        private static int Main()
        {
            var commandLineParse = new clsParseCommandLine();

            mSearchDirectoryPath = ".";
            mRecurse             = false;

            mUpdateOptions = new PackageUpdateOptions
            {
                NuGetPackageName    = "",
                NuGetPackageVersion = "",
                Rollback            = false,
                Preview             = true
            };

            mVerboseLogging = false;

            try
            {
                var success = false;

                if (commandLineParse.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParse))
                    {
                        success = true;
                    }
                }

                if (!success ||
                    commandLineParse.NeedToShowHelp)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                if (string.IsNullOrWhiteSpace(mSearchDirectoryPath))
                {
                    mSearchDirectoryPath = ".";
                }

                if (string.IsNullOrWhiteSpace(mUpdateOptions.NuGetPackageName))
                {
                    ShowErrorMessage("NuGet package must be defined using /P or /Package");
                    return(-3);
                }

                if (string.IsNullOrWhiteSpace(mUpdateOptions.NuGetPackageVersion))
                {
                    ShowErrorMessage("NuGet package version must be defined using /V or /Version");
                    return(-4);
                }

                success = SearchForProjectFiles(mSearchDirectoryPath, mRecurse, mUpdateOptions);

                if (!success)
                {
                    Thread.Sleep(1500);
                    return(-1);
                }

                Console.WriteLine();
                Console.WriteLine("Search complete");

                Thread.Sleep(250);
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in Program->Main", ex);
                Thread.Sleep(1500);
                return(-1);
            }

            return(0);
        }
コード例 #8
0
        public static int Main()
        {
            // Returns 0 if no error, error code if an error
            var commandLineParser = new clsParseCommandLine();

            var returnCode = 0;

            mPeptideInputFilePath = string.Empty;
            mProteinInputFilePath = string.Empty;
            mParameterFilePath    = string.Empty;

            mIgnoreILDifferences             = false;
            mOutputProteinSequence           = true;
            mSaveProteinToPeptideMappingFile = false;
            mSkipCoverageComputationSteps    = false;
            mDebugMode = false;
            mKeepDB    = false;

            try
            {
                var proceed = false;
                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        proceed = true;
                    }
                }

                if (!commandLineParser.NeedToShowHelp & string.IsNullOrEmpty(mProteinInputFilePath))
                {
                    ShowGUI();
                }
                else if (!proceed || commandLineParser.NeedToShowHelp || commandLineParser.ParameterCount == 0 || mPeptideInputFilePath.Length == 0)
                {
                    ShowProgramHelp();
                    returnCode = -1;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(mParameterFilePath) &&
                        !mSaveProteinToPeptideMappingFile &&
                        mSkipCoverageComputationSteps)
                    {
                        ConsoleMsgUtils.ShowWarning("You used /K but didn't specify /M; no results will be saved");
                        ConsoleMsgUtils.ShowWarning("It is advised that you use only /M (and don't use /K)");
                    }

                    try
                    {
                        mProteinCoverageSummarizer = new clsProteinCoverageSummarizerRunner()
                        {
                            ProteinInputFilePath            = mProteinInputFilePath,
                            CallingAppHandlesEvents         = false,
                            IgnoreILDifferences             = mIgnoreILDifferences,
                            OutputProteinSequence           = mOutputProteinSequence,
                            SaveProteinToPeptideMappingFile = mSaveProteinToPeptideMappingFile,
                            SearchAllProteinsSkipCoverageComputationSteps = mSkipCoverageComputationSteps,
                            KeepDB = mKeepDB
                        };

                        mProteinCoverageSummarizer.StatusEvent  += ProteinCoverageSummarizer_StatusEvent;
                        mProteinCoverageSummarizer.ErrorEvent   += ProteinCoverageSummarizer_ErrorEvent;
                        mProteinCoverageSummarizer.WarningEvent += ProteinCoverageSummarizer_WarningEvent;

                        mProteinCoverageSummarizer.ProgressUpdate += ProteinCoverageSummarizer_ProgressChanged;
                        mProteinCoverageSummarizer.ProgressReset  += ProteinCoverageSummarizer_ProgressReset;

                        mProteinCoverageSummarizer.ProcessFilesWildcard(mPeptideInputFilePath, mOutputDirectoryPath, mParameterFilePath);
                    }
                    catch (Exception ex)
                    {
                        ShowErrorMessage("Error initializing Protein File Parser General Options " + ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in modMain->Main: " + Environment.NewLine + ex.Message);
                returnCode = -1;
            }

            return(returnCode);
        }
コード例 #9
0
        public static int Main(string[] args)
        {
            var objParseCommandLine = new clsParseCommandLine();

            mInputFileOrFolderPath     = string.Empty;
            mOutputFileOrFolderPath    = string.Empty;
            mOutputFolderAlternatePath = string.Empty;

            mAssumeNoWildcards = false;
            mKnownExtensions   = new List <string>();
            mProcessFolders    = false;
            mRecurse           = false;
            mRecurseDepth      = 0;

            try
            {
                var success = false;

                if (objParseCommandLine.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(objParseCommandLine))
                    {
                        success = true;
                    }
                }

                if (!success ||
                    objParseCommandLine.NeedToShowHelp ||
                    string.IsNullOrWhiteSpace(mInputFileOrFolderPath))
                {
                    ShowProgramHelp();
                    return(-1);
                }

                const string PARAM_FILE_PATH = "";

                if (mProcessFolders)
                {
                    var folderProcessor = new FolderProcessor();
                    RegisterEvents(folderProcessor);
                    folderProcessor.SkipConsoleWriteIfNoProgressListener = true;

                    if (mRecurse)
                    {
                        ConsoleMsgUtils.ShowDebug("Calling folderProcessor.ProcessAndRecurseFolders");
                        success = folderProcessor.ProcessAndRecurseFolders(mInputFileOrFolderPath, mOutputFileOrFolderPath, PARAM_FILE_PATH, mRecurseDepth);
                    }
                    else if (mAssumeNoWildcards)
                    {
                        ConsoleMsgUtils.ShowDebug("Calling folderProcessor.ProcessFolder");
                        success = folderProcessor.ProcessFolder(mInputFileOrFolderPath, mOutputFileOrFolderPath, PARAM_FILE_PATH);
                    }
                    else
                    {
                        ConsoleMsgUtils.ShowDebug("Calling folderProcessor.ProcessFoldersWildcard");
                        success = folderProcessor.ProcessFoldersWildcard(mInputFileOrFolderPath, mOutputFileOrFolderPath);
                    }
                }
                else
                {
                    var fileProcessor = new FileProcessor();
                    RegisterEvents(fileProcessor);
                    fileProcessor.SkipConsoleWriteIfNoProgressListener = true;

                    if (mRecurse)
                    {
                        const bool RECREATE_FOLDER_HIERARCHY = true;

                        if (mKnownExtensions.Count > 0)
                        {
                            ConsoleMsgUtils.ShowDebug(
                                "Calling fileProcessor.ProcessFilesAndRecurseFolders with user-defined extensions: " +
                                string.Join(", ", mKnownExtensions));

                            success = fileProcessor.ProcessFilesAndRecurseFolders(
                                mInputFileOrFolderPath, mOutputFileOrFolderPath, mOutputFolderAlternatePath,
                                RECREATE_FOLDER_HIERARCHY, PARAM_FILE_PATH, mRecurseDepth, mKnownExtensions);
                        }
                        else
                        {
                            ConsoleMsgUtils.ShowDebug("Calling fileProcessor.ProcessFilesAndRecurseFolders with " +
                                                      "input file [" + mInputFileOrFolderPath + "], output folder [" + mOutputFileOrFolderPath + "]" +
                                                      " and extensions: " + string.Join(", ", fileProcessor.GetDefaultExtensionsToParse()));

                            success = fileProcessor.ProcessFilesAndRecurseFolders(
                                mInputFileOrFolderPath, mOutputFileOrFolderPath, mOutputFolderAlternatePath,
                                RECREATE_FOLDER_HIERARCHY, PARAM_FILE_PATH, mRecurseDepth);
                        }
                    }
                    else if (mAssumeNoWildcards)
                    {
                        ConsoleMsgUtils.ShowDebug("Calling fileProcessor.ProcessFile with " +
                                                  "input file [" + mInputFileOrFolderPath + "] and output folder [" + mOutputFileOrFolderPath + "]");

                        success = fileProcessor.ProcessFile(mInputFileOrFolderPath, mOutputFileOrFolderPath);
                    }
                    else
                    {
                        ConsoleMsgUtils.ShowDebug("Calling fileProcessor.ProcessFilesWildcard with " +
                                                  "input file [" + mInputFileOrFolderPath + "] and output folder [" + mOutputFileOrFolderPath + "]");

                        success = fileProcessor.ProcessFilesWildcard(mInputFileOrFolderPath, mOutputFileOrFolderPath);
                    }
                }

                if (!success)
                {
                    System.Threading.Thread.Sleep(1500);
                    return(-3);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred in Program->Main: " + Environment.NewLine + ex.Message);
                Console.WriteLine(ex.StackTrace);
                System.Threading.Thread.Sleep(1500);
                return(-1);
            }

            return(0);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        public static void Main()
        {
            mScanInfoInterval      = 1;
            mLoadMethods           = true;
            mLoadScanData          = true;
            mGetScanEvents         = true;
            mLoadCollisionEnergies = true;
            mOnlyLoadMSLevelInfo   = false;

            var commandLineParser = new clsParseCommandLine();

            commandLineParser.ParseCommandLine();

            if (commandLineParser.NeedToShowHelp)
            {
                ShowProgramHelp();
                return;
            }

            if (Path.DirectorySeparatorChar == '/')
            {
                mSourceFilePath = DEFAULT_FILE_PATH.Replace('\\', '/');
            }
            else
            {
                mSourceFilePath = DEFAULT_FILE_PATH;
            }

            ParseCommandLineParameters(commandLineParser);

            if (mExtractScanFilters)
            {
                var workingDirectory = ".";

                if (commandLineParser.NonSwitchParameterCount > 0)
                {
                    workingDirectory = commandLineParser.RetrieveNonSwitchParameter(0);
                }
                ExtractScanFilters(workingDirectory);
                System.Threading.Thread.Sleep(1500);
                return;
            }

            var sourceFile = new FileInfo(mSourceFilePath);

            if (!sourceFile.Exists)
            {
                Console.WriteLine("File not found: " + sourceFile.FullName);
                System.Threading.Thread.Sleep(1500);
                return;
            }

            if (mTestScanFilters)
            {
                TestScanFilterParsing();
            }

            TestReader(sourceFile.FullName, mCentroid, mTestSumming, mStartScan, mEndScan);

            if (mCentroid)
            {
                // Also process the file with centroiding off
                TestReader(sourceFile.FullName, false, mTestSumming, mStartScan, mEndScan);
            }

            if (mGetScanEvents)
            {
                TestGetAllScanEvents(sourceFile.FullName);
            }

            Console.WriteLine("Done");

            System.Threading.Thread.Sleep(150);
        }
コード例 #12
0
        public static int Main()
        {
            int intReturnCode;
            var objParseCommandLine = new clsParseCommandLine();

            mInputDataFilePath = string.Empty;
            mOutputFolderName  = string.Empty;
            mParameterFilePath = string.Empty;
            mLogFilePath       = string.Empty;

            mRecurseFolders            = false;
            mRecurseFoldersMaxLevels   = 2;
            mIgnoreErrorsWhenRecursing = false;

            mReprocessingExistingFiles   = false;
            mReprocessIfCachedSizeIsZero = false;
            mUseCacheFiles = false;

            mSaveTICandBPIPlots           = true;
            mSaveLCMS2DPlots              = false;
            mLCMS2DMaxPointsToPlot        = clsLCMSDataPlotterOptions.DEFAULT_MAX_POINTS_TO_PLOT;
            mLCMS2DOverviewPlotDivisor    = clsLCMSDataPlotterOptions.DEFAULT_LCMS2D_OVERVIEW_PLOT_DIVISOR;
            mTestLCMSGradientColorSchemes = false;

            mCheckCentroidingStatus = false;

            mScanStart     = 0;
            mScanEnd       = 0;
            mShowDebugInfo = false;

            mComputeOverallQualityScores = false;
            mCreateDatasetInfoFile       = false;
            mCreateScanStatsFile         = false;

            mUpdateDatasetStatsTextFile = false;
            mDatasetStatsTextFileName   = string.Empty;

            mCheckFileIntegrity  = false;
            mComputeFileHashes   = false;
            mZipFileCheckAllData = true;

            mMaximumTextFileLinesToCheck = clsFileIntegrityChecker.DEFAULT_MAXIMUM_TEXT_FILE_LINES_TO_CHECK;

            mPostResultsToDMS = false;
            mPlotWithPython   = false;

            mLastProgressTime = DateTime.UtcNow;

            try
            {
                var blnProceed = false;
                if (objParseCommandLine.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(objParseCommandLine))
                    {
                        blnProceed = true;
                    }
                }

                if (mInputDataFilePath == null)
                {
                    mInputDataFilePath = string.Empty;
                }


                if (!blnProceed || objParseCommandLine.NeedToShowHelp || objParseCommandLine.ParameterCount + objParseCommandLine.NonSwitchParameterCount == 0 || mInputDataFilePath.Length == 0)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                var scanner = new clsMSFileInfoScanner();

                scanner.DebugEvent     += mMSFileScanner_DebugEvent;
                scanner.ErrorEvent     += mMSFileScanner_ErrorEvent;
                scanner.WarningEvent   += mMSFileScanner_WarningEvent;
                scanner.StatusEvent    += mMSFileScanner_MessageEvent;
                scanner.ProgressUpdate += mMSFileScanner_ProgressUpdate;

                if (mCheckFileIntegrity)
                {
                    mUseCacheFiles = true;
                }

                // Note: These values will be overridden if /P was used and they are defined in the parameter file

                scanner.UseCacheFiles               = mUseCacheFiles;
                scanner.ReprocessExistingFiles      = mReprocessingExistingFiles;
                scanner.ReprocessIfCachedSizeIsZero = mReprocessIfCachedSizeIsZero;

                scanner.PlotWithPython               = mPlotWithPython;
                scanner.SaveTICAndBPIPlots           = mSaveTICandBPIPlots;
                scanner.SaveLCMS2DPlots              = mSaveLCMS2DPlots;
                scanner.LCMS2DPlotMaxPointsToPlot    = mLCMS2DMaxPointsToPlot;
                scanner.LCMS2DOverviewPlotDivisor    = mLCMS2DOverviewPlotDivisor;
                scanner.TestLCMSGradientColorSchemes = mTestLCMSGradientColorSchemes;

                scanner.CheckCentroidingStatus = mCheckCentroidingStatus;

                scanner.ScanStart     = mScanStart;
                scanner.ScanEnd       = mScanEnd;
                scanner.ShowDebugInfo = mShowDebugInfo;

                scanner.ComputeOverallQualityScores = mComputeOverallQualityScores;
                scanner.CreateDatasetInfoFile       = mCreateDatasetInfoFile;
                scanner.CreateScanStatsFile         = mCreateScanStatsFile;

                scanner.UpdateDatasetStatsTextFile = mUpdateDatasetStatsTextFile;
                scanner.DatasetStatsTextFileName   = mDatasetStatsTextFileName;

                scanner.CheckFileIntegrity          = mCheckFileIntegrity;
                scanner.MaximumTextFileLinesToCheck = mMaximumTextFileLinesToCheck;
                scanner.ComputeFileHashes           = mComputeFileHashes;
                scanner.ZipFileCheckAllData         = mZipFileCheckAllData;

                scanner.IgnoreErrorsWhenRecursing = mIgnoreErrorsWhenRecursing;

                if (mLogFilePath.Length > 0)
                {
                    scanner.LogMessagesToFile = true;
                    scanner.LogFilePath       = mLogFilePath;
                }

                scanner.DatasetIDOverride      = mDatasetID;
                scanner.DSInfoDBPostingEnabled = mPostResultsToDMS;

                if (!string.IsNullOrEmpty(mParameterFilePath))
                {
                    scanner.LoadParameterFileSettings(mParameterFilePath);
                }

                if (mRecurseFolders)
                {
                    if (scanner.ProcessMSFilesAndRecurseFolders(mInputDataFilePath, mOutputFolderName, mRecurseFoldersMaxLevels))
                    {
                        intReturnCode = 0;
                    }
                    else
                    {
                        intReturnCode = (int)scanner.ErrorCode;
                    }
                }
                else
                {
                    if (scanner.ProcessMSFileOrFolderWildcard(mInputDataFilePath, mOutputFolderName, true))
                    {
                        intReturnCode = 0;
                    }
                    else
                    {
                        intReturnCode = (int)scanner.ErrorCode;
                        if (intReturnCode != 0)
                        {
                            ShowErrorMessage("Error while processing: " + scanner.GetErrorMessage());
                        }
                    }
                }

                scanner.SaveCachedResults();
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in modMain->Main: " + Environment.NewLine + ex.Message);
                intReturnCode = -1;
            }

            return(intReturnCode);
        }
コード例 #13
0
        /// <summary>
        /// Main entry method
        /// </summary>
        public static int Main()
        {
            var commandLineParser = new clsParseCommandLine();

            mLogLevel = BaseLogger.LogLevels.INFO;

            mMTSServer               = string.Empty;
            mLogDBConnectionString   = clsMyEMSLMTSFileCacher.LOG_DB_CONNECTION_STRING;
            mMinimumCacheFreeSpaceGB = clsMyEMSLMTSFileCacher.DEFAULT_MINIMUM_CACHE_FREE_SPACE_GB;
            mLocalServerMode         = false;
            mPreviewMode             = false;
            mTraceMode               = false;

            try
            {
                var success = false;

                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        success = true;
                    }
                }

                if (!success ||
                    commandLineParser.NeedToShowHelp ||
                    commandLineParser.ParameterCount + commandLineParser.NonSwitchParameterCount == 0 ||
                    mMTSServer.Length == 0 && !mLocalServerMode)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                if (mLocalServerMode)
                {
                    mMTSServer = string.Empty;
                }
                else
                {
                    var updatesArePending = WindowsUpdateStatus.UpdatesArePending(out var pendingWindowsUpdateMessage);

                    if (updatesArePending)
                    {
                        Console.WriteLine(pendingWindowsUpdateMessage);
                        Console.WriteLine("Will not contact the MTS server to process cache requests");
                        return(0);
                    }
                }

                var downloader = new clsMyEMSLMTSFileCacher(mMTSServer, mLogLevel, mLogDBConnectionString)
                {
                    MinimumCacheFreeSpaceGB = mMinimumCacheFreeSpaceGB,
                    TraceMode = mTraceMode
                };

                // Attach the events
                downloader.DebugEvent     += Downloader_DebugEvent;
                downloader.ErrorEvent     += Downloader_ErrorEvent;
                downloader.StatusEvent    += Downloader_StatusEvent;
                downloader.WarningEvent   += Downloader_WarningEvent;
                downloader.ProgressUpdate += Downloader_ProgressUpdate;

                mPercentComplete        = 0;
                mLastProgressUpdateTime = DateTime.UtcNow;

                // Initiate processing, which will contact the MTS Server to see if any files need to be cached
                success = downloader.Start(mPreviewMode);

                LogTools.FlushPendingMessages();

                if (!success)
                {
                    ShowErrorMessage("Error processing cache requests for MTS server " + mMTSServer + ": " + downloader.ErrorMessage);
                    return(-3);
                }
            }
            catch (Exception ex)
            {
                LogTools.FlushPendingMessages();
                Console.WriteLine("Error occurred in Program->Main: " + Environment.NewLine + ex.Message);
                Console.WriteLine(ex.StackTrace);
                Thread.Sleep(1500);
                return(-1);
            }

            return(0);
        }
コード例 #14
0
        /// <summary>
        /// Main processing method
        /// </summary>
        /// <returns>0 if no error, error code if an error</returns>
        public static int Main()
        {
            var commandLineParser = new clsParseCommandLine();

            // Initialize the options
            mInputFilePath       = string.Empty;
            mOutputDirectoryName = string.Empty;
            mParameterFilePath   = string.Empty;
            mRecurseDirectories  = false;
            mMaxLevelsToRecurse  = 0;
            mLogMessagesToFile   = false;

            var options = new SplitterOptions();

            try
            {
                var proceed = commandLineParser.ParseCommandLine() && SetOptionsUsingCommandLineParameters(commandLineParser, options);

                if (!proceed || commandLineParser.NeedToShowHelp || commandLineParser.ParameterCount + commandLineParser.NonSwitchParameterCount == 0 || mInputFilePath.Length == 0)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                // Note: mSplitCount and mSplitCount will be overridden if mParameterFilePath points to a valid parameter file that has these settings defined
                var fastaFileSplitter = new clsFastaFileSplitter(options)
                {
                    LogMessagesToFile = mLogMessagesToFile
                };

                RegisterEvents(fastaFileSplitter);
                fastaFileSplitter.ProgressReset += ProgressReset;

                int returnCode;
                if (mRecurseDirectories)
                {
                    if (fastaFileSplitter.ProcessFilesAndRecurseDirectories(mInputFilePath, mOutputDirectoryName, mOutputDirectoryAlternatePath, mRecreateDirectoryHierarchyInAlternatePath, mParameterFilePath, mMaxLevelsToRecurse))
                    {
                        returnCode = 0;
                    }
                    else
                    {
                        if (fastaFileSplitter.ErrorCode == ProcessFilesBase.ProcessFilesErrorCodes.NoError)
                        {
                            returnCode = -1;
                        }
                        else
                        {
                            returnCode = (int)fastaFileSplitter.ErrorCode;
                        }
                    }
                }
                else if (fastaFileSplitter.ProcessFilesWildcard(mInputFilePath, mOutputDirectoryName, mParameterFilePath))
                {
                    returnCode = 0;
                }
                else
                {
                    if (fastaFileSplitter.ErrorCode != ProcessFilesBase.ProcessFilesErrorCodes.NoError)
                    {
                        Console.WriteLine("Error while processing: " + fastaFileSplitter.GetErrorMessage());
                    }

                    returnCode = (int)fastaFileSplitter.ErrorCode;
                }

                DisplayProgressPercent(mLastProgressReportValue, true);
                return(returnCode);
            }
            catch (Exception ex)
            {
                ConsoleMsgUtils.ShowError("Error occurred in modMain->Main", ex);
                return(-1);
            }
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: biobright/MASIC
        public static int Main()
        {
            var commandLineParser = new clsParseCommandLine();

            mInputFilePath       = string.Empty;
            mOutputDirectoryPath = string.Empty;
            mParameterFilePath   = string.Empty;

            mRecurseDirectories = false;
            mMaxLevelsToRecurse = 0;

            mQuietMode         = false;
            mLogMessagesToFile = false;
            mLogFilePath       = string.Empty;

            mLastSubtaskProgressTime = DateTime.UtcNow;

            try
            {
                var proceed = false;
                if (commandLineParser.ParseCommandLine())
                {
                    if (SetOptionsUsingCommandLineParameters(commandLineParser))
                    {
                        proceed = true;
                    }
                }

                if (commandLineParser.ParameterCount + commandLineParser.NonSwitchParameterCount == 0 && !commandLineParser.NeedToShowHelp)
                {
#if GUI
                    ShowGUI();
#else
                    ShowProgramHelp();
#endif
                    return(0);
                }

                if (!proceed || commandLineParser.NeedToShowHelp || mInputFilePath.Length == 0)
                {
                    ShowProgramHelp();
                    return(-1);
                }

                mMASIC = new clsMASIC();
                RegisterMasicEvents(mMASIC);

                mMASIC.Options.DatasetLookupFilePath = mDatasetLookupFilePath;
                mMASIC.Options.SICOptions.DatasetID  = mDatasetID;

                if (!string.IsNullOrEmpty(mMASICStatusFilename))
                {
                    mMASIC.Options.MASICStatusFilename = mMASICStatusFilename;
                }

                mMASIC.LogMessagesToFile = mLogMessagesToFile;
                mMASIC.LogFilePath       = mLogFilePath;
                mMASIC.LogDirectoryPath  = mLogDirectoryPath;

                if (!mQuietMode)
                {
#if GUI
                    mProgressForm = new frmProgress();

                    mProgressForm.InitializeProgressForm("Parsing " + Path.GetFileName(mInputFilePath), 0, 100, false, true);
                    mProgressForm.InitializeSubtask(string.Empty, 0, 100, false);
                    mProgressForm.ResetKeyPressAbortProcess();
                    mProgressForm.Show();
                    Application.DoEvents();
#else
                    Console.WriteLine("Parsing " + Path.GetFileName(mInputFilePath));
#endif
                }

                int returnCode;

                if (mRecurseDirectories)
                {
                    if (mMASIC.ProcessFilesAndRecurseDirectories(mInputFilePath, mOutputDirectoryPath,
                                                                 mOutputDirectoryAlternatePath, mRecreateDirectoryHierarchyInAlternatePath,
                                                                 mParameterFilePath, mMaxLevelsToRecurse))
                    {
                        returnCode = 0;
                    }
                    else
                    {
                        returnCode = (int)mMASIC.ErrorCode;
                    }
                }
                else if (mMASIC.ProcessFilesWildcard(mInputFilePath, mOutputDirectoryPath, mParameterFilePath))
                {
                    returnCode = 0;
                }
                else
                {
                    returnCode = (int)mMASIC.ErrorCode;
                    if (returnCode != 0)
                    {
                        Console.WriteLine("Error while processing: " + mMASIC.GetErrorMessage());
                    }
                }

                if (returnCode != 0)
                {
                    ProgRunner.SleepMilliseconds(1500);
                }

                return(returnCode);
            }
            catch (Exception ex)
            {
                ShowErrorMessage("Error occurred in Program->Main: " + Environment.NewLine + ex.Message);
                ProgRunner.SleepMilliseconds(1500);
                return(-1);
            }
#if GUI
            finally
            {
                if (mProgressForm != null)
                {
                    mProgressForm.HideForm();
                    mProgressForm = null;
                }
            }
#endif
        }