宏基因组分箱软件metaWRAP报错记录与解决⽅法
最近学习微⽣物宏基因组分箱(binning),按官⽅⽂档安装metaWRAP,踩了⼀堆坑,记录⼀下报错及解决⽅法:
1. metaWRAP安装
安装教程及下载地址:GitHub - bxlab/metaWRAP: MetaWRAP - a flexible pipeline for genome-resolved metagenomic data analysis 作者推荐使⽤Conda/Mamba安装,不推荐使⽤bioconda及docker,于是了个包含conda的docker镜像,开始了漫漫长路的第⼀步:
(1)conda安装软件
conda create -y -n metawrap-envpython=2.7source activate metawrap-envconda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda
conda config --add channels ursky
conda install-y -c ursky metawrap-mg
conda install-y blas=2.5=mkl
装完⼤概5GB⼤⼩,提交到了docker hub上:
docker push raser216/metawrap:v1.0.0
本以为⼤功告成,结果随之⽽来的是⼀系列的报错……
(2)安装libtbb2库
运⾏到quant_bins,才发现少了个依赖库没装,导致salmon软件统计基因丰度时报错:
salmon: errorwhileloading shared libraries: libtbb.so.2
解决⽅法:
#安装libtbb2库
apt-getinstalllibtbb2
(3)安装libGL.so.1
bin_refinement步骤figures⽬录下⽆图⽚,python绘图程序报错:
ImportError: Failed to import any qt binding
#python2.7 已安装matplotlib,但⽆法导⼊
import matplotlib
import matplotlib.pyplot as plt
ImportError: libGL.so.1: cannot open sharedobjectfile: No suchfileor directory
解决⽅法:安装libGL.so.1依赖。
apt-get -y update
apt-getinstall-y libgl1-mesa-glx
#安装后,python2可以导⼊该模块,不再报错
python 2.7import matplotlib.pyplot as plt
(4)prokka安装失败,报错
prokka⽆法使⽤,安装失败:
可能原因:metawrap安装的perl版本不符合prokka要求 (metawrap不⽀持perl 5.26?)。
prokka -h
Can't locate Bio/Root/Version.pm in @INC (you may need to install the Bio::Root::Version module) (@INC contains:
/opt/conda/envs/metawrap-env/bin/../perl5 /opt/conda/envs/metawrap-env/lib/site_perl/5.26.2//x86_64-linux-thread-multi
/opt/conda/envs/metawrap-env/lib/site_perl/5.26.2/ /opt/conda/envs/metawrap-env/lib/site_perl/5.26.2/x86_64-linux-thread-multi /opt/conda/envs/metawrap-env/lib/site_perl/5.26.2 /opt/conda/envs/metawrap-env/lib/5.26.2/x86_64-linux-thread-multi /opt/conda/envs/metawrap-env/lib/5.26.2 .) at /opt/conda/envs/metawrap-env/bin/prokka line 32.BEGIN failed--compilation aborted at /opt/conda/envs/metawrap-env/bin/prokka line32.
解决⽅法:在当前metawrap 环境中⽤conda重装prokka-1.13。
conda create -n prokka-test prokka=1.13minced=0.3.0parallel=20180522blast=2.12.0source activate prokka-test
(1)⽆法进⼊conda环境
⽆法在shell脚本中通过source activate metawrap-env进⼊conda环境,报错:
/opt/conda/envs/metawrap-env/etc/conda/activate.d/activate-binutils_linux-64.sh: line65: ADDR2LINE: unbound variable
解决⽅法:通过dockerfile进⼊conda环境,并把安装软件的路径加到环境变量中:
cat metawrap_v1.dockerfile
#dockerfile内容如下
FROM raser216/metawrap:v1.0.0RUN echo"source activate metawrap-env"> ~/.bashrc
ENV PATH /opt/conda/envs/metawrap-env/bin:$PATH
3.数据库路径及版本
metaWRAP中调⽤的⽐对软件(kraken、BLAST等)的数据库可以外置,但数据库外置的路径需要在config中写明:
#config⽂件路径whichconfig-metawrap/opt/conda/envs/metawrap-env/bin/config-metawrap
#⽤sed -i更改为各数据库真实路径
kraken_database=/database/kraken_database/kraken_newdb2/axel_dowload
nt_database=/database/newdownload3
tax_database=/database/metawrap_database/ncbi_taxonomysed-
i"s#~/KRAKEN_DB#$kraken_database#g"/opt/conda/envs/metawrap-env/bin/config-metawrapsed-
perl下载安装教程
i"s#~/NCBI_NT_DB#$nt_database#g"/opt/conda/envs/metawrap-env/bin/config-metawrapsed-
i"s#~/NCBI_TAX_DB#$tax_database#g"/opt/conda/envs/metawrap-env/bin/config-metawrap
该⽂件必须有写权限,否则bin_refinement步骤报错:
#bin_refinement步骤报错
You donot seem to have permission to edit the checkm configfilelocated at /opt/conda/envs/metawrap-
env/lib/python2.7/site-packages/checkm/DATA_CONFIG
解决⽅法:改变config⽂件权限,不再报错。
chmod777/opt/conda/envs/metawrap-env/bin/config-metawrap
4. kraken软件报错
kraken是个直接对测序reads(fastq)进⾏物种注释的软件,⽬前有两个主版本,1代(kraken)耗内存极⾼(>100GB),2代(kraken2)改良了很多(35GB左右就⾏)。
(1)注释⾏导致的报错
kraken.sh脚本路径在/opt/conda/envs/metawrap-env/bin/metawrap-modules/,该脚本第123-125⾏的
注释信息直接写在⾏后,导致kraken.sh运⾏报错(错误信息未记录):
123 awk '{ printf("%s",$0); n++; if(n%4==0) { printf("\n");} else { printf("\t\t");} }' |\ #combine paired end reads onto one line  124 shuf | head -n $depth | sed 's/\t\t/\n/g' | \ #shuffle reads, select top N reads, and then restore tabulation
125 awk -F"\t" '{print $1 > "'"${out}/tmp_1.fastq"'"; print $2 > "'"${out}/tmp_2.fastq"'"}' #separate reads into F and R files
解决⽅法:把注释⾏全部换到新⾏
123 # combine paired end reads onto one line, then    124 # shuffle reads, select top N reads, and then restore tabulation, then  125# separate reads into F and R files126 awk '{ printf("%s",$0); n++; if(n%4==0) { printf("\n");} else { printf("\t\t");} }' |\ 127 shuf | head -n $depth | sed 's/\t\t/\n/g' | \
128 awk -F"\t" '{print $1 > "'"${out}/tmp_1.fastq"'"; print $2 > "'"${out}/tmp_2.fastq"'"}'
(2) 脚本⽆权限报错
注意kraken.sh脚本权限应为可执⾏,否则使⽤时报错:
/opt/conda/envs/metawrap-env/bin/metawrap: line69: /opt/conda/envs/metawrap-env/bin/metawrap-modules/kraken.sh: Permission denied
解决⽅法:修改脚本权限为775,不再报错。
chmod775kraken.shls-l kraken.sh-rwxrwxr-x1root root8.9K Sep2220:12kraken.sh
(3)python注释脚本报错
python脚本kraken2_translate.py,字典names_map遇到未知key,报KeyError错误。
Something went wrong with Exiting.
Traceback (most recent call last):
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line120,in    main()
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line114,in main
translate_kraken2_annotations(annotation_file=kraken_file, kraken2_db=database_location, output=output_file)
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line98,in translate_kraken2_annotations    taxonomy = get_full_name(taxid, names_map, ranks_map)
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line30,in get_full_name
name = names_map[taxid]
KeyError: '1054037'
解决⽅法:修改字典获取值的⽅式,改为()函数,并加⼊None值判断。
vi/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py
#修改get_full_name函数,使key不存在时names_map不报错:
fortaxidin taxid_lineage:
#name = names_map[taxid]
name = (taxid)
ifname == None:
name ="unknown"        names_lineage.append(name)
(4)不到taxonomy数据库报错
下载的NCBI taxonomy数据库需要放到下载的kraken数据库⽬录下,否则报错:
Traceback (most recent calllast):
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line120,in    main()
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line114,in main
translate_kraken2_annotations(annotation_file=kraken_file, kraken2_db=database_location, output=output_file)
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line87,in translate_kraken2_annotations    names_map, ranks_map = load_kraken_db_metadata(kraken2_db)
File "/opt/conda/envs/metawrap-env/bin/metawrap-scripts/kraken2_translate.py", line50,in load_krak
en_db_metadata
with open(names_path) as input:
IOError: [Errno 2] No suchfileor directory:'/database/kraken_database/kraken_newdb2/axel_dowload/taxonomy/names.dmp'解决⽅法:把taxonomy数据库复制到kraken数据库⽬录下。
(5)kraken软件与数据库版本不相符,报错
此前⽤过kraken2(2代软件),服务器上已经下载了2代所需的(巨⼤的)数据库,不想再下⼀次kraken(1代软件)数据库,于是试了试2代的数据库能否兼容1代软件,果然不⾏,报错:
kraken: database ("/database/kraken_database/kraken_newdb2/axel_dowload") does not contain necessaryfiledatabase.kdb
遂考虑更新metaWRAP中的kraken版本,结果发现,默认安装的metaWRAP不⽀持kraken2,需要更新到最新的1.3.2版本:
解决⽅法:更新metaWRAP版本⾄1.3.2。
condainstall-y -c ursky metawrap-mg=1.3.2#更新后需要重新修改config⽂件权限,及其中的内容
chmod777/opt/conda/envs/metawrap-env/bin/config-metawrap
5.checkM软件报错
(1)py换⾏符报错
checkM是⽤于检测基因组拼接组装完整性的软件,bin_refinement会⽤到,直接报错:
Traceback (most recent calllast):
File "/opt/conda/envs/metawrap-env/bin/checkm", line36,in    from checkm import main
File "/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/main.py", line25,in    from checkm.defaultValues import DefaultValues
File "/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/defaultValues.py", line26,in    class DefaultValues():
File "/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/defaultValues.py", line29,in
DefaultValues
__DBM = DBManager()
File "/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/checkmData.py", line114,in __init__
if not self.setRoot():
File "/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/checkmData.py", line140,in setRoot
path = firmPath(path=path)
File "/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/checkmData.py", line162,in confirmPath
path = raw_input("Where should CheckM store it's data?\n" \
EOFError: EOF when reading a line
解决⽅法:修改checkmData.py⽂件raw_input()函数参数。
该py脚本所在路径:/opt/conda/envs/metawrap-env/lib/python2.7/site-packages/checkm/
报错原因:第162⾏的raw_input()函数加了“\”作为换⾏符,python没识别
162path = raw_input("Where should CheckM store it's data?\n" \163Please specify a location or type'abort'to stop trying: \n")
解决⽅法:删除该换⾏符。
162path = raw_input("Where should CheckM store it's data?\nPlease specify a location or type 'abort' to stop trying: \n")

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。