Matplotlib error by running summarize_taxa_through_plots.py

36 views
Skip to first unread message

salvatore lachina

unread,
Jun 15, 2017, 11:55:11 AM6/15/17
to Qiime 1 Forum
Hello,

I am new to this forum. I am using qiime on Debian 8 machine and when  run summarize_taxa_through_plots.py I take an error.

The command is:

 summarize_taxa_through_plots.py -i /.../observation_table_sorted.biom -o .../ko_summary_plots/ -f -s

and the output is:

 *** ERROR RAISED DURING STEP: Plot Taxonomy Summary
Command run was:
 plot_taxa_summary.py -i Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_sorted_L2.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_sorted_L3.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_sorted_L4.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_sorted_L5.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_sorted_L6.txt -o Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots//taxa_summary_plots/
Command returned exit status: 1
Stdout:

Stderr
/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):
Traceback (most recent call last):
  File "/home/salvatore/miniconda3/envs/qiime2.7/bin/plot_taxa_summary.py", line 4, in <module>
    __import__('pkg_resources').run_script('qiime==1.9.1', 'plot_taxa_summary.py')
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 744, in run_script
   
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 1499, in run_script
   
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/plot_taxa_summary.py", line 278, in <module>
    main()
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/plot_taxa_summary.py", line 274, in main
    resize_nth_label, label_type, include_html_legend)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 1138, in make_all_charts
    resize_nth_label, label_type, include_html_legend))
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 1073, in get_counts
    label_type, include_html_legend))
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 861, in make_HTML_table
    props={'title': title})
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 615, in make_area_bar_chart
    savefig(img_abs, dpi=80, facecolor=background_color)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 577, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 1476, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2211, in print_figure
    **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 521, in print_png
    FigureCanvasAgg.draw(self)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 469, in draw
    self.figure.draw(self.renderer)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 1085, in draw
    func(*args)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2110, in draw
    a.draw(renderer)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/collections.py", line 772, in draw
    Collection.draw(self, renderer)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/collections.py", line 312, in draw
    mpath.Path(offsets), transOffset, tuple(facecolors[0]))
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 124, in draw_markers
    return self._renderer.draw_markers(*kl, **kw)
OverflowError: Allocated too many blocks


I tryed to set the file miniconda3/envs/qiime1/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc and set the backend from Qt4Agg to agg but it return the same error.

Do you have any ideas?

Thank you in advance.

Best regards

Salvatore

justink

unread,
Jun 16, 2017, 12:45:06 AM6/16/17
to Qiime 1 Forum
Sounds like maybe just too large a task for your machine. Try filtering your observation table (with filter_otus_from_otu_table.py or some other way) until it's fairly small in samples and observations. If that works, then it might just be a data too large issue.

salvatore lachina

unread,
Jun 17, 2017, 11:52:00 AM6/17/17
to Qiime 1 Forum
Hi Justin,

thank you for reply. I followed your advice but I take another type of error. This is the output after ran summarize_taxa_through_plots.
py.

What do you think about this?


*** ERROR RAISED DURING STEP: Plot Taxonomy Summary
Command run was:
 plot_taxa_summary.py -i Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_hight_confidence_sorted_L2.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_hight_confidence_sorted_L3.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_hight_confidence_sorted_L4.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_hight_confidence_sorted_L5.txt,Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots/observation_table_sorted_hight_confidence_sorted_L6.txt -o Scrivania/Salvo/shotgun/pear_assembly/reverse_blat_mapped/ko_summary_plots//taxa_summary_plots/
Command returned exit status: 1
Stdout:

Stderr
Traceback (most recent call last):
  File "/home/salvatore/miniconda3/envs/qiime2.7/bin/plot_taxa_summary.py", line 4, in <module>
    __import__('pkg_resources').run_script('qiime==1.9.1', 'plot_taxa_summary.py')
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 744, in run_script
   
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 1499, in run_script
   
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/plot_taxa_summary.py", line 278, in <module>
    main()
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/plot_taxa_summary.py", line 274, in main
    resize_nth_label, label_type, include_html_legend)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 1138, in make_all_charts
    resize_nth_label, label_type, include_html_legend))
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 984, in get_counts
    chart_type, False)
  File "/home/salvatore/miniconda3/envs/qiime2.7/lib/python2.7/site-packages/qiime/plot_taxa_summary.py", line 715, in get_fracs
    frac = float(n) / total
ZeroDivisionError: float division by zero

Thank you in advance.

Salvatore

justink

unread,
Jun 18, 2017, 9:21:07 PM6/18/17
to Qiime 1 Forum
Hmm, now I think it's an issue with non-integer OTU table counts. Would you post the output of 'biom summarize-table -i observation_table_sorted.biom' ?

salvatore lachina

unread,
Jun 19, 2017, 3:47:08 AM6/19/17
to Qiime 1 Forum
Hi Justin,

this is the output from biom summarize_table.

What do you think?

Best,

Salvatore
table_summary.txt

justink

unread,
Jun 19, 2017, 4:46:30 PM6/19/17
to Qiime 1 Forum
Well, that says you have about 40 000 samples, most of which have zero sequences. So I think that's the problem. I think you've basically got a transposed table—your 'samples' are actually individual sequences.

I think go back to the earlier steps and make sure at each step you have the correct number of samples. Maybe give tutorial data a try as well to make sure that works fine.


salvatore lachina

unread,
Jun 19, 2017, 5:38:55 PM6/19/17
to Qiime 1 Forum
Hi Justin,

this analysis is a shotgun metagenome on a single sample. To do this I followed this tutorial "http://qiime.org/tutorials/shotgun_analysis.html"
 after assembled my reads by using PEAR.

In detail I runned this commands:

run_pear.pl 

readFilter.pl

run_fastq_to_fasta.pl

parallel_map_reads_to_reference.py

sort_otu_table.py

summarize_taxa_through_plots.py

The first three scripts came from the microbiome_helper repository on github by Morgan Langill.

I am very interested to perform a functional analysis by using KO or other functional database (do you have any suggestion about database or a pipeline?)

What do you think about this pipeline?

Any suggestion?

Thank you very much for your help

Best,

Salvatore

justink

unread,
Jun 21, 2017, 5:58:20 PM6/21/17
to Qiime 1 Forum
Salvatore, sorry I missed your reply.

I think there'll be a bunch of strange effects because you've got only one sample. Area plots for example draw lines between samples. I'm not sure qiime is really the best tool here.

But, I think if you're trying to get e.g. a single bar representing taxonomy for your one sample, that should work. Take a look at the input to parallel_map_reads_to_reference.py—I think that's in a bad format. The output of parallel_map_reads_to_reference.py should be a biom table with exactly one sample.
Reply all
Reply to author
Forward
0 new messages