← Back to list

Install GATK4 in Conda

Being a NGS Data Analyst, I use GATK4 everyday. I mean i have atleast 4 terminals open with some step in GATK4 running for like 3 days…

Ambu Vijayan in Towards Dev · 2022-07-07 09:45 · 106 claps · 1.7 min read
#conda #gatk4 #gatk #ng #big-data-analytics
Open on Medium ↗
Wiki topics: GEN · Genomics & Sequencing GRW · Growth & Analytics 🏃 · Running & Endurance

Install GATK4 in Conda

Being a NGS Data Analyst, I use GATK4 everyday. I mean i have atleast 4 terminals open with some step in GATK4 running for like 3 days consistently. This thing takes time. But how many of you know that there are “spark” scripts for some steps that can speed up your analysis with so much time to spare. I mean three days to one day is just sweet. Some scripts are still under evaluation. Yet is powerful.

You can download and run GATK4 natively from the binaries. But having lots of tools and changing python and java versions for every tool i use is not practical. That's why I use conda.

Now installing conda is straight forward and i have a separate article of all the steps and scripts to do the same.

Still if you are in a hurry then,

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh \
&& chmod +x miniconda.sh && bash miniconda.sh -b -p miniconda

base_dir=$(echo $PWD)

export PATH=$base_dir/miniconda/bin:$PATH
conda init bash
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge

Thats the unexplained version of how to install conda.

Now to install GATK4

We have to activate conda first using the command in terminal.

conda activate

Now we are going to create a new environment named gatk4 and install gatk4 into that environment from bioconda.

conda create -n gatk4 -c bioconda gatk4 -y

Explanation of the code :-

▹ conda -> Calling conda

▹ create -> Create a new environment

▹ n -> New

▹ gatk4 -> Name of the environment

▹ c -> Setting the channel

▹ biconda -> Channel used

▹ -y -> Yes to install all the packages without prompting y/n

Activate the new environment

conda activate gatk4

That's it. You have a working gatk4 installation in conda. You can start your work.

Now the issue happens when you try to use spark scripts. It will throw up some error.

This happens due to some java compatibility issues.

We will rectify that by downgrading openJDK 11 to openJDK 8.

We do that by using this script.

conda install openjdk==8.0.332=h166bdaf_0

This will downgrade the JDK to version 8 and everything will work smoothly.

This is tried and tested.

You can thank me later. Kudos!

##Disable Automatic Activation of Conda

For those who want to disable automatic activation:

conda config --set auto_activate_base false

메타데이터
post_id
bb12f7d35c94
slug
install-gatk4-in-conda-bb12f7d35c94
url
https://towardsdev.com/install-gatk4-in-conda-bb12f7d35c94
canonical_url
https://towardsdev.com/install-gatk4-in-conda-bb12f7d35c94
author_url
https://medium.com/@ambuvijayan
status
ok
fetched_at
2026-06-09 15:37:30