Skip to content

Commit f01798d

Browse files
committed
Fix deacon CLI flags and decontaminate process name collision
The RUN_DEACON process still uses the old zcat-pipe-pigz pattern and the deprecated --log flag from before deacon v0.5.0. Deacon now handles compressed I/O and threading natively, and the flag was renamed to --summary. This commit updates RUN_DEACON to use deacon's native I/O with --output and --summary. The DECONTAMINATE subworkflow also has a bug where it unconditionally calls both INDEX_CONTAMINANTS and GET_INDEX, then invokes RUN_DEACON twice with each result. This causes a Nextflow process name collision and means both code paths always run regardless of which parameters the user actually provided. This commit restructures the subworkflow to branch on whether the user supplied a local FASTA (contam_fasta) or a remote pre-built index URL (contam_link), running only the appropriate path.
1 parent eaedd00 commit f01798d

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

modules/deacon.nf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ process RUN_DEACON {
6060
script:
6161
def dbName = file(contam_index).getSimpleName()
6262
"""
63-
zcat ${reads} \
64-
| deacon filter ${contam_index} --log ${dbName}.log.json \
65-
| pigz > ${barcode}.decontam.fastq.gz
63+
deacon filter ${contam_index} ${reads} \
64+
--output ${barcode}.decontam.fastq.gz \
65+
--summary ${dbName}.summary.json \
66+
--threads ${task.cpus}
6667
"""
6768

6869
}

subworkflows/decontaminate.nf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ workflow DECONTAMINATE {
66
ch_contam_fasta
77

88
main:
9+
def has_local_fasta = params.contam_fasta && file(params.contam_fasta).isFile()
910

10-
INDEX_CONTAMINANTS(ch_contam_fasta)
11+
ch_built_index = has_local_fasta
12+
? INDEX_CONTAMINANTS(ch_contam_fasta)
13+
: Channel.empty()
1114

12-
RUN_DEACON(ch_fastqs.combine(INDEX_CONTAMINANTS.out))
15+
ch_fetched_index = (!has_local_fasta && params.contam_link)
16+
? GET_INDEX()
17+
: Channel.empty()
1318

14-
GET_INDEX()
19+
ch_index = ch_built_index.mix(ch_fetched_index)
1520

16-
RUN_DEACON(ch_fastqs.combine(GET_INDEX.out))
21+
ch_decontaminated = RUN_DEACON(ch_fastqs.combine(ch_index))
1722

1823
emit:
19-
RUN_DEACON.out
24+
ch_decontaminated
2025
}

subworkflows/quality_control.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ workflow QUALITY_CONTROL {
1414
ch_contam_fasta
1515

1616
main:
17-
if ( params.contam_fasta && file(params.contam_fasta).isFile() ) {
17+
if ( (params.contam_fasta && file(params.contam_fasta).isFile()) || params.contam_link ) {
1818
DECONTAMINATE(
1919
ch_reads,
2020
ch_contam_fasta

0 commit comments

Comments
 (0)