How Is -U Flag(Compressed) Different From -B Flag In Samtools?
1
2
Entering edit mode
7.8 years ago
lwc628 ▴ 220

My confusion arose because both b and u flag seem to do the same task, except one outputs the compressed and the other uncompressed bam.

It says samtools view -u outputs bam file in uncompressed. Is this just for performance, or if I fail to give this flag, would this cause any problem?

For example, what is the difference between other than the computing time?

samtools view -bS some.sam | samtools sort - some_sort
samtools view -uS some.sam | samtools sort - some_sort

Most importantly, If u flag just for performance, why is it not default? what is the purpose having b flag?

samtools • 2.8k views
ADD COMMENT
7
Entering edit mode
7.8 years ago
lomereiter ▴ 470

b flag is when you need to store file on disk, -u is for piping purposes. If you have plenty of disk space and the disk is fast, there's indeed no reason to store BAMs compressed (unless you run a FTP server which provides access to these files). But usually disk performance is not that great, and it's faster to read compressed file and unpack it on the fly, than to read uncompressed file. Plus, as I mentioned, if BAMs are to be accessible via HTTP/FTP, traffic becomes another reason.

ADD COMMENT

Login before adding your answer.

Traffic: 2506 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6