Exemple #1
0
        public void TestGeneratingMs1FeatureFile()
        {
            var methodName = MethodBase.GetCurrentMethod().Name;

            TestUtils.ShowStarting(methodName);

            const string specFilePath = @"\\proto-11\MSXML_Cache\PBF_Gen_1_193\2015_2\QC_ShewIntact_1_19Jun15_Bane_14-09-01RZ.pbf";

            if (!File.Exists(specFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, specFilePath);
            }

            const string outFolderPath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\Output";

            if (!Directory.Exists(outFolderPath))
            {
                Assert.Ignore(@"Skipping test {0} since folder not found: {1}", methodName, outFolderPath);
            }

            //const string specFilePath = @"D:\MassSpecFiles\test\QC_Shew_Intact_4_01Jan15_Bane_C2-14-08-02RZ.raw";

            const int    minScanCharge = 2;
            const int    maxScanCharge = 60;
            const double minScanMass   = 3000;
            const double maxScanMass   = 5000;
            const int    maxThreads    = 10;

            var param = new LcMsFeatureFinderInputParameter()
            {
                InputPath       = specFilePath,
                OutputPath      = outFolderPath,
                MinSearchMass   = minScanMass,
                MaxSearchMass   = maxScanMass,
                MinSearchCharge = minScanCharge,
                MaxSearchCharge = maxScanCharge,
                CsvOutput       = true,
                ScoreReport     = false,
                MaxThreads      = maxThreads
            };
            var featureFinder = new LcMsFeatureFinderLauncher(param);

            featureFinder.Run();
        }
Exemple #2
0
        static int Main(string[] args)
        {
            LcMsFeatureFinderInputParameters parameters;

            try
            {
                var osVersionInfo = new clsOSVersionInfo();
                if (osVersionInfo.GetOSVersion().ToLower().Contains("windows"))
                {
                    var handle = Process.GetCurrentProcess().MainWindowHandle;
                    SetConsoleMode(handle, EnableExtendedFlags);
                }

                //args = new string[] {"-i", @"D:\MassSpecFiles\training\raw\QC_Shew_Intact_26Sep14_Bane_C2Column3.pbf", "-minMass", "3000", "-maxMass", "30000"};

                var parser = new CommandLineParser <ProMexInputParameters>(Name, Version);
                parser.UsageExamples.Add("To create a PNG of the features in an existing ms1ft file " +
                                         "(requires both a .pbf file and a .ms1ft file):\n\tProMex.exe -i dataset.pbf -ms1ft dataset.ms1ft -featureMap");

                var results = parser.ParseArgs(args);

                if (!results.Success)
                {
                    // Wait for 1.5 seconds
                    System.Threading.Thread.Sleep(1500);

                    return(-1);
                }

                if (!results.ParsedResults.Validate())
                {
                    parser.PrintHelp();

                    // Wait for 1.5 seconds
                    System.Threading.Thread.Sleep(1500);

                    return(-1);
                }

                parameters = results.ParsedResults;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception while parsing the command line parameters: " + ex.Message);
                return(-5);
            }

#if (!DEBUG)
            try
            {
#endif

            // Example text:  ProMex version 1.0.6527 (November 14, 2017)
            // (the build date is computed automatically)
            Console.WriteLine("************ {0} {1} ************", Name, Version);
            parameters.Display();
            var launcher = new LcMsFeatureFinderLauncher(parameters);
            int errorCode;

            if (string.IsNullOrWhiteSpace(parameters.ExistingFeaturesFilePath))
            {
                errorCode = launcher.Run();
            }
            else
            {
                errorCode = launcher.CreateFeatureMapImage(parameters.InputPath, parameters.ExistingFeaturesFilePath);
            }

            return(errorCode);

#if (!DEBUG)
        }

        catch (Exception ex)
        {
            // NOTE: The DMS Analysis Manager looks for this text; do not change it
            Console.WriteLine("Exception while processing: " + ex.Message);
            Console.WriteLine(ex.StackTrace);
            var errorCode = -Math.Abs(ex.Message.GetHashCode());
            if (errorCode == 0)
            {
                return(-1);
            }

            return(errorCode);
        }
#endif
        }
Exemple #3
0
        static int Main(string[] args)
        {
            try
            {
                var handle = Process.GetCurrentProcess().MainWindowHandle;
                SetConsoleMode(handle, EnableExtendedFlags);

                //args = new string[] {"-i", @"D:\MassSpecFiles\training\raw\QC_Shew_Intact_26Sep14_Bane_C2Column3.pbf", "-minMass", "3000", "-maxMass", "30000"};

                if (args.Length == 0)
                {
                    PrintUsageInfo();
                    return(-1);
                }

                if (args.Length % 2 != 0)
                {
                    PrintUsageInfo("The number of arguments must be even.");
                    return(-1);
                }

                // initialize parameters
                _paramDic = new Dictionary <string, string>
                {
                    { LcMsFeatureFinderInputParameter.INPUT_FILE_PATH, null },
                    { LcMsFeatureFinderInputParameter.OUTPUT_FOLDER_PATH, null },
                    { LcMsFeatureFinderInputParameter.MINIMUM_CHARGE, "1" },
                    { LcMsFeatureFinderInputParameter.MAXIMUM_CHARGE, "60" },
                    { LcMsFeatureFinderInputParameter.MINIMUM_MASS, "2000.0" },
                    { LcMsFeatureFinderInputParameter.MAXIMUM_MASS, "50000.0" },
                    { LcMsFeatureFinderInputParameter.INCLUDE_ADDITIONAL_SCORES, "n" },
                    { LcMsFeatureFinderInputParameter.SAVE_CSV, "n" },
                    { LcMsFeatureFinderInputParameter.SAVE_PNG_FEATURE_MAP, "y" },
                    { LcMsFeatureFinderInputParameter.LIKELIHOOD_SCORE_THRESHOLD, "-10" },
                    { LcMsFeatureFinderInputParameter.MAXIMUM_THREADS, "0" },
                    { LcMsFeatureFinderInputParameter.EXISTING_MS1FT_FILE, "" }
                };

                for (var i = 0; i < args.Length / 2; i++)
                {
                    var key   = args[2 * i];
                    var value = args[2 * i + 1];
                    if (!_paramDic.ContainsKey(key))
                    {
                        PrintUsageInfo("Invalid parameter: " + key);
                        return(-1);
                    }
                    _paramDic[key] = value;
                }

                // Parse command line parameters
                var inputFilePath = _paramDic["-i"];

                if (inputFilePath == null)
                {
                    PrintUsageInfo("Missing required parameter -i!");
                    return(-1);
                }

                if (!File.Exists(inputFilePath) && !Directory.Exists(inputFilePath))
                {
                    PrintUsageInfo("File not found: " + inputFilePath);
                    return(-1);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception while parsing the command line parameters: " + ex.Message);
                return(-5);
            }

#if (!DEBUG)
            try
            {
#endif
            var param = new LcMsFeatureFinderInputParameter(_paramDic);
            Console.WriteLine("************ {0} {1} ************", Name, Version);
            param.Display();
            var launcher = new LcMsFeatureFinderLauncher(param);
            int errorCode;

            if (string.IsNullOrWhiteSpace(param.ExistingFeaturesFilePath))
            {
                errorCode = launcher.Run();
            }
            else
            {
                errorCode = launcher.CreateFeatureMapImage(param.InputPath, param.ExistingFeaturesFilePath);
            }

            return(errorCode);

#if (!DEBUG)
        }

        catch (Exception ex)
        {
            // NOTE: The DMS Analysis Manager looks for this text; do not change it
            Console.WriteLine("Exception while processing: " + ex.Message);
            Console.WriteLine(ex.StackTrace);
            var errorCode = -Math.Abs(ex.Message.GetHashCode());
            if (errorCode == 0)
            {
                return(-1);
            }

            return(errorCode);
        }
#endif
        }