CanvasDiploidCaller.Program.Main C# (CSharp) Метод

Main() статический приватный Метод

static private Main ( string args ) : int
args string
Результат int
        static int Main(string[] args)
        {
            CanvasCommon.Utilities.LogCommandLine(args);
            string inFile = null;
            string outFile = null;
            string variantFrequencyFile = null;
            string ploidyBedPath = null;
            string referenceFolder = null;
            string sampleName = "SAMPLE";
            bool isDbsnpVcf = false;
            bool needHelp = false;
            string truthDataPath = null;

            var p = new OptionSet()
            {
                { "i|infile=",        "file containing bins, their counts, and assigned segments (obtained from CanvasPartition.exe)",  v => inFile = v },
                { "v|varfile=",       "file containing variant frequencies (obtained from CanvasSNV.exe)",                              v => variantFrequencyFile = v },
                { "o|outfile=",       "file name prefix to ouput copy number calls to outfile.vcf",                                     v => outFile = v },
                { "r|reference=",     "reference genome folder that contains GenomeSize.xml",                                           v => referenceFolder = v },
                { "n|sampleName=",    "sample name for output VCF header (optional)",                                                   v => sampleName = v },
                { "p|ploidyBed=",     "bed file specifying reference ploidy (e.g. for sex chromosomes) (optional)",                     v => ploidyBedPath = v },
                { "d|dbsnpvcf", "flag indicating a dbSNP VCF file is used to generate the variant frequency file",                      v => isDbsnpVcf = v != null },
                { "h|help",           "show this message and exit",                                                                     v => needHelp = v != null },
                { "t|truth=", "path to vcf/bed with CNV truth data (optional)", v => truthDataPath = v },
            };

            List<string> extraArgs = p.Parse(args);

            if (extraArgs.Count > 0)
            {
                Console.WriteLine("* Error: I don't understand the argument '{0}'", extraArgs[0]);
                needHelp = true;
            }
            if (needHelp)
            {
                ShowHelp(p);
                return 0;
            }

            if (inFile == null || outFile == null || string.IsNullOrEmpty(variantFrequencyFile) || string.IsNullOrEmpty(referenceFolder))
            {
                ShowHelp(p);
                return 0;
            }

            if (!File.Exists(inFile))
            {
                Console.WriteLine("CanvasDiploidCaller.exe: File {0} does not exist! Exiting.", inFile);
                return 1;
            }

            if (!File.Exists(variantFrequencyFile))
            {
                Console.WriteLine("Canvas error: File {0} does not exist! Exiting.", variantFrequencyFile);
                return 1;
            }

            if (!File.Exists(Path.Combine(referenceFolder, "GenomeSize.xml")))
            {
                Console.WriteLine("CanvasDiploidCaller.exe: File {0} does not exist! Exiting.", Path.Combine(referenceFolder, "GenomeSize.xml"));
                return 1;
            }
            CanvasDiploidCaller caller = new CanvasDiploidCaller();
            // Set parameters:
            caller.IsDbsnpVcf = isDbsnpVcf;
            return caller.CallVariants(variantFrequencyFile, inFile, outFile, ploidyBedPath, referenceFolder, sampleName, truthDataPath);
        }