微生物组分析软件 QIIME 2 安装小记

由于微信不允许外部链接,你需要点击文章尾部左下角的 "阅读原文",才能访问文中链接。

QIIME 2 是一个功能强大,可扩展,分散式的(decentralized)微生物组分析软件包,专注于数据和分析透明度。 QIIME 2 使研究人员能够从原始 DNA 序列数据开始进行分析,最终得到以符合出版物标准的图形数据和统计结果。

主要特点:

  • 集成和自动跟踪数据来源

  • 语义类型系统(Semantic type system)

  • 用于扩展微生物组分析功能的插件系统

  • 支持多种类型的用户界面(例如API,命令行,图形)

QIIME 2 是对 QIIME 1 微生物组分析流程完全重新设计和重写而来的。 QIIME 2 将解决 QIIME 1 的许多局限性,同时保留了使 QIIME 1 成为功能强大且广泛使用的 analysis pipeline 功能。

QIIME 2 目前支持一个初始化的端到端微生物组分析 pipeline。 新的功能可以通过 QIIME 2 插件进行定期获取。 您可以在 QIIME 2 插件可用性页面 上查看当前可用的插件列表。 future plugins 插件页面列出了正在开发的插件。


QIIME 2 安装

QIIME 2 可以本地安装或使用虚拟机安装。其最新版本为 QIIME 2 Core 2018.8 distribution。下面,我们来介绍一下 Linux 下的本地机器如何安装 QIIME 2 Core 2018.8。


安装 Miniconda

Miniconda 提供了 conda 环境和软件包管理器,是安装 QIIME 2 的推荐方法。请按照下载和安装 Miniconda 的说明进行 Miniconda 安装操作,这里不展开细说。 我们可以选择 Miniconda2 或 Miniconda3(即 Miniconda Python 2 或 3)。 QIIME 2 将与任一版本的 Miniconda 一起使用。同样的,我们也可以选择在 Anaconda2 或 Anaconda3 下安装 QIIME 2。

安装 Miniconda(或者 Anaconda) 并打开新终端后,请确保我们运行的是最新版本的 conda:

conda update conda
conda install wget

部分服务器使用系统 /usr/bin/wget 下载 qiime2-2018.8-py35-linux-conda.yml 可能会出现 OpenSSL 错误,因此在这里推荐使用 conda install wget。



安装 QIIME 2

安装 Miniconda/Anaconda 后,创建一个 conda 环境并在环境中安装 QIIME 2 Core 2018.8 发行版。 我们强烈建议专门为正在安装的 QIIME 2 版本创建一个新环境,因为您可能不希望将许多必需的依赖项添加到现有环境中。 我们可以为环境选择任何我们喜欢的名称。 在这个例子中,我们将环境命名为 qiime2-2018.8 以表明安装了 QIIME 2 版本(即 2018.8)。

$ wget https://data.qiime2.org/distro/core/qiime2-2018.8-py35-linux-conda.yml
$ conda env create -n qiime2-2018.8 --file qiime2-2018.8-py35-linux-conda.yml
# OPTIONAL CLEANUP
$ rm qiime2-2018.8-py35-linux-conda.yml


由于 qiime2-2018.8 中包含了 blast-2.6.0(246.7 MB)、mkl-2018.0.3(198.7 MB)等一些大文件,其 yml 默认的 channels 会严重影响国内用户下载速度,因此在这里小编建议在已经下载好的 qiime2-2018.8-py35-linux-conda.yml 中把 conda-forge、bioconda 的 channels 更换为清华大学的镜像。

channels:
- qiime2/label/r2018.8
- qiime2
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
- defaults
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
- biocore
dependencies:
- bioconductor-biobase=2.38.0
- bioconductor-biocgenerics=0.24.0
- bioconductor-biocparallel=1.12.0
......

需要注意的是,QIIME 2 依赖包很多,安装过程可能耗费很长时间(小编在 Anaconda2 环境中一共花费了大约 1 个多小时才把它安装完成),请耐心等待。



激活 conda 环境

现在我们已拥有 QIIME 2 环境,需要使用环境名称激活它:

shenweiyan@ecs-steven 15:45:47 /home/shenweiyan
$ source activate qiime2-2018.8
QIIME is caching your current deployment for improved performance. This may take a few moments and should only happen once per deployment.
(qiime2-2018.8) shenweiyan@ecs-steven 15:47:37 /home/shenweiyan
$

要停用环境,请运行 source deactivate


测试与使用

我们可以通过激活 QIIME 2 环境并运行来测试您的安装:

$ qiime --help
Usage: qiime [OPTIONS] COMMAND [ARGS]...

 QIIME 2 command-line interface (q2cli)
 --------------------------------------

 To get help with QIIME 2, visit https://qiime2.org.

 To enable tab completion in Bash, run the following command or add it to
 your .bashrc/.bash_profile:

     source tab-qiime

 To enable tab completion in ZSH, run the following commands or add them to
 your .zshrc:

     autoload bashcompinit && bashcompinit && source tab-qiime

Options:
 --version  Show the version and exit.
 --help     Show this message and exit.

Commands:
 info                Display information about current deployment.
 tools               Tools for working with QIIME 2 files.
 dev                 Utilities for developers and advanced users.
 alignment           Plugin for generating and manipulating alignments.
 composition         Plugin for compositional data analysis.
 cutadapt            Plugin for removing adapter sequences, primers, and
                     other unwanted sequence from sequence data.
 dada2               Plugin for sequence quality control with DADA2.
 deblur              Plugin for sequence quality control with Deblur.
 demux               Plugin for demultiplexing & viewing sequence quality.
 diversity           Plugin for exploring community diversity.
 emperor             Plugin for ordination plotting with Emperor.
 feature-classifier  Plugin for taxonomic classification.
 feature-table       Plugin for working with sample by feature tables.
 gneiss              Plugin for building compositional models.
 longitudinal        Plugin for paired sample and time series analyses.
 metadata            Plugin for working with Metadata.
 phylogeny           Plugin for generating and manipulating phylogenies.
 quality-control     Plugin for quality control of feature and sequence data.
 quality-filter      Plugin for PHRED-based filtering and trimming.
 sample-classifier   Plugin for machine learning prediction of sample
                     metadata.
 taxa                Plugin for working with feature taxonomy annotations.
 vsearch             Plugin for clustering and dereplicating with vsearch.

如果运行此命令时未报告任何错误,则安装成功!

FAQ:Plugin error from dada2

今天在使用 qiime dada2 处理序列质控过程中,出现一个很意外的报错:

$ qiime dada2 denoise-single --i-demultiplexed-seqs demux.qza --p-trim-left 0 --p-trunc-len 120 --o-representative-sequences rep-seqs-dada2.qza --o-table table-dada2.qza --o-denoising-stats stats-dada2.qza
Plugin error from dada2:

 An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

Debug info has been saved to /tmp/qiime2-q2cli-err-lygxape5.log

追踪具体的报错信息:

$ cat /tmp/qiime2-q2cli-err-lygxape5.log
R version 3.4.1 (2017-06-30)
Loading required package: Rcpp
Error: package or namespace load failed for ‘dada2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/software/Anaconda2/envs/qiime2-2018.8/lib/R/library/RCurl/libs/RCurl.so':
 /usr/local/software/Anaconda2/envs/qiime2-2018.8/lib/R/library/RCurl/libs/../../../.././libcom_err.so.3: symbol k5_strerror_r, version krb5support_0_MIT not defined in file libkrb5support.so.0 with link time reference
Execution halted
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.
......

根据 log 信息,很明显是在执行 qiime dada2 过程中软件调用了 R 中的 dada2 包不成功,引发了一个 libcom_err.so.3 的共享动态库错误。为了印证问题,我们进入了 qiime2-2018.8 环境下的 R 测试导入 dada2,果然出现了一样的错误:

> library(dada2)
Error: package or namespace load failed for ‘dada2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/software/Anaconda2/envs/qiime2-2018.8/lib/R/library/RCurl/libs/RCurl.so':
 /usr/local/software/Anaconda2/envs/qiime2-2018.8/lib/R/library/RCurl/libs/../../../.././libcom_err.so.3: symbol k5_strerror_r, version krb5support_0_MIT not defined in file libkrb5support.so.0 with link time reference
>

结合 google 后的一些解决方案,考虑到这应该是受系统 LD_LIBRARY_PATH 干扰,以致于导致了 qiime2-2018.8 conda 环境的共享动态库不起作用。后来,我们通过更直接的 echo $LD_LIBRARY_PATH 命令查看 qiime2-2018.8 环境中是否有系统的 LD_LIBRARY_PATH 影响时,的确发现了系统的默认库环境:

(qiime2-2018.8) shenweiyan@ecs-steven 16:24:29 /home/shenweiyan/debugs/qiime-18.09.19
$ echo $LD_LIBRARY_PATH
/usr/local/software/R-3.3.2/lib64/:/usr/local/software/R-3.3.2/lib:/usr/local/lib:/usr/local/software/libgd/lib:/usr/local/software/gsl/lib:/usr/local/software/zlib/lib:/lib64:/opt/intel/composer_xe_2011_sp1.6.233/mkl/lib/intel64:/opt/intel/composer_xe_2011_sp1.6.233/debugger/lib/intel64:/opt/intel/composer_xe_2011_sp1.6.233/mpirt/lib/intel64:/opt/intel/composer_xe_2011_sp1.6.233/debugger/lib/intel64:/opt/intel/composer_xe_2011_sp1.6.233/mpirt/lib/intel64

最后,我们通过在程序中手动临时删除系统默认 LD_LIBRARY_PATH ,从而解决了以上问题:

unset LD_LIBRARY_PATH

当然,我们也可以把以上设置添加到 ~/.bashrc 或者 ~/.bash_profile 中,让它永久起作用。

·end·

—如果喜欢,快分享给你的朋友们吧—

我们一起愉快的玩耍吧



本文分享自微信公众号 - 生信科技爱好者(bioitee)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

posted @ 2018-09-19 22:43  章鱼猫先生  阅读(568)  评论(0编辑  收藏  举报