samtools fastq compression
2
0
Entering edit mode
6.1 years ago
bsmith030465 ▴ 240

I was trying to convert a cram file to two paired end fastq.gz files using the samtools command:

samtools fastq -c -@2 -1 Sample_R1.fastq.gz -2 Sample_R2.fastq.gz Sample.cram

I'm not sure if I am giving the right command for compression, since the .gz file is huge. Does this command look ok?

thanks!

samtools fastq cram • 6.9k views
ADD COMMENT
1
Entering edit mode
6.1 years ago
GenoMax 147k

The command looks fine. Since you used -c without a number samtools may be using the lowest level of compression by default. What does file Sample_R1.fastq.gz say?

ADD COMMENT
0
Entering edit mode
file Sample_R1.fastq.gz
Sample_R1.fastq.gz: gzip compressed data, from Unix, max speed
ADD REPLY
1
Entering edit mode
6.1 years ago
Nitin Narwade ★ 1.6k

genomax is right, you have to use the right number as compression level to samtools fastq using -c option In samtools fastq -c option accepts compression level starting from 0 to 9. Here 0 means fastest but poor compression whereas 9 indicates slowest but best compression.

So you just need to provide the right number for compression level.

As discussed here, you can use -c 6 (gzip default compression level is 6).

So command will be,

samtools fastq -c 6 -@2 -1 Sample_R1.fastq.gz -2 Sample_R2.fastq.gz Sample.cram
ADD COMMENT

Login before adding your answer.

Traffic: 2044 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