This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert .sam to .bam without producing writing .sam file to storage space

How do I convert .sam to .bam without producing writing .sam file to storage space?

alignment

without producing writing .sam file to storage space?

what does that mean ?

1 answer

I think he means if there is a way of piping it to generate a bam file directly without going through a sam file intermidiate. Something like this would be my guess:

bowtie2 -x Index -1 Reads1.fq -2 Reads2.fq | samtools view -b -h -o output.bam

With the recent samtools versions you can even shorten it to (...) | samtools view -o output.bam. It autodetects the format on the suffix, and the header is always written if writing bam.

Log in to answer this question.