Question: samtools fastq compression
0
gravatar for bsmith030465
5 months ago by
bsmith030465140
United States
bsmith030465140 wrote:

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!

cram fastq samtools • 409 views
ADD COMMENTlink written 5 months ago by bsmith030465140
1

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 REPLYlink modified 5 months ago • written 5 months ago by genomax64k
file Sample_R1.fastq.gz
Sample_R1.fastq.gz: gzip compressed data, from Unix, max speed
ADD REPLYlink modified 5 months ago • written 5 months ago by bsmith030465140
1

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 REPLYlink modified 5 months ago • written 5 months ago by Nitin Narwade380
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2336 users visited in the last hour