Hello,
I have a Nextflow subworkflow that performs Minimap2 Align → Bam_Sort_Stats_Samtools → Mosdepth. The input to this subwork flow is a Channel with the structure:
ch_sample // channel: [tuple val(meta), path(fastqs), path(scaffolds), path(fasta)]
.
Upon using ‘–resume’ when running my pipeline that calls the subwork flow. I get inconsistent errors with the Mosdepth step. Its about a 50% chance that it runs without errors but in cases where an error occurs, I can see that the inputted Bam and Bai file do not correspond to the same sample. I’m trying to figure out how this could be possible since only one samples information should be processed at a time within the subworkflow based on the singular channel input? Am I missing something?
Subworkflow:
workflow ALIGNMENT_PER_REF {
take:
ch_sample // channel: [tuple val(meta), path(fastqs), path(scaffolds), path(fasta)]
main:
ch_versions = Channel.empty()
//
// MODULE: Minimap2 for aligning to Hepatitis C
//
MINIMAP2_ALIGN (
ch_sample,
true,
'bai',
false,
false
)
ch_versions = MINIMAP2_ALIGN.out.versions
//
// BAM_SORT_STATS_SAMTOOLS: get stats from the alignment
//
BAM_SORT_STATS_SAMTOOLS(
MINIMAP2_ALIGN.out.bam,
)
ch_versions = BAM_SORT_STATS_SAMTOOLS.out.versions
//
// MOSDEPTH: Calculate genome wide sequencing coverage
//
MOSDEPTH(
BAM_SORT_STATS_SAMTOOLS.out.bam,
BAM_SORT_STATS_SAMTOOLS.out.bai,
ch_sample.map{
meta, fastqs, scaffolds, fasta -> [fasta]
},
[],
// BAM_SORT_STATS_SAMTOOLS.out.fasta
)
ch_versions = MOSDEPTH.out.versions
emit:
// TODO nf-core: edit emitted channels
global_txt = MOSDEPTH.out.global_txt
summary_txt = MOSDEPTH.out.summary_txt
regions_txt = MOSDEPTH.out.regions_txt
bam = BAM_SORT_STATS_SAMTOOLS.out.bam // channel: [ val(meta), [ bam ] ]
bai = BAM_SORT_STATS_SAMTOOLS.out.bai // channel: [ val(meta), [ bai ] ]
versions = ch_versions // channel: [ versions.yml ]
}