Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
[
{
"id": "test",
"single_end": true
"single_end": true,
"index_id": "genome"
},
"test.idx:md5,84e4985c91800686db9c9dca28fabd1a"
"genome.idx:md5,84e4985c91800686db9c9dca28fabd1a"
]
],
"test.json"
],
"timestamp": "2026-02-16T13:18:48.758651665",
"meta": {
"nf-test": "0.9.3",
"nf-test": "0.9.4",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:28:11.112943934"
}
},
"sarscov2 - fastq - single-end - hostile": {
"content": [
Expand Down Expand Up @@ -53,11 +54,11 @@
],
"test_single.json"
],
"timestamp": "2026-02-13T09:27:36.178537005",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:27:36.178537005"
}
},
"sarscov2 - fastq - paired-end - deacon": {
"content": [
Expand All @@ -77,18 +78,19 @@
[
{
"id": "test",
"single_end": false
"single_end": false,
"index_id": "genome"
},
"test.idx:md5,84e4985c91800686db9c9dca28fabd1a"
"genome.idx:md5,84e4985c91800686db9c9dca28fabd1a"
]
],
"test.json"
],
"timestamp": "2026-02-16T13:18:57.869797967",
"meta": {
"nf-test": "0.9.3",
"nf-test": "0.9.4",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:28:24.987001016"
}
},
"sarscov2 - fastq - paired-end - hostile": {
"content": [
Expand Down Expand Up @@ -119,11 +121,11 @@
],
"test_paired.json"
],
"timestamp": "2026-02-13T09:27:57.460392559",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:27:57.460392559"
}
},
"sarscov2 - fastq - single-end - deacon - stub": {
"content": [
Expand All @@ -147,7 +149,8 @@
[
{
"id": "test",
"single_end": true
"single_end": true,
"index_id": "genome"
},
"genome.idx:md5,d41d8cd98f00b204e9800998ecf8427e"
]
Expand All @@ -174,7 +177,8 @@
[
{
"id": "test",
"single_end": true
"single_end": true,
"index_id": "genome"
},
"genome.idx:md5,d41d8cd98f00b204e9800998ecf8427e"
]
Expand All @@ -196,10 +200,10 @@
]
}
],
"timestamp": "2026-02-16T13:19:06.320189196",
"meta": {
"nf-test": "0.9.3",
"nf-test": "0.9.4",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:28:38.421681888"
}
}
}
41 changes: 34 additions & 7 deletions subworkflows/nf-core/fastq_index_filter_deacon/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,57 @@ workflow FASTQ_INDEX_FILTER_DEACON {

main:

ch_fasta = ch_fasta_reads
.map { meta, fasta, reads -> [ meta, fasta ] }
// Check if fastqs are single-end or paired-end and run Deacon accordingly
ch_reads = ch_fasta_reads
.map { meta, fasta, reads ->
if (meta.single_end) {
if (reads instanceof List && reads.size() != 1) {
error("Error: Check your meta.single_end value. Single-end reads should contain one file only.")
}
return [ meta, reads ]
return [ meta, fasta, reads ]
} else {
if (!(reads instanceof List) || reads.size() != 2) {
error("Error: Check your meta.single_end value. Paired-end reads should contain two files; a forward and a reverse.")
}
return [ meta, reads ]
return [ meta, fasta, reads ]
}
}

DEACON_INDEX ( ch_fasta )
// Extract unique reference fasta files and create fasta-specific metadata
// This ensures each unique reference is indexed only once
ch_unique_fastas = ch_reads
.map { _meta, fasta, _reads -> fasta }
.unique()
.map { fasta ->
def meta_fasta = [ id: fasta.baseName ]
[ meta_fasta, fasta ]
}

// Index unique FASTA files only
DEACON_INDEX ( ch_unique_fastas )

// Match indexes back to original samples
ch_indexes = DEACON_INDEX.out.index
.map { meta_fasta, index -> [ meta_fasta.id, index ] }
ch_reads_with_index = ch_reads
.map { meta, fasta, reads ->
[ fasta.baseName, meta, reads ]
}
.combine(ch_indexes, by: 0)
.map { _fasta_id, meta, reads, index ->
[ meta, index, reads ]
}

// Filter reads using the matched index
DEACON_FILTER(ch_reads_with_index)

// Create output channel with indexes, the original sample-level metadata and index id
ch_index_with_meta = ch_reads_with_index
.map { meta, index, _reads -> [ meta + [ index_id: index.baseName ], index ] }

DEACON_FILTER(DEACON_INDEX.out.index.join(ch_reads))

emit:
index = DEACON_INDEX.out.index // channel: [ val(meta), [ index ] ]
index = ch_index_with_meta // channel: [ val(meta), [ index ] ]
fastq_filtered = DEACON_FILTER.out.fastq_filtered // channel: [ val(meta), [ fastq ] ]
summary = DEACON_FILTER.out.log // channel: [ val(meta), [ log ] ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
[
{
"id": "test",
"single_end": true
"single_end": true,
"index_id": "genome"
},
"genome.idx:md5,d41d8cd98f00b204e9800998ecf8427e"
]
Expand Down Expand Up @@ -42,7 +43,8 @@
[
{
"id": "test",
"single_end": true
"single_end": true,
"index_id": "genome"
},
"genome.idx:md5,d41d8cd98f00b204e9800998ecf8427e"
]
Expand All @@ -58,21 +60,22 @@
]
}
],
"timestamp": "2026-02-13T15:10:09.178241099",
"meta": {
"nf-test": "0.9.3",
"nf-test": "0.9.4",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:19:12.052209052"
}
},
"sarscov2 - fastq - paired-end": {
"content": [
[
[
{
"id": "test",
"single_end": false
"single_end": false,
"index_id": "genome"
},
"test.idx:md5,84e4985c91800686db9c9dca28fabd1a"
"genome.idx:md5,84e4985c91800686db9c9dca28fabd1a"
]
],
[
Expand All @@ -89,21 +92,22 @@
],
"test.json"
],
"timestamp": "2026-02-13T15:09:59.820753976",
"meta": {
"nf-test": "0.9.3",
"nf-test": "0.9.4",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:19:03.559444963"
}
},
"sarscov2 - fastq - single-end": {
"content": [
[
[
{
"id": "test",
"single_end": true
"single_end": true,
"index_id": "genome"
},
"test.idx:md5,84e4985c91800686db9c9dca28fabd1a"
"genome.idx:md5,84e4985c91800686db9c9dca28fabd1a"
]
],
[
Expand All @@ -117,10 +121,10 @@
],
"test.json"
],
"timestamp": "2026-02-13T15:09:50.38883241",
"meta": {
"nf-test": "0.9.3",
"nf-test": "0.9.4",
"nextflow": "25.10.2"
},
"timestamp": "2026-02-13T09:18:55.835377502"
}
}
}