From 31b21e1e197b5c646b2ad202cd4fa56cc54816e8 Mon Sep 17 00:00:00 2001 From: cagaser <c.agaser@lumc.nl> Date: Fri, 14 Aug 2020 16:10:47 +0200 Subject: [PATCH] add bcftools annotate --- bcftools.wdl | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/bcftools.wdl b/bcftools.wdl index 8875903..33685c3 100644 --- a/bcftools.wdl +++ b/bcftools.wdl @@ -22,6 +22,106 @@ version 1.0 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +task Annotate { + input { + File? annsFile + String? collapse + Array[String] columns = [] + String? exclude + Boolean force = false + File? headerLines + String? newId + String? include + Boolean keepSites = false + String? markSites + Boolean noVersion = false + String outputType = "z" + String? regions + File? regionsFile + File? renameChrs + Array[String] samples = [] + File? samplesFile + Boolean singleOverlaps = false + Array[String] removeAnns = [] + File inputFile + String outputPath = "output.vcf.gz" + + Int threads = 0 + String memory = "256M" + Int timeMinutes = 1 + ceil(size(inputFile, "G")) + String dockerImage = "quay.io/biocontainers/bcftools:1.10.2--h4f4756c_2" + } + + command { + set -e + mkdir -p "$(dirname ~{outputPath})" + bcftools annotate \ + -o ~{outputPath} \ + -O ~{outputType} \ + ~{"--annotations " + annsFile} \ + ~{"--collapse " + collapse} \ + ~{true="--columns" false="" length(columns) > 0} ~{sep="," columns} \ + ~{"--exclude " + exclude} \ + ~{true="--force" false="" force} \ + ~{"--header-lines " + headerLines} \ + ~{"--set-id " + newId} \ + ~{"--include " + include} \ + ~{true="--keep-sites" false="" keepSites} \ + ~{"--mark-sites " + markSites} \ + ~{true="--no-version" false="" noVersion} \ + ~{"--regions " + regions} \ + ~{"--regions-file " + regionsFile} \ + ~{"--rename-chrs " + renameChrs} \ + ~{true="--samples" false="" length(samples) > 0} ~{sep="," samples} \ + ~{"--samples-file " + samplesFile} \ + ~{true="--single-overlaps" false="" singleOverlaps} \ + ~{true="--remove" false="" length(removeAnns) > 0} ~{sep="," removeAnns} \ + ~{inputFile} + bcftools index --tbi ~{outputPath} + + } + + output { + File outputVcf = outputPath + File outputVcfIndex = outputPath + ".tbi" + } + + runtime { + memory: memory + time_minutes: timeMinutes + docker: dockerImage + } + + parameter_meta { + outputPath: {description: "The location the output VCF file should be written.", category: "common"} + outputType: {description: "Output type: v=vcf, z=vcf.gz, b=bcf, u=uncompressed bcf", category: "advanced"} + annsFile: {description: "Bgzip-compressed and tabix-indexed file with annotations (see man page for details).", category: "advanced"} + collapse: {description: "Treat as identical records with <snps|indels|both|all|some|none>, see man page for details.", category: "advanced"} + columns: {description: "Comma-separated list of columns or tags to carry over from the annotation file (see man page for details).", category: "advanced"} + exclude: {description: "Exclude sites for which the expression is true (see man page for details).", category: "advanced"} + force: {description: "Continue even when parsing errors, such as undefined tags, are encountered.", category: "advanced"} + headerLines: {description: "Lines to append to the VCF header (see man page for details).", category: "advanced"} + newId: {description: "Assign ID on the fly (e.g. --set-id +'%CHROM\_%POS').", category: "advanced"} + include: {description: "Select sites for which the expression is true (see man page for details).", category: "advanced"} + keepSites: {description: "Keep sites which do not pass -i and -e expressions instead of discarding them.", category: "advanced"} + markSites: {description: "Annotate sites which are present ('+') or absent ('-') in the -a file with a new INFO/TAG flag.", category: "advanced"} + noVersion: {description: "Do not append version and command line information to the output VCF header.", category: "advanced"} + regions: {description: "Restrict to comma-separated list of regions.", category: "advanced"} + regionsFile: {description: "Restrict to regions listed in a file.", category: "advanced"} + renameChrs: {description: "rename chromosomes according to the map in file (see man page for details).", category: "advanced"} + samples: {description: "List of samples for sample stats, \"-\" to include all samples.", category: "advanced"} + samplesFile: {description: "File of samples to include.", category: "advanced"} + singleOverlaps: {description: "keep memory requirements low with very large annotation files.", category: "advanced"} + removeAnns: {description: "List of annotations to remove (see man page for details).", category: "advanced"} + inputFile: {description: "A vcf or bcf file.", category: "required"} + + threads: {description: "Number of extra decompression threads [0].", category: "advanced"} + dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"} + memory: {description: "The amount of memory this job will use.", category: "advanced"} + timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"} + } +} + task View { input { File inputFile -- GitLab