diff --git a/CHANGELOG.md b/CHANGELOG.md index fccf685..ee0bb12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - More informative log when a BAM called with an invalid basecaller model is provided. - Failures of processes involved in differentially modified loci and regions detection will not cause workflow to fail. - Updated `modkit` to v0.3.3. -- Reconciled workflow `_ingress.nf` from wf-human-variation v2.4.0 and wf-template v5.2.5. +- Reconciled workflow `_ingress.nf` from wf-human-variation v2.4.0 and wf-template v5.2.6. ### Fixed - `-resume` failing for some `snv` processes. diff --git a/nextflow.config b/nextflow.config index c7b8d13..8c176fd 100644 --- a/nextflow.config +++ b/nextflow.config @@ -131,7 +131,7 @@ params { container_snv_to_sha = "sha0bed006dfad374401e9410b44d67e6609f7936e9" container_sv_sha = "shac215e0f39f6c28148ce90b9ced11a4efda08c8c4" container_mod_sha = "shaa7bf2b62946eeb7646b9b9d60b892edfc3b3a52c" - common_sha = "shae58638742cf84dbeeec683ba24bcdee67f64b986" + common_sha = "shad28e55140f75a68f59bbecc74e880aeab16ab158" snpeff_tag = "sha313729d816872d70b410752001a0e2654eb88807" dss_sha = "sha927196d7e068cc49d5a41bcc3db91b9bdf723e7a" agent = null diff --git a/workflows/wf-somatic-snv.nf b/workflows/wf-somatic-snv.nf index ba15c3e..d16b65a 100644 --- a/workflows/wf-somatic-snv.nf +++ b/workflows/wf-somatic-snv.nf @@ -55,6 +55,16 @@ workflow snv { clairs_model clair3_model main: + // Create a new bam channel with a copy of meta + // This way, if the metadata for the input channels are changed by + // other components, this should not be impacted. + input_bam_ch = bam_channel + | map { + xam, xai, meta -> + def new_meta = meta.clone() + [xam, xai, new_meta] + } + // Log the chosen models clair3_model.subscribe{ log.info " - Clair3 model: ${it}" } clairs_model.subscribe{ log.info " - ClairS model: ${it}" } @@ -75,7 +85,7 @@ workflow snv { }.collect() // Use collect to create a value channel // Branch tumor and normal for downstream works - forked_channel = bam_channel + forked_channel = input_bam_ch | branch{ tumor: it[2].type == 'tumor' normal: it[2].type == 'normal' @@ -93,20 +103,20 @@ workflow snv { wf_build_regions( paired_samples, ref.collect(), clairs_model, bed, typing_ch ) // Define default and placeholder channels for downstream processes. - bam_for_germline = params.germline ? bam_channel : Channel.empty() + bam_for_germline = params.germline ? input_bam_ch : Channel.empty() paired_vcfs = Channel.empty() - aggregated_vcfs = bam_channel.map { bam, bai, meta -> [meta, file("$projectDir/data/OPTIONAL_FILE"), file("$projectDir/data/OPTIONAL_FILE")] } + aggregated_vcfs = input_bam_ch.map { bam, bai, meta -> [meta, file("$projectDir/data/OPTIONAL_FILE"), file("$projectDir/data/OPTIONAL_FILE")] } forked_vcfs = Channel.empty() // If a normal vcf is provided, skip clair3 calling for the normal sample. if (params.normal_vcf){ // Use the metadata from the bam channel // Use the vcf for the normal channel. - normal_vcf = bam_channel + normal_vcf = input_bam_ch .filter{bam, bai, meta -> meta.type == 'normal'} .map{ bam, bai, meta -> [meta, file("${params.normal_vcf}"), file("${params.normal_vcf}.tbi")] } // Prepare the channel for Clair3 to contain only normal samples. - bam_for_germline = bam_channel + bam_for_germline = input_bam_ch .filter{bam, bai, meta -> meta.type != 'normal'} } @@ -324,7 +334,7 @@ workflow snv { // If skip phasing, set channel for downstream compatibility. if (!params.germline){ paired_vcfs = Channel.empty() - aggregated_vcfs = bam_channel.map { bam, bai, meta -> [meta, file("$projectDir/data/OPTIONAL_FILE"), file("$projectDir/data/OPTIONAL_FILE")] } + aggregated_vcfs = input_bam_ch.map { bam, bai, meta -> [meta, file("$projectDir/data/OPTIONAL_FILE"), file("$projectDir/data/OPTIONAL_FILE")] } } else{ aggregated_vcfs = aggregate_all_variants.out.final_vcf } @@ -522,7 +532,7 @@ workflow snv { // Create tagged reads channel for downstream analyses. // Set contigs to all to avoid issues of duplicated file names. - tagged = bam_channel + tagged = input_bam_ch | map{bam, bai, meta -> [meta.sample, 'all', bam, bai, meta]} } @@ -557,7 +567,7 @@ workflow snv { xam_for_hap_filter = tagged | map{ samp, ctg, xam, xai, meta -> [meta, ctg, xam, xai] } } else { - xam_for_hap_filter = bam_channel + xam_for_hap_filter = input_bam_ch | map{xam, xai, meta -> [meta, xam, xai]} | combine(clairs_contigs, by:0) | map{meta, xam, xai, ctg -> [meta, ctg, xam, xai]}