3 # Copyright (c) 2017 Leiden University Medical Center
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 # Use a string here so cromwell does not relocate an entire analysis directory
30 Boolean fullNames = false
41 Array[String]+? exclude
42 Array[String]+? module
43 Boolean dataDir = false
45 Boolean zipDataDir = true
46 Boolean export = false
48 Boolean interactive = true
51 Boolean megaQCUpload = false # This must be actively enabled in my opinion. The tools default is to upload.
52 File? config # A directory
55 Int timeMinutes = 2 + ceil(size(reports, "G") * 8)
56 String dockerImage = "quay.io/biocontainers/multiqc:1.7--py_1"
58 Int memoryGb = 2 + ceil(size(reports, "G"))
60 # This is where the reports end up. It does not need to be changed by the
61 # user. It is full of symbolic links, so it is not of any use to the user
63 String reportDir = "reports"
65 # Below code requires python 3.6 or higher.
66 # This makes sure all report files are in a report directory that
67 # MultiQC can investigate.
68 # This creates files in report_dir / hashed_parent / file basename.
69 # By hashing the parent path we make sure there are no file colissions as
70 # files from the same directory end up in the same directory, while files
71 # from other directories get their own directory. Cromwell also uses this
72 # strategy. Using python's builtin hash is unique enough for these purposes.
77 from pathlib import Path
78 from typing import List
80 reports: List[str] = ["~{sep='","' reports}"]
81 report_dir: Path = Path("~{reportDir}")
83 for report in reports:
84 report_path = Path(report)
85 hashed_parent = str(hash(str(report_path.parent)))
86 new_path = report_dir / hashed_parent / report_path.name
87 if not new_path.parent.exists():
88 new_path.parent.mkdir(parents=True)
89 os.symlink(report, str(new_path))
95 ~{true="--force" false="" force} \
96 ~{true="--dirs" false="" dirs} \
97 ~{"--dirs-depth " + dirsDepth} \
98 ~{true="--fullnames" false="" fullNames} \
99 ~{"--title " + title} \
100 ~{"--comment " + comment} \
101 ~{"--filename " + fileName} \
102 ~{"--outdir " + outDir} \
103 ~{"--template " + template} \
105 ~{"--ignore " + ignore} \
106 ~{"--ignore-samples" + ignoreSamples} \
107 ~{"--sample-names " + sampleNames} \
108 ~{"--file-list " + fileList} \
109 ~{true="--exclude " false="" defined(exclude)}~{sep=" --exclude " exclude} \
110 ~{true="--module " false="" defined(module)}~{sep=" --module " module} \
111 ~{true="--data-dir" false="--no-data-dir" dataDir} \
112 ~{"--data-format " + dataFormat} \
113 ~{true="--zip-data-dir" false="" zipDataDir && dataDir} \
114 ~{true="--export" false="" export} \
115 ~{true="--flat" false="" flat} \
116 ~{true="--interactive" false="" interactive} \
117 ~{true="--lint" false="" lint} \
118 ~{true="--pdf" false="" pdf} \
119 ~{false="--no-megaqc-upload" true="" megaQCUpload} \
120 ~{"--config " + config} \
121 ~{"--cl-config " + clConfig } \
125 String reportFilename = if (defined(fileName))
126 then sub(select_first([fileName]), "\.html$", "")
130 File multiqcReport = outDir + "/" + reportFilename + "_report.html"
131 File? multiqcDataDirZip = outDir + "/" +reportFilename + "_data.zip"
135 memory: select_first([memory, "~{memoryGb}G"])
136 time_minutes: timeMinutes
141 reports: {description: "Reports which multiqc should run on.", category: "required"}
142 force: {description: "Equivalent to MultiQC's `--force` flag.", category: "advanced"}
143 dirs: {description: "Equivalent to MultiQC's `--dirs` flag.", category: "advanced"}
144 dirsDepth: {description: "Equivalent to MultiQC's `--dirs-depth` option.", category: "advanced"}
145 fullNames: {description: "Equivalent to MultiQC's `--fullnames` flag.", category: "advanced"}
146 title: {description: "Equivalent to MultiQC's `--title` option.", category: "advanced"}
147 comment: {description: "Equivalent to MultiQC's `--comment` option.", category: "advanced"}
148 fileName: {description: "Equivalent to MultiQC's `--filename` option.", category: "advanced"}
149 outDir: {description: "Directory in whihc the output should be written.", category: "common"}
150 template: {description: "Equivalent to MultiQC's `--template` option.", category: "advanced"}
151 tag: {description: "Equivalent to MultiQC's `--tag` option.", category: "advanced"}
152 ignore: {description: "Equivalent to MultiQC's `--ignore` option.", category: "advanced"}
153 ignoreSamples: {description: "Equivalent to MultiQC's `--ignore-samples` option.", category: "advanced"}
154 sampleNames: {description: "Equivalent to MultiQC's `--sample-names` option.", category: "advanced"}
155 fileList: {description: "Equivalent to MultiQC's `--file-list` option.", category: "advanced"}
156 exclude: {description: "Equivalent to MultiQC's `--exclude` option.", category: "advanced"}
157 module: {description: "Equivalent to MultiQC's `--module` option.", category: "advanced"}
158 dataDir: {description: "Whether to output a data dir. Sets `--data-dir` or `--no-data-dir` flag.", category: "advanced"}
159 dataFormat: {description: "Equivalent to MultiQC's `--data-format` option.", category: "advanced"}
160 zipDataDir: {description: "Equivalent to MultiQC's `--zip-data-dir` flag.", category: "advanced"}
161 export: {description: "Equivalent to MultiQC's `--export` flag.", category: "advanced"}
162 flat: {description: "Equivalent to MultiQC's `--flat` flag.", category: "advanced"}
163 interactive: {description: "Equivalent to MultiQC's `--interactive` flag.", category: "advanced"}
164 lint: {description: "Equivalent to MultiQC's `--lint` flag.", category: "advanced"}
165 pdf: {description: "Equivalent to MultiQC's `--pdf` flag.", category: "advanced"}
166 megaQCUpload: {description: "Opposite to MultiQC's `--no-megaqc-upload` flag.", category: "advanced"}
167 config: {description: "Equivalent to MultiQC's `--config` option.", category: "advanced"}
168 clConfig: {description: "Equivalent to MultiQC's `--cl-config` option.", category: "advanced"}
169 memory: {description: "The amount of memory this job will use.", category: "advanced"}
170 timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
171 dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.",
172 category: "advanced"}
177 exclude: ["finished", "dependencies"]