Skip to content

Commit ab46d29

Browse files
committed
Wire deacon host scrubbing into preprocessing workflow
Replaces STAT-based SCRUB_HOST_READS with deacon-based HOST_DEPLETION in preprocess_reads.nf. The scrub_host_reads param continues to gate the step; deacon is used when any deacon index config is available. The host_depletion subworkflow uses declarative channel ternaries and empty-channel gating rather than procedural if/else blocks. This ensures Nextflow constructs the same DAG structure regardless of which params are set, which matters for -resume cache consistency and makes the dataflow easier to reason about. Processes that aren't needed receive Channel.empty() inputs and simply don't execute, rather than being conditionally excluded from the DAG. Index union routing is determined at parse time from params via a def, avoiding runtime .branch/.size()/.map gymnastics that are fragile in Groovy's type system.
1 parent 4d6dcbd commit ab46d29

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/py_nvd/_fingerprint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"main.nf": "d3df999c77a6754811017c07fa446c551d8334e72822a6df1c5cdcacb4715ebb",
3-
"nextflow.config": "8d1bbbd14e66c6813a75fce1e3aca4307704fa1e4cd6552fb2d653dd60f78d51"
3+
"nextflow.config": "555a48aea54dc2f91d1db96206784e999981c5004464270a9260f62041cb48d9"
44
}

workflows/preprocess_reads.nf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include { DEDUP_WITH_CLUMPIFY ; TRIM_ADAPTERS ; FILTER_READS ; REPAIR_PAIRS } from "../modules/bbmap"
2-
include { SCRUB_HOST_READS } from "../modules/stat"
2+
include { HOST_DEPLETION } from "../subworkflows/host_depletion"
33

44
workflow PREPROCESS_READS {
55
take:
@@ -29,13 +29,12 @@ workflow PREPROCESS_READS {
2929

3030
ch_after_trim = ch_trimmed_illumina.mix(ch_branched_for_trim.other)
3131

32-
// 3. Host scrub (requires sra_human_db to be set)
33-
ch_human_db = params.sra_human_db
34-
? Channel.fromPath(params.sra_human_db)
35-
: Channel.empty()
32+
// 3. Host scrub with deacon
33+
// Requires at least one of: deacon_index, deacon_index_url, deacon_contaminants_fasta
34+
def has_deacon_config = params.deacon_index || params.deacon_index_url || params.deacon_contaminants_fasta
3635

37-
ch_after_scrub = (should_scrub && params.sra_human_db)
38-
? SCRUB_HOST_READS(ch_after_trim.combine(ch_human_db))
36+
ch_after_scrub = (should_scrub && has_deacon_config)
37+
? HOST_DEPLETION(ch_after_trim).reads
3938
: ch_after_trim
4039

4140
// 4. Quality/length filter (with platform-specific quality threshold)
@@ -51,6 +50,7 @@ workflow PREPROCESS_READS {
5150
: ch_after_scrub
5251

5352
// 5. Repair pairs (interleaved reads only) - fixes orphans from upstream steps
53+
// Note: This works because deacon preserves CASAVA FASTQ headers
5454
ch_branched_for_repair = ch_after_filter.branch { _id, _platform, read_structure, _reads ->
5555
interleaved: read_structure == "interleaved"
5656
other: true

0 commit comments

Comments
 (0)