small CRAM file to test
0
0
Entering edit mode
8.0 years ago
lien ▴ 90

Hi all,

I received an external hard drive with a lot of CRAM-files. I haven't worked with these files before and would like to convert them to BAM. I only received the cram-files together with the reference fasta that was used to align the reads. I would like to convert it back to BAM to run our pipeline for variant calling on these files. At first, I tried SAMtools-1.3 but this gave me errors.

lien@lien:~/samtools-1.3$ samtools view -c -T GRCh38.fna -o /16710_1.bam 16710_1.cram 
[sam_header_read2] 195 sequences loaded. 
[sam_read1] reference 'SO:coordinate' is recognized as '*'. 
Parse error at line 1: invalid CIGAR character Aborted (core dumped)

Next, I've installed CRAMtools-3.0. When I try running it on my files, I still get similar errors.

lien@lien:~/cramtools-3.0$ java -jar cramtools-3.0.jar bam -I /16710_1.cram -R GRCh38.fna -O 16710_1.bam
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.sf.cram.CramTools.invoke(CramTools.java:91)
    at net.sf.cram.CramTools.main(CramTools.java:121)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/CountingOutputStream
    at htsjdk.samtools.cram.build.CramIO.readSAMFileHeader(CramIO.java:254)
    at htsjdk.samtools.cram.build.CramIO.readCramHeader(CramIO.java:191)
    at net.sf.cram.common.Utils.openCramInputStream(Utils.java:848)
    at net.sf.cram.Cram2Bam.main(Cram2Bam.java:107)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 10 more

I was wondering whether it has something to do with the CRAMtools program itself, or with the CRAM-files I received. Thus, I'm looking for a small CRAM-file that I can download and use to test the CRAMtools software. On the website of CRAMtools, they refer to a CRAM-file to download (http://www.ebi.ac.uk/ena/support/cram-tutorial). But the connection to the FTP doesn't work.

Do you have other suggestions for small CRAM files available for download that I can use to get familiar with this file type?

cram cramtools • 4.3k views
ADD COMMENT
0
Entering edit mode

What are you trying to get from the CRAM files? Original fastq? Was this how your data was delivered?
Would be useful to include the samtools command you tried.

ADD REPLY
0
Entering edit mode

Try this link for the test cram file from EBI.

ADD REPLY
0
Entering edit mode

I tried this already, but the connection keeps timing out. This is the reason why I was wondering if there were similar files.

lien@lien:~/samtools-1.3$ wget ftp://ftp.era.ebi.ac.uk/vol1/ERA209/ERA209803/cram/9233_8%23168_1.cram
--2016-04-20 16:52:16--  ftp://ftp.era.ebi.ac.uk/vol1/ERA209/ERA209803/cram/9233_8%23168_1.cram
           => ‘9233_8#168_1.cram’
Resolving ftp.era.ebi.ac.uk ftp.era.ebi.ac.uk)... 193.62.192.7
Connecting to ftp.era.ebi.ac.uk ftp.era.ebi.ac.uk)|193.62.192.7|:21... failed: Connection timed out.
ADD REPLY
1
Entering edit mode

That sounds like an issue with your local firewall rules/proxy. I was able to get the file without problems (~83 M in size).

ADD REPLY
0
Entering edit mode

For converting to BAM you should not need the reference. Can you try?

 $ samtools view -b -o out.bam your_file.cram
ADD REPLY
0
Entering edit mode

If I try this, I still get the following error:

lien@lien:~/samtools-1.3$ samtools view -b -o 16710_1.bam 16710_1.cram 
[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).
[main_samview] fail to read the header from "16710_1.cram".
ADD REPLY
0
Entering edit mode

I see that you are using the latest samtools. Can you ask the provider if they used an older version of samtools to make these files? You may need to use that specific version.
Since both samtools and cramtools appear to be having problems with the files it is likely that the files themselves have some issue.

ADD REPLY

Login before adding your answer.

Traffic: 1805 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6