Example #1
0
        static int DoStuff(ArgumentParser.QcOptions opts)
        {
            Log.Information("Starting QC. Identipy: {Identipy}", opts.Identipy);
            //Console.WriteLine("\n");

            /*
             * if (new List<string>() { "DDA", "DIA", "PRM" }.Contains(opts.ExperimentType))
             * { }
             * else
             * {
             *  Log.Error("Experiment type of {ExpType} was passed", opts.ExperimentType);
             *  Console.WriteLine("Experiment type must be one of ['DDA', 'DIA', 'PRM'], not {0}", opts.ExperimentType);
             *  Environment.Exit(1);
             * }*/

            if (opts.SearchAlgorithm != null & !(new List <string>()
            {
                "identipy", "xtandem", "None"
            }.Contains(opts.SearchAlgorithm)))
            {
                // the search algorithm is not null but it also it not identipy or xtandem
                Log.Error("Invalid search algorithm argument: {Argument}", opts.SearchAlgorithm);
                Console.WriteLine("ERROR: Search algorithm must be one of {identipy, xtandem}");
                return(1);
            }

            if (opts.Identipy)
            {
                opts.SearchAlgorithm = "identipy";
            }

            WorkflowParameters parameters = new WorkflowParameters(opts);


            if (opts.SearchAlgorithm != "None")
            {
                if (opts.FastaDatabase == null)
                {
                    Log.Error("No fasta database provided for Identipy search");
                    Console.WriteLine("ERROR: A fasta protein database is required for a database search. Please use the --db parameter to " +
                                      "provide the path to a database.");
                    Environment.Exit(1);
                }

                if (opts.SearchAlgorithm == "identipy")
                {
                    if ((opts.IdentipyScript == null & opts.PythonExecutable != null) | (opts.IdentipyScript != null & opts.PythonExecutable == null))
                    {
                        Log.Error("If providing location of python or identipy, must specify both of them.");
                        Console.WriteLine("ERROR: When invoking the -p or -I options, you must supply both of them.");
                        Environment.Exit(1);
                    }

                    Identipy.CheckIdentipyDependencies(parameters);
                }

                if (opts.SearchAlgorithm == "xtandem")
                {
                    if (opts.XTandemDirectory == null)
                    {
                        Log.Error("Path to XTandem directory was not provided");
                        Console.WriteLine("ERROR: You must specify the X! Tandem directory using the -X argument to perform a search using X! Tandem.");
                        return(1);
                    }
                }
            }

            QC.QcWorkflow.DoQc(parameters, opts.SubdirectoriesIncluded);

            return(0);
        }
Example #2
0
        static int DoStuff(ArgumentParser.QcOptions opts)
        {
            Log.Information("Starting QC. Identipy: {Identipy}", opts.Identipy);
            //Console.WriteLine("\n");
            SearchParameters searchParameters;

            QcParameters qcParameters = new QcParameters();

            qcParameters.RawFileDirectory = opts.DirectoryToQc;
            qcParameters.QcDirectory      = opts.QcDirectory;
            qcParameters.QcFile           = Path.Combine(opts.QcDirectory, "QC.xml");


            if (opts.SearchAlgorithm != null & !(new List <string>()
            {
                "identipy", "xtandem"
            }.Contains(opts.SearchAlgorithm)))
            {
                // the search algorithm is not null but it also it not identipy or xtandem
                Log.Error("Invalid search algorithm argument: {Argument}", opts.SearchAlgorithm);
                Console.WriteLine("ERROR: Search algorithm must be one of {identipy, xtandem}");
                return(1);
            }

            if (opts.Identipy)
            {
                opts.SearchAlgorithm = "identipy";
            }

            if (opts.SearchAlgorithm != null)
            {
                if (opts.FastaDatabase == null)
                {
                    Log.Error("No fasta database provided for Identipy search");
                    Console.WriteLine("ERROR: A fasta protein database is required for an Identipy search. Please use the --db parameter to " +
                                      "provide the path to a database.");
                    Environment.Exit(1);
                }

                searchParameters = new SearchParameters
                {
                    PythonExecutable   = opts.PythonExecutable,
                    IdentipyScript     = opts.IdentipyScript,
                    XTandemDirectory   = opts.XTandemDirectory,
                    FastaDatabase      = opts.FastaDatabase,
                    FixedMods          = opts.FixedMods,
                    NMod               = opts.VariableNMod,
                    KMod               = opts.VariableKMod,
                    XMod               = opts.VariableXMod,
                    NumSpectra         = opts.NumberSpectra,
                    MgfIntensityCutoff = opts.IntensityCutoff,
                    MgfMassCutoff      = opts.MassCutOff,
                    FixedScans         = opts.FixedScans
                };

                if (opts.SearchAlgorithm == "identipy")
                {
                    if ((opts.IdentipyScript == null & opts.PythonExecutable != null) | (opts.IdentipyScript != null & opts.PythonExecutable == null))
                    {
                        Log.Error("If providing location of python or identipy, must specify both of them.");
                        Console.WriteLine("ERROR: When invoking the -p or -I options, you must supply both of them.");
                        Environment.Exit(1);
                    }

                    Identipy.CheckIdentipyDependencies(searchParameters);

                    searchParameters.SearchAlgorithm = SearchAlgorithm.IdentiPy;
                }

                if (opts.SearchAlgorithm == "xtandem")
                {
                    if (opts.XTandemDirectory == null)
                    {
                        Log.Error("Path to XTandem directory was not provided");
                        Console.WriteLine("ERROR: You must specify the X! Tandem directory using the -X argument to perform a search using X! Tandem.");
                        return(1);
                    }
                    searchParameters.SearchAlgorithm = SearchAlgorithm.XTandem;
                }
            }
            else
            {
                searchParameters = null;
            }
            qcParameters.searchParameters = searchParameters;

            QC.QC.DoQc(qcParameters);

            return(0);
        }