GATK4 安装方法
约 929 字大约 3 分钟
2024-11-06
( 这里以当时最新发布的版本 4.6.1.0 为例, 以后可根据最新版本更新相关名称 )
GATK4
官方 不推荐直接使用 bioconda
里面的包
Some tools in GATK4, like the gCNV pipeline and the new deep learning variant filtering tools, require extensive Python dependencies. To avoid having to worry about managing these dependencies, we recommend using the GATK4 docker container, which comes with everything pre-installed, as explained here. If you are running GATK4 on a server and/or cannot use the Docker image, we recommend using the Conda package manager as a backup solution. The Conda package manager comes with all the dependencies you need, so you do not need to install everything separately. Both Conda and Docker are intended to solve the same problem, but one of the big differences/benefits of Conda is that you can use Conda without having root access. Conda should be easy to install if you follow these steps.
Do not confuse the above mentioned GATK conda environment setup with this bioconda gatk installation. The current version of the bioconda installation of GATK does not set up the conda environment used for the GATK python tools, so that must still be set up manually.
使用 anaconda
- 下载官方 Github Release的 zip包
wget https://github.com/broadinstitute/gatk/releases/download/4.6.1.0/gatk-4.6.1.0.zip
- 解压并进入
unzip gatk-4.6.1.0.zip
cd gatk-4.6.1.0
通过 yaml 文件创建虚拟环境
- (可选) 更换国内镜像
# 我选的南京大学 conda-forge 镜像源 sed "s/conda-forge:://g" gatkcondaenv.yml | sed "s/conda-forge://g" | sed "s/- conda-forge/- https:\/\/mirror.nju.edu.cn\/anaconda\/cloud\/conda-forge/g" > my_gatkcondaenv.yml
- 安装依赖
# 如果你跳过了上一步 conda env create -n GATK4.6.1.0 -f gatkcondaenv.yml # 如果你做了上一步 conda env create -n GATK4.6.1.0 -f my_gatkcondaenv.yml
链接
gatk
二进制文件ln -s $(pwd)"/gatk" ~/anaconda3/envs/GATK4.6.1.0/bin # 所以第2步解压后生成的文件夹还是要保留的
检查安装
- 激活虚拟环境
GATK4.6.1.0
conda activate GATK4.6.1.0
- 看看用的是不是自己安的
GATK4
which gatk # /home/saturn/anaconda3/envs/GATK4.6.1.0/bin/gatk
- 查看版本
gatk --version # The Genome Analysis Toolkit (GATK) v4.6.1.0 # HTSJDK Version: 4.1.3 # Picard Version: 3.3.0
- 激活虚拟环境
使用 micromamba
- 下载官方 Github Release的 zip包
wget https://github.com/broadinstitute/gatk/releases/download/4.6.1.0/gatk-4.6.1.0.zip
- 解压并进入
unzip gatk-4.6.1.0.zip
cd gatk-4.6.1.0
通过 yaml 文件创建虚拟环境
- 使用
micromamba
必须修改一下 yaml 文件 ( 不能使用 "conda-forge::" 这种写法,否则会一直卡住 )
# 改都改了,顺便也换个源吧~ # 我还是选的南京大学 conda-forge 镜像源 sed "s/conda-forge:://g" gatkcondaenv.yml | sed "s/conda-forge://g" | sed "s/- conda-forge/- https:\/\/mirror.nju.edu.cn\/anaconda\/cloud\/conda-forge/g" > my_gatkcondaenv.yml
- 安装依赖
micromamba env create -n GATK4.6.1.0 -f my_gatkcondaenv.yml
- 使用
链接
gatk
二进制文件ln -s $(pwd)"/gatk" ~/micromamba/envs/GATK4.6.1.0/bin # 所以第2步解压后生成的文件夹还是要保留的
检查安装
- 激活虚拟环境
GATK4.6.1.0
micromamba activate GATK4.6.1.0
- 看看用的是不是自己安的
GATK4
which gatk # /public/workspace/stu22230111/micromamba/envs/GATK4.6.1.0/bin/gatk
- 查看版本
gatk --version # The Genome Analysis Toolkit (GATK) v4.6.1.0 # HTSJDK Version: 4.1.3 # Picard Version: 3.3.0
- 激活虚拟环境
使用 singularity
注意!目前国内无法直接访问 dockerhub,相关镜像网站也关闭相应服务。解决办法如下:
- 使用 第三方 dockerhub 镜像网站
- 自建 dockerhub 镜像网站
- 配置代理 (懂的都懂)
# 在可以正常访问 dockerhub 网站的网络环境下可以直接运行
singularity pull docker://broadinstitute/gatk:latest
# 国内网络环境 (镜像网址替换为自己搭建或者第三方网站的域名,无需添加 https:// )
# 例如:singularity pull docker://dockerpull.org/broadinstitute/gatk:latest
singularity pull docker://镜像网址/broadinstitute/gatk:latest
- 耐心等待后,当前文件夹会有一个
gatk_latest.sif
镜像文件
# 进入镜像
singularity shell ./gatk_latest.sif
# 当你的 shell 前面转变为 `Singularity>` 提示时,就说明成功进入镜像了
# Singularity>
- 查看版本
gatk --version
# Singularity> gatk --version
# Using GATK jar /gatk/gatk-package-4.6.1.0-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=2 -jar /gatk/gatk-package-4.6.1.0-local.jar --version
# The Genome Analysis Toolkit (GATK) v4.6.1.0
# HTSJDK Version: 4.1.3
# Picard Version: 3.3.0