问题

源码下载的 LEfSe,或者使用 conda install -c bioconda lefse 安装完成后,执行分析出现报错:

  1. $ lefse-format_input.py hmp_aerobiosis_small.txt hmp_aerobiosis_small.in -c 1 -s 2 -u 3 -o 1000000
  2. $ run_lefse.py hmp_aerobiosis_small.in hmp_aerobiosis_small.res
  3. Number of significantly discriminative features: 51 ( 131 ) before internal wilcoxon
  4. Number of discriminative features with abs LDA score > 2.0 : 51
  5. $ lefse-plot_res.py hmp_aerobiosis_small.res hmp_aerobiosis_small.png
  6. Traceback (most recent call last):
  7. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/bin/lefse-plot_res.py", line 177, in <module>
  8. else: plot_histo_hor(params['output_file'],params,data,len(data['cls']) == 2,params['report_features'])
  9. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/bin/lefse-plot_res.py", line 70, in plot_histo_hor
  10. ax = fig.add_subplot(111,frame_on=False,axis_bgcolor=params['back_color'])
  11. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/lib/python2.7/site-packages/matplotlib/figure.py", line 1239, in add_subplot
  12. a = subplot_class_factory(projection_class)(self, *args, **kwargs)
  13. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/lib/python2.7/site-packages/matplotlib/axes/_subplots.py", line 77, in __init__
  14. self._axes_class.__init__(self, fig, self.figbox, **kwargs)
  15. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 539, in __init__
  16. self.update(kwargs)
  17. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 888, in update
  18. for k, v in props.items()]
  19. File "/Bio/Bioinfo/Pipeline/SoftWare/Anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 881, in _update_property
  20. raise AttributeError('Unknown property %s' % k)
  21. AttributeError: Unknown property axis_bgcolor

原因

出现报错主要原因是 matplotlib==2.2.0 起把部分功能函数移除了,我们需要回退 matplotlib 版本。

LEfSe 分析软件安装小记 - 图1

  1. $ python
  2. Python 2.7.15 |Anaconda custom (64-bit)| (default, May 1 2018, 23:32:55)
  3. [GCC 7.2.0] on linux2
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> import matplotlib
  6. >>> matplotlib.__version__
  7. '2.2.2'
  8. >>>

解决

  1. $ pip install matplotlib==1.5 #注意不要用conda, 以免发生环境conflicts

重新测试

  1. $ wget http://huttenhower.sph.harvard.edu/webfm_send/129 -O hmp_aerobiosis_small.txt
  2. $ format_input.py hmp_aerobiosis_small.txt hmp_aerobiosis_small.in -c 1 -s 2 -u 3 -o 1000000
  3. $ run_lefse.py hmp_aerobiosis_small.in hmp_aerobiosis_small.res
  4. $ plot_res.py hmp_aerobiosis_small.res hmp_aerobiosis_small.png

LEfSe 分析软件安装小记 - 图2

问题解决!