From a2fff876585bb972a19303ce7f0a107fe9edd8b4 Mon Sep 17 00:00:00 2001 From: Thiseas Christos Lamnidis Date: Thu, 25 Jul 2024 14:08:57 +0200 Subject: [PATCH 1/4] support csi indexes --- conf/modules.config | 2 +- subworkflows/local/bamfiltering.nf | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index b03153561..37c5d666b 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -578,8 +578,8 @@ process { } withName: ".*BAM_SPLIT_BY_REGION:SAMTOOLS_INDEX" { + // The BAM_SPLIT_BY_REGION SWF only works with bais, so `params.fasta_largeref` should not be passed to it. tag = { "${meta.reference}:${meta.genomic_region}|${meta.sample_id}_${meta.library_id}" } - ext.args = { params.fasta_largeref ? "-c" : "" } ext.prefix = { "${meta.sample_id}_${meta.library_id}_${meta.reference}_${meta.genomic_region}_dedupped" } publishDir = [ enabled: false diff --git a/subworkflows/local/bamfiltering.nf b/subworkflows/local/bamfiltering.nf index 28979e1c6..440782678 100644 --- a/subworkflows/local/bamfiltering.nf +++ b/subworkflows/local/bamfiltering.nf @@ -16,7 +16,7 @@ include { CAT_FASTQ as CAT_FASTQ_MAPPED } from '../../modules/ workflow FILTER_BAM { take: - bam // [ [meta], [bam], [bai] ] + bam // [ [meta], [bam], [bai/csi] ] main: ch_versions = Channel.empty() @@ -37,9 +37,10 @@ workflow FILTER_BAM { ch_versions = ch_versions.mix( FILTER_BAM_FRAGMENT_LENGTH.out.versions.first() ) SAMTOOLS_LENGTH_FILTER_INDEX ( FILTER_BAM_FRAGMENT_LENGTH.out.bam ) + ch_length_filtered_index = params.fasta_largeref ? SAMTOOLS_LENGTH_FILTER_INDEX.out.csi : SAMTOOLS_LENGTH_FILTER_INDEX.out.bai ch_versions = ch_versions.mix( SAMTOOLS_LENGTH_FILTER_INDEX.out.versions.first() ) - ch_bam_for_qualityfilter = FILTER_BAM_FRAGMENT_LENGTH.out.bam.join( SAMTOOLS_LENGTH_FILTER_INDEX.out.bai ) + ch_bam_for_qualityfilter = FILTER_BAM_FRAGMENT_LENGTH.out.bam.join( ch_length_filtered_index ) } else { ch_bam_for_qualityfilter = bam @@ -52,9 +53,10 @@ workflow FILTER_BAM { ch_versions = ch_versions.mix( SAMTOOLS_VIEW_BAM_FILTERING.out.versions.first() ) SAMTOOLS_FILTER_INDEX ( SAMTOOLS_VIEW_BAM_FILTERING.out.bam ) + ch_filtered_bam_index = params.fasta_largeref ? SAMTOOLS_FILTER_INDEX.out.csi : SAMTOOLS_FILTER_INDEX.out.bai ch_versions = ch_versions.mix( SAMTOOLS_FILTER_INDEX.out.versions.first() ) - ch_bam_for_genomics = SAMTOOLS_VIEW_BAM_FILTERING.out.bam.join( SAMTOOLS_FILTER_INDEX.out.bai ) + ch_bam_for_genomics = SAMTOOLS_VIEW_BAM_FILTERING.out.bam.join( ch_filtered_bam_index ) // Only run if we actually remove mapped reads if ( params.bamfiltering_mappingquality != 0 || params.bamfiltering_minreadlength != 0 ) { From e2db18fd18daaa3b8bdae51c112f4660f9af6c54 Mon Sep 17 00:00:00 2001 From: Thiseas Christos Lamnidis Date: Thu, 25 Jul 2024 14:15:09 +0200 Subject: [PATCH 2/4] dummy commit to restart github actions --- conf/modules.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/modules.config b/conf/modules.config index 37c5d666b..59fbed838 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -586,7 +586,7 @@ process { ] } - withName: SAMTOOLS_SORT_DEDUPPED { + withName:SAMTOOLS_SORT_DEDUPPED { tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}" } ext.prefix = { "${meta.sample_id}_${meta.library_id}_${meta.reference}_dedupped" } publishDir = [ From 2fe53bd3db86e78e8ced2ca58ab18325ff46c5e0 Mon Sep 17 00:00:00 2001 From: Thiseas Christos Lamnidis Date: Thu, 25 Jul 2024 14:15:24 +0200 Subject: [PATCH 3/4] Revert "dummy commit to restart github actions" This reverts commit e2db18fd18daaa3b8bdae51c112f4660f9af6c54. --- conf/modules.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/modules.config b/conf/modules.config index 59fbed838..37c5d666b 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -586,7 +586,7 @@ process { ] } - withName:SAMTOOLS_SORT_DEDUPPED { + withName: SAMTOOLS_SORT_DEDUPPED { tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}" } ext.prefix = { "${meta.sample_id}_${meta.library_id}_${meta.reference}_dedupped" } publishDir = [ From 7765f161a9195ab2ede30b1c44c8f9d68d7e04dc Mon Sep 17 00:00:00 2001 From: Thiseas Christos Lamnidis Date: Thu, 25 Jul 2024 14:17:46 +0200 Subject: [PATCH 4/4] pick up csi indices for SAMTOOLS_FLAGSTATS_BAM_INPUT --- workflows/eager.nf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/workflows/eager.nf b/workflows/eager.nf index c8964cec8..fee976267 100644 --- a/workflows/eager.nf +++ b/workflows/eager.nf @@ -207,10 +207,7 @@ workflow EAGER { // // MODULE: flagstats of user supplied input BAMs // - ch_bam_bai_input = ch_samplesheet_bams - .join(SAMTOOLS_INDEX_BAM_INPUT.out.bai) - - SAMTOOLS_FLAGSTATS_BAM_INPUT ( ch_bam_bai_input ) + SAMTOOLS_FLAGSTATS_BAM_INPUT ( ch_bams_from_input ) ch_versions = ch_versions.mix( SAMTOOLS_FLAGSTATS_BAM_INPUT.out.versions ) ch_flagstat_input_bam = SAMTOOLS_FLAGSTATS_BAM_INPUT.out.flagstat // For endorspy