当前位置: 首页 > 工具软件 > workflow.py > 使用案例 >

QIIME1.9.1:summarize_taxa_through_plots.py画图失败

拓拔浩阔
2023-12-01

QIIME中的画图命令summarize_taxa_through_plots.py需要调用matplotlib,而matplotlib版本在进化上参数名有重大变化,导致最新版的matplotlib不能出图,报错如下:
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/usr/local/bin/summarize_taxa_through_plots.py", line 143, in <module>
    main()
  File "/usr/local/bin/summarize_taxa_through_plots.py", line 140, in main
    status_update_callback=status_update_callback)
  File "/usr/local/lib/python2.7/dist-packages/qiime/workflow/downstream.py", line 711, in run_summarize_taxa_through_plots
    close_logger_on_success=close_logger_on_success)
  File "/usr/local/lib/python2.7/dist-packages/qiime/workflow/util.py", line 122, in call_commands_serially
    raise WorkflowError(msg)
qiime.workflow.util.WorkflowError:
*** ERROR RAISED DURING STEP: Plot Taxonomy Summary
Command run was:
 plot_taxa_summary.py -i otu_table_silva_97_summary/otu_table_silva_97_L2.txt,otu_table_silva_97_summary/otu_table_silva_97_L3.txt,otu_table_silva_97_summary/otu_table_silva_97_L4.txt,otu_table_silva_97_summary/otu_table_silva_97_L5.txt,otu_table_silva_97_summary/otu_table_silva_97_L6.txt -o otu_table_silva_97_summary/taxa_summary_plots/
Command returned exit status: 1
Stdout:
Stderr
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/usr/local/bin/plot_taxa_summary.py", line 278, in <module>
    main()
  File "/usr/local/bin/plot_taxa_summary.py", line 274, in main
    resize_nth_label, label_type, include_html_legend)
  File "/usr/local/lib/python2.7/dist-packages/qiime/plot_taxa_summary.py", line 1138, in make_all_charts
    resize_nth_label, label_type, include_html_legend))
  File "/usr/local/lib/python2.7/dist-packages/qiime/plot_taxa_summary.py", line 1073, in get_counts
    label_type, include_html_legend))
  File "/usr/local/lib/python2.7/dist-packages/qiime/plot_taxa_summary.py", line 861, in make_HTML_table
    props={'title': title})
  File "/usr/local/lib/python2.7/dist-packages/qiime/plot_taxa_summary.py", line 467, in make_area_bar_chart
    ax1 = fig.add_subplot(111, axisbg=background_color)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 1239, in add_subplot
    a = subplot_class_factory(projection_class)(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_subplots.py", line 77, in __init__
    self._axes_class.__init__(self, fig, self.figbox, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 539, in __init__
    self.update(kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py", line 888, in update
    for k, v in props.items()]
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py", line 881, in _update_property
    raise AttributeError('Unknown property %s' % k)
AttributeError: Unknown property axisbg

核心原因是matplotlib版本在>2.0.2后把参数名axisbg改为facecolor, 而支持axisbg的matplotlib的稳定版本是1.x。

QIIME官方的配置(虚拟机)如下:
qiime@qiime-190-virtual-box:~/Desktop/Shared_Folder$ print_qiime_config.py -t
System information
==================
         Platform: linux2
   Python version: 2.7.3 (default, Dec 18 2014, 19:10:20)  [GCC 4.6.3]
Python executable: /usr/bin/python
QIIME default reference information
===================================
For details on what files are used as QIIME's default references, see here:
 https://github.com/biocore/qiime-default-reference/releases/tag/0.1.2
Dependency versions
===================
          QIIME library version: 1.9.1
           QIIME script version: 1.9.1
qiime-default-reference version: 0.1.2
                  NumPy version: 1.9.2
                  SciPy version: 0.15.1
                 pandas version: 0.16.1
             matplotlib version: 1.4.3
            biom-format version: 2.1.4
                   h5py version: 2.4.0 (HDF5 version: 1.8.4)
                   qcli version: 0.1.1
                   pyqi version: 0.3.2
             scikit-bio version: 0.2.3
                 PyNAST version: 1.2.2
                Emperor version: 0.9.51
                burrito version: 0.9.1
       burrito-fillings version: 0.1.1
              sortmerna version: SortMeRNA version 2.0, 29/11/2014
              sumaclust version: SUMACLUST Version 1.0.00
                  swarm version: Swarm 1.2.19 [May 26 2015 13:50:14]
                          gdata: Installed.
QIIME config values
===================
For definitions of these settings and to learn how to configure QIIME, see here:
 http://qiime.org/install/qiime_config.html
 http://qiime.org/tutorials/parallel_qiime.html
                     blastmat_dir: /qiime_software/blast-2.2.22-release/data
      pick_otus_reference_seqs_fp: /usr/local/lib/python2.7/dist-packages/qiime_default_reference/gg_13_8_otus/rep_set/97_otus.fasta
                         sc_queue: all.q
      topiaryexplorer_project_dir: None
     pynast_template_alignment_fp: /usr/local/lib/python2.7/dist-packages/qiime_default_reference/gg_13_8_otus/rep_set_aligned/85_otus.pynast.fasta
                  cluster_jobs_fp: start_parallel_jobs.py
pynast_template_alignment_blastdb: None
assign_taxonomy_reference_seqs_fp: /usr/local/lib/python2.7/dist-packages/qiime_default_reference/gg_13_8_otus/rep_set/97_otus.fasta
                     torque_queue: friendlyq
                    jobs_to_start: 1
                       slurm_time: None
            denoiser_min_per_core: 50
assign_taxonomy_id_to_taxonomy_fp: /usr/local/lib/python2.7/dist-packages/qiime_default_reference/gg_13_8_otus/taxonomy/97_otu_taxonomy.txt
                         temp_dir: /tmp/
                     slurm_memory: None
                      slurm_queue: None
                      blastall_fp: /qiime_software/blast-2.2.22-release/bin/blastall
                 seconds_to_sleep: 1
QIIME base install test results
===============================
.........
----------------------------------------------------------------------
Ran 9 tests in 0.075s
OK

所以matplotlib要装1.x版本。

matplotlib版本不连续,可以用的1.x版本为1.5.3,所以卸载,并重新安装matplotlib即可。

sudo pip uninstall matplotlib
sudo pip install matplotlib==1.5.3

ref:

https://github.com/python-windrose/windrose/issues/49

https://pypi.org/project/matplotlib/#history

http://qiime.org/install/install.html


 类似资料: