@@ -16,7 +16,7 @@ include { CAT_FASTQ as CAT_FASTQ_MAPPED } from '../../modules/
16
16
workflow FILTER_BAM {
17
17
18
18
take :
19
- bam // [ [meta], [bam], [bai] ]
19
+ bam // [ [meta], [bam], [bai/csi ] ]
20
20
21
21
main :
22
22
ch_versions = Channel . empty()
@@ -37,9 +37,10 @@ workflow FILTER_BAM {
37
37
ch_versions = ch_versions. mix( FILTER_BAM_FRAGMENT_LENGTH . out. versions. first() )
38
38
39
39
SAMTOOLS_LENGTH_FILTER_INDEX ( FILTER_BAM_FRAGMENT_LENGTH . out. bam )
40
+ ch_length_filtered_index = params. fasta_largeref ? SAMTOOLS_LENGTH_FILTER_INDEX . out. csi : SAMTOOLS_LENGTH_FILTER_INDEX . out. bai
40
41
ch_versions = ch_versions. mix( SAMTOOLS_LENGTH_FILTER_INDEX . out. versions. first() )
41
42
42
- ch_bam_for_qualityfilter = FILTER_BAM_FRAGMENT_LENGTH . out. bam. join( SAMTOOLS_LENGTH_FILTER_INDEX . out . bai )
43
+ ch_bam_for_qualityfilter = FILTER_BAM_FRAGMENT_LENGTH . out. bam. join( ch_length_filtered_index )
43
44
44
45
} else {
45
46
ch_bam_for_qualityfilter = bam
@@ -52,9 +53,10 @@ workflow FILTER_BAM {
52
53
ch_versions = ch_versions. mix( SAMTOOLS_VIEW_BAM_FILTERING . out. versions. first() )
53
54
54
55
SAMTOOLS_FILTER_INDEX ( SAMTOOLS_VIEW_BAM_FILTERING . out. bam )
56
+ ch_filtered_bam_index = params. fasta_largeref ? SAMTOOLS_FILTER_INDEX . out. csi : SAMTOOLS_FILTER_INDEX . out. bai
55
57
ch_versions = ch_versions. mix( SAMTOOLS_FILTER_INDEX . out. versions. first() )
56
58
57
- ch_bam_for_genomics = SAMTOOLS_VIEW_BAM_FILTERING . out. bam. join( SAMTOOLS_FILTER_INDEX . out . bai )
59
+ ch_bam_for_genomics = SAMTOOLS_VIEW_BAM_FILTERING . out. bam. join( ch_filtered_bam_index )
58
60
59
61
// Only run if we actually remove mapped reads
60
62
if ( params. bamfiltering_mappingquality != 0 || params. bamfiltering_minreadlength != 0 ) {
0 commit comments