This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is it normal a substantial reduction of BAM files after ordering ?

I am getting BAM files with Bismark mapping with bowtie2. This gives you an unordered BAM file Thus, I am sorting the BAM file with the command

samtools sort -O bam -T tmp_ -o Name_sorted.bam Unordered.bam

The unordered bam file can have a 2,6Gb size, but the ordered one drops down to 1,2Gb. The same happens with all the bam files I am ordering. They are reduced to a half.

Is that normal? Is that caused by a different compression level ?

In any case, makes me feel sort of uncomfortable..

bam samtools

Use samtools flagstat to check the number of reads. If they are the same, you're fine and it is due to compression. How did you create the unsorted bam file?

I mentioned that. I am mapping BS-Seq sequences with Bismark

Yes, it is normal. Sorting can save a lot of space.

2 answers

Sorting helps to give a better compression ratio. There's an old discussion about it here, or a tip of the day here

edit: I should also mention that you'll see a much better compression ratio with RNA seq than with DNA, as RNA seq should have a lot of repeated sequences.

You are right. They have the same number of reads

Log in to answer this question.