samtools view module output format and output file issues

output:
tuple val(meta), path(*.bam), emit: bam
path *.version.txt , emit: version
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? ${meta.id}${options.suffix} : ${meta.id}
“””
samtools view $options.args $bam > ${prefix}.bam

There could be two issues with the current code in the samtools view module:

  1. samtools view $args input.bam > output.bam actually generates ‘sam’ format instead of bam file although file extension is bam;
  2. The input and out file could both has extension ‘.bam’. So, the output directive may contain two bam files, which might be intended.

Read more here: Source link