I'd suggest using the latest version (2.2.1, I think) of picard as well. Picard's ability to handle CRAM files still seems to be a bit of a work in progress.
I have a series of cram files that I want to merge without converting to bam. When I try samtools merge out.cram in1.cram in2.cram in3.cram
I get the following error: [bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file). [bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file). /tmp/1460051111.1957878: line 8: 18355 Segmentation fault
Is there any specification I can add to the merge command to make it work? None of the options seem to do the trick.
Also, can I then pass the cram file to Picard tools BamToFastq?
Thanks
1 answer
Worked fine with the update, thanks. And picard's BamToFastq? I'm using v. 1.99, that already supports cram files, but still get parsing error:
Exception in thread "main" net.sf.samtools.SAMFormatException: Error parsing text SAM file. Not enough fields; Line 1 Line: CRAM^C^@ (...) at net.sf.samtools.SAMLineParser.reportFatalErrorParsingLine(SAMLineParser.java:420) at net.sf.samtools.SAMLineParser.parseLine(SAMLineParser.java:210) at net.sf.samtools.SAMTextReader$RecordIterator.parseLine(SAMTextReader.java:237) at net.sf.samtools.SAMTextReader$RecordIterator.next(SAMTextReader.java:225) at net.sf.samtools.SAMTextReader$RecordIterator.next(SAMTextReader.java:201) at net.sf.samtools.SAMFileReader$AssertableIterator.next(SAMFileReader.java:687) at net.sf.samtools.SAMFileReader$AssertableIterator.next(SAMFileReader.java:665) at net.sf.picard.sam.SamToFastq.doWork(SamToFastq.java:132) at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:177) at net.sf.picard.sam.SamToFastq.main(SamToFastq.java:121)
Picard v1.99 is from September 2013, which also pretty much predates the CRAM format and certainly is well before any Picard support for CRAM (which according to ENA was introduced in 1.133, but I too would recommend staying very up-to-date if you want to do anything with CRAM in HTSJDK or Picard).
You might consider samtools fastq for this job.
Log in to answer this question.
What version of samtools do you have?
BTW, there's an
--input-fmt-optionthat you can use.It's 0.1.18; doesn't work with that option. I'll update and try again. Thanks!
You should upgrade to the latest. That is a fairly old version of samtools.
0.1.18 was written before CRAM was invented...