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

I got a cram file, and want to convert it to bam file. Here's the command I use and error I got

samtools view -b -T human_g1k_v37.fasta lucky.cram > lucky.bam
[sam_header_read2] 84 sequences loaded.
[sam_read1] reference 'Wm�;�����e��i���f�[�=���~��Ç߼���U��/���>���Q���O����n����O��' is recognized as '*'.
Parse error at line 1: invalid CIGAR character

I don't know what to do with this. Please help~

cram bam

Is cram-tools even still supported?

This suggests that there's a mismatch between the fasta file and what the CRAM file was created with. I'd double check that before proceeding.

1 answer

You are using a prehistoric version of samtools, one that predates the CRAM format by several years, so of course it has no support for CRAM files. (The error messages shown indicate that it is attempting to parse the input as a SAM file, and failing miserably.)

You need at least samtools 1.0 to read CRAM files, and many CRAM-related improvements were made in 1.2. Of course, what you really want to install is the most up-to-date version of samtools, which is 1.3.1 at the time of writing.

Log in to answer this question.