1. 程式人生 > >Nature Method:Bioconda解決生物軟體安裝的煩惱

Nature Method:Bioconda解決生物軟體安裝的煩惱

image

其它之前很多人都用過Conda,特別是生信科學家近兩年都在用Bioconda,那叫一個妙不可言、根本停不下來。這裡我鄭重通知大家,Bioconda於今年6月2號正式發表於Nature Methods(IF=26.9)。吃水不忘挖井人,用過的寫文章記得引用它。

image

Bioconda是生物軟體庫,可以利用Conda快速安裝絕大多數生物學軟體,讓生物學家從複雜的版本和依賴關係中解脫出來,專心資料分析。

Bioconda主頁:https://bioconda.github.io/

想查詢要使用的軟體及指定版本是否己被Bioconda收錄,可訪問 https://bioconda.github.io/recipes.html#recipes 查詢:

image

上圖看到查詢qiime,發現目前bioconda已經有8744個軟體及版本收錄,qiime有1.9.1和1.8.0,大多數在Linux和OSX都可以使用。安裝時可以指定版本,如不指定則安裝最新版本。

查詢到的軟體名,可以點選進入

image

有詳細的安裝和升級說明,而且還有Docker映象,即使你安裝不成功,也可以使用Docker方式來使用軟體。這一點非常重要,因為conda也會存在依賴關係無法解決的情況,或安裝完仍存在問題。但Docker是不存在外部依賴問題的,成功率更高。

想使用Bioconda,你需要先安裝Conda。

軟體管理器conda

image

Conda是目前最方便的軟體管理器,可以一鍵安裝大多數生物學軟體,讓你從痛苦的依賴關係和包安裝中解脫出來。常用的發行版有Anaconda,和miniconda兩種。從字面上看就知道一個非常大,一個很小。這裡推薦你**空間大的選anaconda,想快速安裝的選minicond**a。

而且每個版本都有Python2和Python3的版本,這裡我們選擇python2的版本,對目前大多數軟體相容更好。

本教程演示使用的測試平臺為Ubuntu 16.04,~/bin預設為自己的環境變數目錄

# 建立並進入測試目錄中的軟體目錄,請按個人習慣修改
mkdir -p ~/test/soft && cd ~/test/soft

下面Anaconda和Miniconda任選其一即可,這裡推薦Miniconda更小巧

選擇一、Anaconda安裝 603Mb

image

# https://www.anaconda.com 下載Linux python2.7 5.1
wget -c  https://repo.anaconda.com/archive/Anaconda2-5.2.0-Linux-x86_64.sh &
bash Anaconda2-5.2.0-Linux-x86_64.sh 
# 安裝過程同下面minicona

選擇二、Miniconda安裝 38Mb

# 可選miniconda https://conda.io/miniconda.html
wget -c https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh
# Miniconda2 4.5.4

按提示Enter回車、輸入yes同意許可協議、預設安裝目錄為~/miniconda2回車即可;安裝結束後提示新增環境變數,一般選no,否則可能會破壞你之前安裝的軟體依賴關係。如果你是新使用者,沒什麼軟體可破壞的,請選yes新增以後使用更方便

如上面選擇no,以後想使用conda,還要執行下面一句話臨時新增conda為環境變數

export PATH=/mnt/bai/yongxin/miniconda2/bin:$PATH

Codna配置

image

主要是新增bioconda頻道,方便生物軟體安裝。新增清華的一系列映象,加速下載,提高成功率。預設倉庫不僅速度極慢,而且經常中斷,國內映象下載速度可達國外幾百倍。

conda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda
# 新增清華映象加速下載
site=https://mirrors.tuna.tsinghua.edu.cn/anaconda
conda config --add channels ${site}/pkgs/free/ 
conda config --add channels ${site}/pkgs/main/
conda config --add channels ${site}/cloud/conda-forge/
conda config --add channels ${site}/pkgs/r/
conda config --add channels ${site}/cloud/bioconda/
conda config --add channels ${site}/cloud/msys2/
conda config --add channels ${site}/cloud/menpo/
conda config --add channels ${site}/cloud/pytorch/

Conda安裝軟體

conda install bowtie2

顯示如下資訊:

Solving environment: done

## Package Plan ##

  environment location: /mnt/bai/yongxin/miniconda2

  added / updated specs: 
    - bowtie2


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    bowtie2-2.3.4.2            |   py27h2d50403_0        13.6 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    certifi-2018.8.24          |           py27_1         139 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    perl-5.26.2                |       h470a237_0        15.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    ca-certificates-2018.8.24  |       ha4d7672_0         136 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    openssl-1.0.2o             |       h470a237_1         3.5 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    conda-4.5.11               |           py27_0         634 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    ------------------------------------------------------------
                                           Total:        33.8 MB

The following NEW packages will be INSTALLED:

    bowtie2:         2.3.4.2-py27h2d50403_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda   
    perl:            5.26.2-h470a237_0      https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

The following packages will be UPDATED:

    ca-certificates: 2018.03.07-0                                                                           --> 2018.8.24-ha4d7672_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    certifi:         2018.4.16-py27_0                                                                       --> 2018.8.24-py27_1     https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    conda:           4.5.4-py27_0                                                                           --> 4.5.11-py27_0        https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    openssl:         1.0.2o-h20670df_0                                                                      --> 1.0.2o-h470a237_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

Proceed ([y]/n)? 

主要是該軟體的依賴關係,及依賴關係下載地點,輸入y回車,等著安裝完成即可。

對於依賴上百個軟體和包的流程,一鍵安裝成功,那叫一個字“爽”!輕鬆節約你原來幾天的時間。

conda可以輕鬆安裝眾多巨集基因組領域軟體

# 巨集基因組質控流程
conda install kneaddata
# humann2有參物種功能定量流程
conda install humann2
# grahplan樹圖
conda install graphlan
conda install export2graphlan

指定虛擬環境、python版本和軟體版本安裝

有時為了之前安裝的軟體依賴關係不被影響,或預設安裝時無法滿足依賴關係時,就需要新建虛擬環境,並指定版本來安裝。以kneaddata為例,這是一個質控、去宿主和流程依賴很多。如果你原來是Python3,則需要虛擬環境中安裝Python2.7才能執行成功。

conda create -n kneaddata kneaddata=0.6.1 python=2.7

顯示安裝的指定版本和依賴關係,這個不少吧,共31個軟體和包,這要是之前自己裝,可能3天都不一定搞得定。

## Package Plan ##

  environment location: /mnt/bai/yongxin/miniconda2/envs/kneaddata

  added / updated specs: 
    - kneaddata=0.6.1
    - python=2.7


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.15              |       h9fef7bc_0        13.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    boost-1.59.0               |           py27_0        12.7 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo
    krb5-1.14.6                |                0         4.0 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    blast-2.5.0                |       h3727419_3       137.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    openssl-1.0.2p             |       h470a237_0         3.5 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    bmtagger-3.101             |       h470a237_4           7 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    bmtool-3.101               |       hfc679d8_2          64 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    bmfilter-3.101             |       hfc679d8_2          83 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    kneaddata-0.6.1            |             py_2         406 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    readline-7.0               |       haf1bffa_1         381 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    trimmomatic-0.36           |                3         132 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    wheel-0.31.1               |           py27_1          61 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    bzip2-1.0.6                |       h470a237_2         310 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    ncurses-6.1                |       hfc679d8_1         1.2 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    extract_fullseq-3.101      |                3           8 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    sqlite-3.24.0              |       h2f33b56_0         1.5 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    srprism-2.4.24             |       h96824bc_3         457 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    pip-18.0                   |           py27_1         1.7 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    libgcc-7.2.0               |       h69d50b8_2         304 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    zlib-1.2.11                |       h470a237_3          93 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    setuptools-40.2.0          |           py27_0         585 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    trf-4.09                   |                1          47 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    libstdcxx-ng-7.2.0         |       hdf63c60_3         2.5 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    xz-5.2.4                   |       h470a237_1         328 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    samtools-1.7               |                1         1.0 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    libgcc-ng-7.2.0            |       hdf63c60_3         6.1 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    libssh2-1.8.0              |       h5b517e9_2         240 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    curl-7.61.0                |       h93b3f91_1         860 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    tk-8.6.8                   |                0         3.1 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    fastqc-0.11.5              |                1         9.5 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    java-jdk-8.0.92            |                1       122.3 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
    ------------------------------------------------------------
                                           Total:       325.3 MB

安裝完成後提示如何開啟、關閉新的環境

# 啟用工作環境To activate this environment, use:
source activate kneaddata
#
# 關閉環境To deactivate an active environment, use:
source deactivate
#

檢視己安裝軟體的版本和依賴關係

conda list -n kneaddata

顯示軟體安裝位置、依賴關係、版本和下載地址如下:

# packages in environment at /mnt/bai/yongxin/miniconda2/envs/kneaddata:
#
# Name                    Version                   Build  Channel
blast                     2.5.0                h3727419_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
bmfilter                  3.101                hfc679d8_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
bmtagger                  3.101                h470a237_4    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
bmtool                    3.101                hfc679d8_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
boost                     1.59.0                   py27_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo
bowtie2                   2.3.4.2          py27h2d50403_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
bzip2                     1.0.6                h470a237_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ca-certificates           2018.8.24            ha4d7672_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
certifi                   2018.8.24                py27_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
curl                      7.61.0               h93b3f91_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
extract_fullseq           3.101                         3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
fastqc                    0.11.5                        1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
java-jdk                  8.0.92                        1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
kneaddata                 0.6.1                      py_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
krb5                      1.14.6                        0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgcc                    7.2.0                h69d50b8_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgcc-ng                 7.2.0                hdf63c60_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libssh2                   1.8.0                h5b517e9_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libstdcxx-ng              7.2.0                hdf63c60_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ncurses                   6.1                  hfc679d8_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
openssl                   1.0.2p               h470a237_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
perl                      5.26.2               h470a237_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pip                       18.0                     py27_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python                    2.7.15               h9fef7bc_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
readline                  7.0                  haf1bffa_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
samtools                  1.7                           1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
setuptools                40.2.0                   py27_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
sqlite                    3.24.0               h2f33b56_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
srprism                   2.4.24               h96824bc_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
tk                        8.6.8                         0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
trf                       4.09                          1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
trimmomatic               0.36                          3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
wheel                     0.31.1                   py27_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz                        5.2.4                h470a237_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
zlib                      1.2.11               h470a237_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

Reference

Grüning, B., et al. (2018). “Bioconda: sustainable and comprehensive software distribution for the life sciences.” Nature Methods 15(7): 475-476. https://doi.org/10.1038/s41592-018-0046-7

生信軟體的好幫手-bioconda https://mp.weixin.qq.com/s/nK1Kkf9lfZStoX25Y7SzHQ

生信分析平臺搭建(七):bioconda https://mp.weixin.qq.com/s/ng8oNU81UQ6FtBqkyMGV5A

猜你喜歡

寫在後面

為鼓勵讀者交流、快速解決科研困難,我們建立了“巨集基因組”專業討論群,目前己有國內外2000+ 一線科研人員加入。參與討論,獲得專業解答,歡迎分享此文至朋友圈,並掃碼加主編好友帶你入群,務必備註“姓名-單位-研究方向-職稱/年級”。技術問題尋求幫助,首先閱讀《如何優雅的提問》學習解決問題思路,仍末解決群內討論,問題不私聊,幫助同行。
image

學習擴增子、巨集基因組科研思路和分析實戰,關注“巨集基因組”
image

image

點選閱讀原文,跳轉最新文章目錄閱讀
https://mp.weixin.qq.com/s/5jQspEvH5_4Xmart22gjMA