The SNV reviewer takes as input a .vcf file (from the normal sample) and a .bam file (from the paired tumor sample). It processes a particular chromosome at a time. For all variants in the .vcf file that pass our filters, we review the variant allele frequency in the .bam file from the tumor sample. We output that data in tabular format.
Exemplo n.º 1
0
        // Arguments: chromosome, NormalVCFPath, TumorBamPath, OutputPath
        static int Main(string[] arguments)
        {
            CanvasCommon.Utilities.LogCommandLine(arguments);
            if (arguments.Length < 4)
            {
                Console.WriteLine("Usage: Chromosome NormalVCFPath TumorBAMPath OutputPath");
                return 1;
            }
            
            string chromosome = arguments[0];
            string vcfPath = arguments[1];
            string bamPath = arguments[2];
            string outputPath = arguments[3];

            // Handle some special cases, if the "chromosome" is a special string:
            switch (chromosome.ToLowerInvariant())
            {
                case "histogram":
                    return BuildEmpiricalHistograms(vcfPath, bamPath, outputPath);
                case "regionhistogram":
                    return BuildRegionHistograms(vcfPath, bamPath, outputPath);
                default:
                    // Ordinary chromosome name.
                    break;
            }

            // Standard logic: Process one chromosome, write output to the specified file path:
            SNVReviewer processor = new SNVReviewer();
            processor.Chromosome = chromosome;
            return processor.Main(vcfPath, bamPath, outputPath);
        }
Exemplo n.º 2
0
        // Arguments: chromosome, NormalVCFPath, TumorBamPath, OutputPath
        static int Main(string[] arguments)
        {
            CanvasCommon.Utilities.LogCommandLine(arguments);
            if (arguments.Length < 4)
            {
                Console.WriteLine("Usage: Chromosome NormalVCFPath TumorBAMPath OutputPath [MinMapQ]");
                return(1);
            }

            string chromosome = arguments[0];
            string vcfPath    = arguments[1];
            string bamPath    = arguments[2];
            string outputPath = arguments[3];
            int    minMapQ    = 0; // only use reads with MAPQ greater than this number

            if (arguments.Length > 4)
            {
                minMapQ = int.Parse(arguments[4]);
            }

            // Handle some special cases, if the "chromosome" is a special string:
            switch (chromosome.ToLowerInvariant())
            {
            case "histogram":
                return(BuildEmpiricalHistograms(vcfPath, bamPath, outputPath));

            case "regionhistogram":
                return(BuildRegionHistograms(vcfPath, bamPath, outputPath));

            default:
                // Ordinary chromosome name.
                break;
            }

            // Standard logic: Process one chromosome, write output to the specified file path:
            SNVReviewer processor = new SNVReviewer(chromosome, vcfPath, bamPath, outputPath, minMapQ);

            return(processor.Run());
        }
Exemplo n.º 3
0
        static int Main(string[] args)
        {
            CanvasCommon.Utilities.LogCommandLine(args);
            string chromosome = null;
            string vcfPath    = null;
            string bamPath    = null;
            string outputPath = null;
            string sampleName = null;
            bool   isSomatic  = false;
            bool   isDbSnpVcf = false; // assume vcf file comes from a small variant caller (Strelka)
            int    minMapQ    = 0;     // only use reads with MAPQ greater than this number
            bool   needHelp   = false;

            var p = new OptionSet()
            {
                { "c|chromosome=", "chromosome namne", v => chromosome = v },
                { "v|vcfPath=", "file containing small variants", v => vcfPath = v },
                { "b|bamPath=", "bam file", v => bamPath = v },
                { "o|outputPath=", "name of output directory", v => outputPath = v },
                { "n|sampleName=", "sample name for output VCF header (optional)", v => sampleName = v },
                { "i|isDbSnpVcf=", "flag to specify if vcf file contains dbSNP variants (optional)", v => isDbSnpVcf = v != null },
                { "q|minMapQ=", "mapQ threshold for vcf file (optional)", v => minMapQ = int.Parse(v) },
                { "s|isSomatic", "flag to specify if Canvas workflow is somatic (optional)", v => isSomatic = v != null },
                { "h|help", "show this message and exit", v => needHelp = v != null },
            };

            var 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 (string.IsNullOrEmpty(chromosome) || string.IsNullOrEmpty(outputPath))
            {
                ShowHelp(p);
                return(0);
            }

            if (!File.Exists(vcfPath))
            {
                Console.WriteLine($"CanvasSNV.exe: File {vcfPath} does not exist! Exiting.");
                return(1);
            }

            if (!File.Exists(bamPath))
            {
                Console.WriteLine($"CanvasSNV.exe: File {bamPath} does not exist! Exiting.");
                return(1);
            }

            // Handle some special cases, if the "chromosome" is a special string:
            switch (chromosome.ToLowerInvariant())
            {
            case "histogram":
                return(BuildEmpiricalHistograms(vcfPath, bamPath, outputPath));

            case "regionhistogram":
                return(BuildRegionHistograms(vcfPath, bamPath, outputPath));

            default:
                // Ordinary chromosome name.
                break;
            }

            // Standard logic: Process one chromosome, write output to the specified file path:
            SNVReviewer processor = new SNVReviewer(chromosome, vcfPath, bamPath, outputPath, sampleName, isDbSnpVcf, minMapQ, isSomatic);

            return(processor.Run());
        }