Description
BAM_MARKDUPLICATES mixes the bam and cram output channels from GATK4_MARKDUPLICATES together via .mix(), trusting that only one of the two is ever populated per sample. That assumption holds for real runs, but under -stub the module's stub block touches both bam and cram (plus their indices) unconditionally, so the mixed alignment channel emits twice per sample.
The duplication silently rides through baserecalibration/applybqsr and only surfaces downstream at the tumor-normal pairing join in workflows/sarek.nf (failOnDuplicate: true), throwing:
Detected join operation duplicate emission on right channel
Steps to reproduce
Run the pipeline with -stub on a tumor-normal test profile, e.g.:
nf-test test tests/default.nf.test --tag cpu_conda_stub --profile test,docker
Expected behaviour
GATK4_MARKDUPLICATES, GATK4_BASERECALIBRATOR, GATK4_APPLYBQSR, and INDEX_CRAM should each run once per sample under -stub, with no duplicate-emission error at the tumor-normal join.
Fix
Select the bam or cram branch explicitly by params.save_output_as_bam, instead of .mix()-ing both — same pattern already used in bam_sentieon_dedup.
Description
BAM_MARKDUPLICATESmixes thebamandcramoutput channels fromGATK4_MARKDUPLICATEStogether via.mix(), trusting that only one of the two is ever populated per sample. That assumption holds for real runs, but under-stubthe module's stub block touches bothbamandcram(plus their indices) unconditionally, so the mixedalignmentchannel emits twice per sample.The duplication silently rides through baserecalibration/applybqsr and only surfaces downstream at the tumor-normal pairing join in
workflows/sarek.nf(failOnDuplicate: true), throwing:Steps to reproduce
Run the pipeline with
-stubon a tumor-normal test profile, e.g.:Expected behaviour
GATK4_MARKDUPLICATES,GATK4_BASERECALIBRATOR,GATK4_APPLYBQSR, andINDEX_CRAMshould each run once per sample under-stub, with no duplicate-emission error at the tumor-normal join.Fix
Select the
bamorcrambranch explicitly byparams.save_output_as_bam, instead of.mix()-ing both — same pattern already used inbam_sentieon_dedup.