This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools fastq compression

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

2 answers

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?

file Sample_R1.fastq.gz
Sample_R1.fastq.gz: gzip compressed data, from Unix, max speed

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

Log in to answer this question.