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