This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Picard vs Samtools converting CRAM to FASTQ

I need to convert my CRAM files to FASTQ to complete an analysis. I have been trying to do this via GATK and Picard, but I have repeatedly been getting an "out of memory" error even as I have increased allocated memory and processors.

gatk SamToFastq -I $FQ_FILE_PATH -F working/sample.1.fastq.gz -F2 working/sample.2.fastq.gz -R $REF_FILE
Picked up JAVA_TOOL_OPTIONS: -Xmx2g

Runtime.totalMemory()=109051904
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects

Given that this avenue is not working, would converting via samtools produce a comparable result, ie something that could still be relied on?

samtools picard

would converting via samtools produce a comparable result, ie something that could still be relied on?

CRAM format is maintained by group that develops samtools.

This is why I never use GATK unless I absolutely have to. Managing memory in Java is an absolute nightmare.

1 answer

As GenoMax says we (the samtools developers) maintain CRAM though the spec comes under the governance of the Global Alliance for Genomics and Health (GA4GH). So yes, the CRAM that we produce can still be relied on.

If you try something like this:

samtools fastq --threads 4 -1 sample.1.fastq.gz -2 sample.2.fastq.gz in_file.cram

It should work and should not use that much memory.

Log in to answer this question.