Skip to content

Commit 4a77c5d

Browse files
authored
Merge pull request #12 from microbiomedata/output_tweaks
WIP: adjust outputs
2 parents d2e1b65 + a013ef1 commit 4a77c5d

2 files changed

Lines changed: 83 additions & 58 deletions

File tree

ReadbasedAnalysis.wdl

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ workflow ReadbasedAnalysis {
1515
input: READS = reads,
1616
DB = db["gottcha2"],
1717
PREFIX = prefix,
18-
OUTPATH = outdir+"/gottcha2",
1918
CPU = cpu,
2019
DOCKER = docker
2120
}
@@ -27,7 +26,6 @@ workflow ReadbasedAnalysis {
2726
PAIRED = paired,
2827
DB = db["kraken2"],
2928
PREFIX = prefix,
30-
OUTPATH = outdir+"/kraken2",
3129
CPU = cpu,
3230
DOCKER = docker
3331
}
@@ -38,26 +36,42 @@ workflow ReadbasedAnalysis {
3836
input: READS = reads,
3937
DB = db["centrifuge"],
4038
PREFIX = prefix,
41-
OUTPATH = outdir+"/centrifuge",
4239
CPU = cpu,
4340
DOCKER = docker
4441
}
4542
}
4643
47-
call tasks.generateSummaryJson {
48-
input: TSV_META_JSON = [profilerGottcha2.results, profilerCentrifuge.results, profilerKraken2.results],
49-
PREFIX = prefix,
50-
OUTPATH = outdir,
51-
DOCKER = docker
44+
# call tasks.generateSummaryJson {
45+
# input: TSV_META_JSON = [profilerGottcha2.results, profilerCentrifuge.results, profilerKraken2.results],
46+
# PREFIX = prefix,
47+
# OUTPATH = outdir,
48+
# DOCKER = docker
49+
# }
50+
call make_outputs {
51+
input: gottcha2_report_tsv = profilerGottcha2.report_tsv,
52+
gottcha2_full_tsv = profilerGottcha2.full_tsv,
53+
gottcha2_krona_html = profilerGottcha2.krona_html,
54+
centrifuge_classification_tsv = profilerCentrifuge.classification_tsv,
55+
centrifuge_report_tsv = profilerCentrifuge.report_tsv,
56+
centrifuge_krona_html = profilerCentrifuge.krona_html,
57+
kraken2_classification_tsv = profilerKraken2.classification_tsv,
58+
kraken2_report_tsv = profilerKraken2.report_tsv,
59+
kraken2_krona_html = profilerKraken2.krona_html,
60+
outdir = outdir,
61+
container = docker
5262
}
5363
5464
output {
55-
Map[String, Map[String, String]?] results = {
56-
"gottcha2": profilerGottcha2.results,
57-
"centrifuge": profilerCentrifuge.results,
58-
"kraken2": profilerKraken2.results
59-
}
60-
File summary_json = generateSummaryJson.summary_json
65+
File? gottcha2_report_tsv = profilerGottcha2.report_tsv
66+
File? gottcha2_full_tsv = profilerGottcha2.full_tsv
67+
File? gottcha2_krona_html = profilerGottcha2.krona_html
68+
File? centrifuge_classification_tsv = profilerCentrifuge.classification_tsv
69+
File? centrifuge_report_tsv = profilerCentrifuge.report_tsv
70+
File? centrifuge_krona_html = profilerCentrifuge.krona_html
71+
File? kraken2_classification_tsv = profilerKraken2.classification_tsv
72+
File? kraken2_report_tsv = profilerKraken2.report_tsv
73+
File? kraken2_krona_html = profilerKraken2.krona_html
74+
# File summary_json = generateSummaryJson.summary_json
6175
}
6276

6377
meta {
@@ -66,3 +80,39 @@ workflow ReadbasedAnalysis {
6680
version: "1.0.2"
6781
}
6882
}
83+
84+
85+
task make_outputs{
86+
String outdir
87+
File? gottcha2_report_tsv
88+
File? gottcha2_full_tsv
89+
File? gottcha2_krona_html
90+
File? centrifuge_classification_tsv
91+
File? centrifuge_report_tsv
92+
File? centrifuge_krona_html
93+
File? kraken2_classification_tsv
94+
File? kraken2_report_tsv
95+
File? kraken2_krona_html
96+
String container
97+
98+
command<<<
99+
mkdir -p ${outdir}/gottcha2
100+
cp ${gottcha2_report_tsv} ${gottcha2_full_tsv} ${gottcha2_krona_html} \
101+
${outdir}/gottcha2
102+
mkdir -p ${outdir}/centrifuge
103+
cp ${centrifuge_classification_tsv} ${centrifuge_report_tsv} ${centrifuge_krona_html} \
104+
${outdir}/centrifuge
105+
mkdir -p ${outdir}/kraken2
106+
cp ${kraken2_classification_tsv} ${kraken2_report_tsv} ${kraken2_krona_html} \
107+
${outdir}/kraken2
108+
>>>
109+
runtime {
110+
docker: container
111+
memory: "1 GiB"
112+
cpu: 1
113+
}
114+
output{
115+
Array[String] fastq_files = glob("${outdir}/*.fastq*")
116+
}
117+
}
118+

ReadbasedAnalysisTasks.wdl

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,35 @@
11
task profilerGottcha2 {
22
Array[File] READS
33
String DB
4-
String OUTPATH
54
String PREFIX
65
String? RELABD_COL = "ROLLUP_DOC"
76
String DOCKER
87
Int? CPU = 4
98

109
command <<<
1110
set -euo pipefail
12-
mkdir -p ${OUTPATH}
13-
touch ${OUTPATH}/${PREFIX}.full.tsv
1411
1512
gottcha2.py -r ${RELABD_COL} \
1613
-i ${sep=' ' READS} \
1714
-t ${CPU} \
18-
-o ${OUTPATH} \
15+
-o . \
1916
-p ${PREFIX} \
2017
--database ${DB}
2118
22-
grep "^species" ${OUTPATH}/${PREFIX}.tsv | ktImportTaxonomy -t 3 -m 9 -o ${OUTPATH}/${PREFIX}.krona.html - || true
19+
grep "^species" ${PREFIX}.tsv | ktImportTaxonomy -t 3 -m 9 -o ${PREFIX}.krona.html - || true
2320
>>>
2421
output {
25-
Map[String, String] results = {
26-
"tool": "gottcha2",
27-
"orig_out_tsv": "${OUTPATH}/${PREFIX}.full.tsv",
28-
"orig_rep_tsv": "${OUTPATH}/${PREFIX}.tsv",
29-
"krona_html": "${OUTPATH}/${PREFIX}.krona.html"
30-
}
22+
File report_tsv = "${PREFIX}.tsv"
23+
File full_tsv = "${PREFIX}.full.tsv"
24+
File krona_html = "${PREFIX}.krona.html"
3125
}
3226
runtime {
3327
docker: DOCKER
3428
cpu: CPU
35-
poolname: "readbaseanalysis-pool"
3629
node: 1
3730
nwpn: 1
3831
mem: "45G"
3932
time: "04:00:00"
40-
shared: 0
4133
}
4234
meta {
4335
author: "Po-E Li, B10, LANL"
@@ -48,40 +40,33 @@ task profilerGottcha2 {
4840
task profilerCentrifuge {
4941
Array[File] READS
5042
String DB
51-
String OUTPATH
5243
String PREFIX
5344
Int? CPU = 4
5445
String DOCKER
5546

5647
command <<<
5748
set -euo pipefail
58-
mkdir -p ${OUTPATH}
5949
6050
centrifuge -x ${DB} \
6151
-p ${CPU} \
6252
-U ${sep=',' READS} \
63-
-S ${OUTPATH}/${PREFIX}.classification.tsv \
64-
--report-file ${OUTPATH}/${PREFIX}.report.tsv
53+
-S ${PREFIX}.classification.tsv \
54+
--report-file ${PREFIX}.report.tsv
6555
66-
ktImportTaxonomy -m 5 -t 2 -o ${OUTPATH}/${PREFIX}.krona.html ${OUTPATH}/${PREFIX}.report.tsv
56+
ktImportTaxonomy -m 5 -t 2 -o ${PREFIX}.krona.html ${PREFIX}.report.tsv
6757
>>>
6858
output {
69-
Map[String, String] results = {
70-
"tool": "centrifuge",
71-
"orig_out_tsv": "${OUTPATH}/${PREFIX}.classification.tsv",
72-
"orig_rep_tsv": "${OUTPATH}/${PREFIX}.report.tsv",
73-
"krona_html": "${OUTPATH}/${PREFIX}.krona.html"
74-
}
59+
File classification_tsv="${PREFIX}.classification.tsv"
60+
File report_tsv="${PREFIX}.report.tsv"
61+
File krona_html="${PREFIX}.krona.html"
7562
}
7663
runtime {
7764
docker: DOCKER
7865
cpu: CPU
79-
poolname: "readbaseanalysis-pool"
8066
node: 1
8167
nwpn: 1
8268
mem: "45G"
8369
time: "04:00:00"
84-
shared: 0
8570
}
8671
meta {
8772
author: "Po-E Li, B10, LANL"
@@ -92,42 +77,35 @@ task profilerCentrifuge {
9277
task profilerKraken2 {
9378
Array[File] READS
9479
String DB
95-
String OUTPATH
9680
String PREFIX
9781
Boolean? PAIRED = false
9882
Int? CPU = 4
9983
String DOCKER
10084

10185
command <<<
10286
set -euo pipefail
103-
mkdir -p ${OUTPATH}
10487
10588
kraken2 ${true="--paired" false='' PAIRED} \
10689
--threads ${CPU} \
10790
--db ${DB} \
108-
--output ${OUTPATH}/${PREFIX}.classification.tsv \
109-
--report ${OUTPATH}/${PREFIX}.report.tsv \
91+
--output ${PREFIX}.classification.tsv \
92+
--report ${PREFIX}.report.tsv \
11093
${sep=' ' READS}
11194
112-
ktImportTaxonomy -m 3 -t 5 -o ${OUTPATH}/${PREFIX}.krona.html ${OUTPATH}/${PREFIX}.report.tsv
95+
ktImportTaxonomy -m 3 -t 5 -o ${PREFIX}.krona.html ${PREFIX}.report.tsv
11396
>>>
11497
output {
115-
Map[String, String] results = {
116-
"tool": "kraken2",
117-
"orig_out_tsv": "${OUTPATH}/${PREFIX}.classification.tsv",
118-
"orig_rep_tsv": "${OUTPATH}/${PREFIX}.report.tsv",
119-
"krona_html": "${OUTPATH}/${PREFIX}.krona.html"
120-
}
98+
File classification_tsv = "${PREFIX}.classification.tsv"
99+
File report_tsv = "${PREFIX}.report.tsv"
100+
File krona_html = "${PREFIX}.krona.html"
121101
}
122102
runtime {
123103
docker: DOCKER
124104
cpu: CPU
125-
poolname: "readbaseanalysis-pool"
126105
node: 1
127106
nwpn: 1
128107
mem: "45G"
129108
time: "04:00:00"
130-
shared: 0
131109
}
132110
meta {
133111
author: "Po-E Li, B10, LANL"
@@ -137,24 +115,21 @@ task profilerKraken2 {
137115

138116
task generateSummaryJson {
139117
Array[Map[String, String]?] TSV_META_JSON
140-
String OUTPATH
141118
String PREFIX
142119
String DOCKER
143120

144121
command {
145-
outputTsv2json.py --meta ${write_json(TSV_META_JSON)} > ${OUTPATH}/${PREFIX}.json
122+
outputTsv2json.py --meta ${write_json(TSV_META_JSON)} > ${PREFIX}.json
146123
}
147124
output {
148-
File summary_json = "${OUTPATH}/${PREFIX}.json"
125+
File summary_json = "${PREFIX}.json"
149126
}
150127
runtime {
151128
docker: DOCKER
152-
poolname: "readbaseanalysis-pool"
153129
node: 1
154130
nwpn: 1
155131
mem: "45G"
156132
time: "04:00:00"
157-
shared: 0
158133
}
159134
meta {
160135
author: "Po-E Li, B10, LANL"

0 commit comments

Comments
 (0)