Notice:
If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra


Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

define java to use in GATK4?

HoppmannHoppmann FreiburgMember

Hi,

today I tried to run GATK4. But I ran into an issue. Just calling "gatk" looks fine, but when running "gatk --list" produces the following output.

Running:
java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=1 -jar /dsk/data1/ngs/bin/GATK/4.0.0.0/gatk-package-4.0.0.0-local.jar --help
Error: Invalid or corrupt jarfile /dsk/data1/ngs/bin/GATK/4.0.0.0/gatk-package-4.0.0.0-local.jar

Since now I have the command how GATK actually is started I replaced "java" with "java8" and everything works well.

So my question is, if there is an option, or config or anything, where I can define the path to my java8? I can't just switch to java8 as my main java since I'm working on a cluster, and the admins don't want it.

Thanks in advance,

Anselm Hoppmann

Answers

  • micknudsenmicknudsen DenmarkMember ✭✭

    You could run everything in a conda evironment (via bioconda):

    conda create -n foo gatk4
    source activate foo
    

    That way you will not have to worry about dependencies.

  • HoppmannHoppmann FreiburgMember

    Hi,
    thanks for the answer. Isn't conda a python package manager to install python packaged? So does this work with java programs?

  • micknudsenmicknudsen DenmarkMember ✭✭

    Nope, conda is just a general package manager. You can use it for everything. Maybe you are confusing it with Anaconda which is a Python "distrubtion" using conda.

    I highly recommend bioconda, not just for GATK but for bioinformatics software in general.

  • HoppmannHoppmann FreiburgMember

    Thanks,

    I will try it out.

  • SheilaSheila Broad InstituteMember, Broadie, Moderator admin

    @Hoppmann
    Hi,

    @micknudsen Thanks for the suggestion :smile:

    You can also read more about Conda in the GATK4 readme.

    -Sheila

  • Hi,
    I also have same problem. My system is Linux, and java is "java version "1.8.0_45". I download the gatk-4.0.1.2.zip and unzip it, then I run ./gatk --list
    ./gatk --list
    Using GATK jar /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar
    Running:
    java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=1 -jar /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar --help
    Error: Invalid or corrupt jarfile /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar

    Please help me, how can I solve it?

  • SheilaSheila Broad InstituteMember, Broadie, Moderator admin

    @zhaoxvwahaha
    Hi,

    I have answered your question in two other threads. Please don't post multiple times.

    -Sheila

  • ahdaahda ChinaMember

    I just meet this problem,I tried conda install gatk4,
    The following NEW packages will be INSTALLED:

        gatk4:   4.1.1.0-0             https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
        openjdk: 8.0.192-h14c3975_1003 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    
    Proceed ([y]/n)? Y
    
    openjdk-8.0.19 100% |##############################################################################################################################################| Time: 0:01:07   1.08 MB/s
    gatk4-4.1.1.0- 100% |##############################################################################################################################################| Time: 0:03:41   1.17 MB/s
    

    but I still have this error:
    FileNotFoundError: [Errno 2] No such file or directory: 'java'

    so I directly used abspath/java -jar abspath/gatk-package-4.1.1.0-local.jar, I want to know,in this situation, how can I use gatk directly? I cannot find the way

  • ahdaahda ChinaMember

    I fix the code of gatk4/gatk line208: return ["java"] to return["abspath/java"],then it works!
    but it is not good,I wish the code could special a changable path ,not a deadpath

  • bhanuGandhambhanuGandham Cambridge MAMember, Administrator, Broadie, Moderator admin

    @ahda

    As mentioned in our quick start guide here, you need to make sure you have java8 installed to use gatk.

  • ahdaahda ChinaMember

    @bhanuGandham my situation is, I need to run the gatk4 command in the cluster with qsub. In my login node I have installed Java8, but after qsub, the environment of the running node is changed, and I am not root , I cannot login in the running node , of course I cannot install java8 in it, too. I am sorry I hope I have expressed it clearly.
    by the way, I have learned that I can directly run abspath/gatk-package-4.1.1.0-local.jar. that is all. and thank you for the reply.

  • manolismanolis Member ✭✭
    edited April 4

    Hi @ahda, I do not know if it will resolve your problem but did you try to add in your qsub the option " -q " with your login node name ( echo " ... " | qsub -N ... ... -q login_node) ? I'm quite sure that the job will run in your login node. Then, maybe you can create a jEnv or in your gatk-env specify your java (I never tried this), and activate it when your running gatk including in your pipeline file "source activate gatk". I'm using qsub with gatk but we install everything at root level.

  • ahdaahda ChinaMember

    @manolis Hi , sounds I have done all of you mentioned.
    I run my command with my py3-env and install gatk4 and java8 by conda.
    my command is writed as this : qsub -S /bin/bash -cwd -q all.q -l vf=2g,p=4 mygatk4.sh
    the admin of my cluster tell me to run java with absolute path when qsub, or will get the error.
    I do not be very clear about the difference about the job running in local or running in cluster.
    I think this is the problem of my cluster environment setting, but I have no way to solve it.

Sign In or Register to comment.