X-Git-Url: https://git.arvados.org/arvados-tutorial.git/blobdiff_plain/048038d42c6eb19005e7b121eddddeb2e7ca225c..36de0d12e1cc88d0fd7d6b401df6c6e403f8c809:/WGS-processing/cwl/helper/gather-array-vcf.cwl diff --git a/WGS-processing/cwl/helper/gather-array-vcf.cwl b/WGS-processing/cwl/helper/gather-array-vcf.cwl new file mode 100644 index 0000000..d566841 --- /dev/null +++ b/WGS-processing/cwl/helper/gather-array-vcf.cwl @@ -0,0 +1,85 @@ +cwlVersion: v1.1 +class: CommandLineTool +label: Gathering vcf using Picard +$namespaces: + arv: "http://arvados.org/cwl#" + cwltool: "http://commonwl.org/cwltool#" + +requirements: + DockerRequirement: + dockerPull: broadinstitute/gatk:4.1.7.0 + ShellCommandRequirement: {} + InlineJavascriptRequirement: {} + +hints: + ResourceRequirement: + ramMin: 20000 + coresMin: 4 + arv:RuntimeConstraints: + outputDirType: keep_output_dir + +inputs: + gvcfarray: + type: File[] + sample: string + reference: + type: File + secondaryFiles: + - .amb + - .ann + - .bwt + - .pac + - .sa + - .fai + - ^.dict +outputs: + gatheredgvcf: + type: File + secondaryFiles: + - .tbi + outputBinding: + glob: "*.g.vcf.gz" + +baseCommand: /gatk/gatk + +arguments: + - "--java-options" + - "-Xmx8G" + - MergeVcfs + - shellQuote: false + valueFrom: | + ${function compare(a, b) { + var baseA = a.basename; + var baseB = b.basename; + + var comparison = 0; + if (baseA > baseB) { + comparison = 1; + } else if (baseA < baseB) { + comparison = -1; + } + return comparison; + } + + var sortedarray = []; + sortedarray = inputs.gvcfarray.sort(compare) + + var samples = []; + for (var i = 0; i < sortedarray.length; i++) { + var name = sortedarray[i]; + if (name.nameext ==='.gz' ) { + samples.push(name.path); + } + } + + var sampleinput = ""; + + for (var i = 0; i < samples.length; i++) { + var s1 = samples[i]; + sampleinput = sampleinput + "-I " + s1 + " " + } + + return sampleinput; + } + - prefix: "-O" + valueFrom: $(inputs.sample).g.vcf.gz