Question: Using samtools and Picard tools with cram files
0
gravatar for Chris Gene
3.6 years ago by
Chris Gene60
United Kingdom
Chris Gene60 wrote:

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

cram bam samtools • 2.2k views
ADD COMMENTlink modified 3.6 years ago • written 3.6 years ago by Chris Gene60

What version of samtools do you have?

ADD REPLYlink written 3.6 years ago by Devon Ryan92k

BTW, there's an --input-fmt-option that you can use.

ADD REPLYlink written 3.6 years ago by Devon Ryan92k

It's 0.1.18; doesn't work with that option. I'll update and try again. Thanks!

ADD REPLYlink written 3.6 years ago by Chris Gene60
1

0.1.18 was written before CRAM was invented...

ADD REPLYlink written 3.6 years ago by Devon Ryan92k

You should upgrade to the latest. That is a fairly old version of samtools.

ADD REPLYlink written 3.6 years ago by genomax73k
0
gravatar for Chris Gene
3.6 years ago by
Chris Gene60
United Kingdom
Chris Gene60 wrote:

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)

ADD COMMENTlink written 3.6 years ago by Chris Gene60
1

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.

ADD REPLYlink written 3.6 years ago by John Marshall1.8k

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.

ADD REPLYlink written 3.6 years ago by Devon Ryan92k
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: 1471 users visited in the last hour