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

Hi, I have paired end Illumina raw data stored as cram files and would like to get fastq files.
I tried
samtools fastq --reference {input.cram_ref} -1 {output.f1} -2 {output.f2} {input.cram}
but I get an error when I try to map the files with BWA:
[mem_sam_pe] paired reads have different names:

I think I need to sort the cram before converting to fastq, but not sure how to do this.

Thanks.

cram fastq

2 answers

form the samtools manual:

The input to this program must be collated by name. Run 'samtools collate' or 'samtools sort -n' to achieve this.

Yes, either sort or collate (collate=group by name). Sort takes longer, so I would simply use samtools collate and feed the output into samtools fastq.

Log in to answer this question.