Bugfix .bai secondary file for ApplyBSQR behavior
[arvados-tutorial.git] / WGS-processing / cwl / helper / gather-vcf.cwl
1 cwlVersion: v1.1
2 class: CommandLineTool
3 label: Gather GVCF using Picard 
4
5 requirements:
6   DockerRequirement:
7     dockerPull: broadinstitute/gatk:4.1.7.0
8   ShellCommandRequirement: {}
9   InlineJavascriptRequirement: {}
10
11 hints:
12   ResourceRequirement:
13     ramMin: 20000
14     coresMin: 4 
15   arv:RuntimeConstraints:
16     outputDirType: keep_output_dir
17
18 inputs:
19   gvcfdir:
20     type: Directory
21     label: Input directory of GVCFs
22     loadListing: 'shallow_listing'
23   sample:
24     type: string
25     label: Sample Name
26   reference:
27     type: File
28     format: edam:format_1929 # FASTA
29     label: Reference genome
30     secondaryFiles:
31       - .amb
32       - .ann
33       - .bwt
34       - .pac
35       - .sa
36       - .fai
37       - ^.dict
38 outputs:
39   gatheredgvcf:
40     type: File
41     format: edam:format_3016 # GVCF
42     label: Gathered GVCF
43     secondaryFiles:
44       - .tbi
45     outputBinding:
46       glob: "*.g.vcf.gz"
47
48 baseCommand: /gatk/gatk
49
50 arguments:
51   - "--java-options"
52   - "-Xmx8G"
53   - MergeVcfs
54   - shellQuote: false
55     valueFrom: |
56      ${function compare(a, b) {
57       var baseA = a.basename;
58       var baseB = b.basename;
59
60       var comparison = 0;
61       if (baseA > baseB) {
62       comparison = 1;
63       } else if (baseA < baseB) {
64       comparison = -1;
65       }
66       return comparison;
67       }
68
69       var samples = [];
70       for (var i = 0; i < inputs.gvcfdir.listing.length; i++) {
71         var name = inputs.gvcfdir.listing[i];
72         if (name.nameext ==='.gz' ) {
73           samples.push(name.path);
74         }
75       }
76       samples = samples.sort(compare);
77       var sampleinput = [];
78
79       for (var i = 0; i < samples.length; i++) {
80        var s1 = samples[i];
81        sampleinput = sampleinput + "-I " + s1 + " "
82       }
83     
84       return sampleinput;
85       }
86   - prefix: "-O"
87     valueFrom: $(inputs.sample).g.vcf.gz
88
89 s:codeRepository: https://github.com/arvados/arvados-tutorial
90 s:license: https://www.gnu.org/licenses/agpl-3.0.en.html
91
92 $namespaces:
93  s: https://schema.org/
94  edam: http://edamontology.org/
95  arv: "http://arvados.org/cwl#"
96  cwltool: "http://commonwl.org/cwltool#"
97
98 #$schemas:
99 # - https://schema.org/version/latest/schema.rdf
100 # - http://edamontology.org/EDAM_1.18.owl