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 ) { 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