modified: fm2.wdl
[GalaxyCodeBases.git] / etc / gatk-wdl / fm2 / fm2.wdl
blobd9abf11fd06f13a212b51e021abb221ba4864b52
1 version 1.0
3 import "tasks/sample.wdl" as sampleWf
4 import "tasks/common.wdl" as common
5 import "tasks/structs.wdl" as structs
7 workflow fm2 {
8         input {
9                 File sampleConfigFile
10                 String outputDir = "."
11                 String platform = "illumina"
12                 Boolean useBwaKit = false
13                 Int scatterSizeMillions = 1000
14                 Int? minBWAmatchLen = 200
15                 BwaIndex bwaIndex
16                 GatkIndex GatkIndex
17                 String? adapterForward = "AAGTCGGAGGCCAAGCGGTCTTAGGAAGACAA"  # Illumina universal adapter.
18                 String? adapterReverse = "AAGTCGGATCGTAGCCATGTCGTTC"  # Illumina universal adapter.
19                 Int? scatterSize
20                 Int bwaThreads = 4
21                 File dockerImagesFile
22         }
24         # Parse docker Tags configuration and sample sheet.
25         call common.YamlToJson as convertDockerImagesFile {
26                 input:
27                         yaml = dockerImagesFile,
28                         outputJson = "dockerImages.json"
29         }
31         Map[String, String] dockerImages = read_json(convertDockerImagesFile.json)
32         #Array[Array[File]] inputSamples = read_tsv(SampleFqTSV)
33         SampleConfig sampleConfig = read_json(sampleConfigFile)
35         scatter (sample in sampleConfig.samples) {
36                 String sampleIds = sample.id
37                 String sampleDir = outputDir + "/samples/" + sample.id + "/"
38                 call sampleWf.SampleWorkflow as sampleWorkflow {
39                         input:
40                                 sampleDir = sampleDir,
41                                 sample = sample,
42                                 bwaThreads = bwaThreads,
43                                 bwaIndex = bwaIndex,
44                                 #bwaMem2Index = bwaMem2Index,
45                                 GatkIndex = GatkIndex,
46                                 adapterForward = adapterForward,
47                                 adapterReverse = adapterReverse,
48                                 useBwaKit = useBwaKit,
49                                 dockerImages = dockerImages,
50                                 #scatters = scatterList.scatters,
51                                 bwaThreads = bwaThreads,
52                                 platform = platform,
53                                 minBWAmatchLen = minBWAmatchLen
54                                 #sampleName = sample.id,
55                                 #gender = select_first([sample.gender, "unknown"]),
56                 }
57         }
59         Array[File] allReports = flatten([
60                 flatten(sampleWorkflow.reports)
61                 #, flatten(singleSampleCalling.reports)
62         ])
63         
64         output {
65                 File dockerImagesList = convertDockerImagesFile.json
66                 #File multiqcReport = multiqcTask.multiqcReport
67                 Array[File] reports = allReports
68                 #Array[File] recalibratedBams = sampleWorkflow.recalibratedBam
69                 #Array[File] recalibratedBamIndexes = sampleWorkflow.recalibratedBamIndex
70                 Array[File] markdupBams = sampleWorkflow.markdupBam
71                 Array[File] markdupBamIndexes = sampleWorkflow.markdupBamIndex
72                 Array[File] filteredBam = sampleWorkflow.filteredBam
73                 Array[File] filteredBamIndex = sampleWorkflow.filteredBamIndex
74                 Array[File] outSNP0txts = sampleWorkflow.outSNP0txt
75                 Array[File] outSTR0txts = sampleWorkflow.outSTR0txt
76                 Array[File] outSNPtxts = sampleWorkflow.outSNPtxt
77                 Array[File] outSTRtxts = sampleWorkflow.outSTRtxt
78                 Array[File] outbcfFiles = sampleWorkflow.outbcfFile
79                 Array[File] outsnpFiles = sampleWorkflow.outsnpFile
80                 #Array[File?] mantaVCFs = svCalling.mantaVcf
81                 #Array[File?] dellyVCFs = svCalling.dellyVcf
82                 #Array[File?] survivorVCFs = svCalling.survivorVcf
83                 #Array[Array[File]?] modifiedVcfs = svCalling.modifiedVcfs
84         }
86         parameter_meta {
87                 # inputs
88                 sampleConfigFile: {description: "The samplesheet, including sample ids, library ids, readgroup ids and fastq file locations.", category: "required"}
89                 outputDir: {description: "The directory the output should be written to.", category: "common"}
90                 platform: {description: "The platform used for sequencing.", category: "advanced"}
91                 useBwaKit: {description: "Whether or not BWA kit should be used. If false BWA mem will be used.", category: "advanced"}
92                 scatterSizeMillions:{description: "Same as scatterSize, but is multiplied by 1000000 to get scatterSize. This allows for setting larger values more easily.", category: "advanced"}
93                 bwaIndex: {description: "The BWA index files. When these are provided BWA will be used.", category: "common"}
94                 adapterForward: {description: "The adapter to be removed from the reads first or single end reads.", category: "common"}
95                 adapterReverse: {description: "The adapter to be removed from the reads second end reads.", category: "common"}
96                 scatterSize: {description: "The size of the scattered regions in bases for the GATK subworkflows. Scattering is used to speed up certain processes. The genome will be seperated into multiple chunks (scatters) which will be processed in their own job, allowing for parallel processing. Higher values will result in a lower number of jobs. The optimal value here will depend on the available resources.", category: "advanced"}
97                 bwaThreads: {description: "The amount of threads for the alignment process.", category: "advanced"}
98                 dockerImagesFile: {description: "A YAML file describing the docker image used for the tasks. The dockerImages.yml provided with the pipeline is recommended.", category: "advanced"}
100                 # outputs
101                 dockerImagesList: {description: "Json file describing the docker images used by the pipeline."}
102                 reports: {description: ""}
103                 recalibratedBams: {description: ""}
104                 recalibratedBamIndexes: {description: ""}
105                 markdupBams: {description: ""}
106                 markdupBamIndexes: {description: ""}
107         }