This is a test version of Biostars. For the public version, visit https://www.biostars.org.
cramtools without internet access

Hi -

I have a large number of bam files that I would like to compress to cram. The bam files are on our computer cluster, and I would like to run cramtools as a job on the cluster. However, the compute nodes of the cluster do not have access to the Internet, which I believe is causing the error below. So I have some questions about cramtools?

Does anyone know a work-around for running cramtools without Internet access? Why does cramtools need to access the Internet? (I am providing the reference fasta file) Is there a manual cramtools?

Thanks,
Joe

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at net.sf.cram.CramTools.invoke(CramTools.java:93)
        at net.sf.cram.CramTools.main(CramTools.java:123)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection timed out
        at net.sf.cram.ref.ReferenceSource.findBases(ReferenceSource.java:183)
        at net.sf.cram.ref.ReferenceSource.getReferenceBases(ReferenceSource.java:127)
        at net.sf.cram.Bam2Cram.main(Bam2Cram.java:282)
        ... 6 more
Caused by: java.net.ConnectException: Connection timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:365)
        at java.net.Socket.connect(Socket.java:527)
        at java.net.Socket.connect(Socket.java:476)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:424)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:538)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:214)
        at sun.net.www.http.HttpClient.New(HttpClient.java:300)
        at sun.net.www.http.HttpClient.New(HttpClient.java:319)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
        at java.net.URL.openStream(URL.java:1010)
        at net.sf.cram.ref.ReferenceSource.loadFromPath(ReferenceSource.java:249)
        at net.sf.cram.ref.ReferenceSource.findBasesByMD5(ReferenceSource.java:283)
        at net.sf.cram.ref.ReferenceSource.findBases(ReferenceSource.java:179)
        ... 8 more
bam cram cramtools

What's the command line? Did you try to use a file:// scheme?

I think my command line is standard, and all the files are accessible in the environment:

java -jar ~/cramtools/cramtools-2.1.jar cram --input-bam-file G26249.KMS-26.2.bam --reference-fasta-file hg19_Broad_variant_NCBI.fasta --output-cram-file G26249.KMS-26.2.cram

Have you considered just using samtools to convert them to CRAM?

Yes, that worked. Thanks very much. I was not aware samtools had cram as an output option.

1 answer

For an unknown reason: cramtools thinks that a file is a URL https://github.com/enasequence/cramtools/blob/master/src/main/java/net/sf/cram/ref/ReferenceSource.java#L246 and tries to download from the web: https://github.com/enasequence/cramtools/blob/master/src/main/java/net/sf/cram/ref/ReferenceSource.java#L249

Are you sure the sequence dictionaries are the same? Are all the sequences in the BAM header have the same name/length/MD5 than in the sequence hg19_Broad_variant_NCBI.fasta? Please, check this.

I can certainly check this. Thanks very much for your thoughts.

Log in to answer this question.