Index Error in make_otu_heatmap.py

83 views
Skip to first unread message

Vini Salazar

unread,
Oct 20, 2016, 1:26:48 PM10/20/16
to Qiime 1 Forum
Hi,

I am getting an IndexError when running make_otu_heatmap.py. I have searched around the forum but couldn't find anything like it.

I am using an OTU table that I generated at phylum level using summarize_taxa.py. A small detail: my .biom output wouldn't be generated when doing this (I did not suppress it).  

When doing the heatmap, I had to erase all metadata columns except #SampleID, because I would get value errors saying they couldn't convert strings (content of the columns) to float, meaning I could only keep my #SampleID and taxa abundance columns. (see below):

(qiime1) h185-138:heatmap viniWS$ make_otu_heatmap.py -i summary/test4/map_silva_L2.txt -o ./test4.pdf  -t ../rep_set.tre -m ../map_silva.txt --no_log_transform


Traceback (most recent call last):


  File "/Users/viniWS/anaconda2/envs/qiime1/bin/make_otu_heatmap.py", line 4, in <module>


    __import__('pkg_resources').run_script('qiime==1.9.1', 'make_otu_heatmap.py')


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/setuptools-25.1.6-py2.7.egg/pkg_resources/__init__.py", line 719, in run_script


   


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/setuptools-25.1.6-py2.7.egg/pkg_resources/__init__.py", line 1505, in run_script


   


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/make_otu_heatmap.py", line 254, in <module>


    main()


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/make_otu_heatmap.py", line 148, in main


    otu_table = load_table(opts.otu_table_fp)


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/biom_format-2.1.5-py2.7-macosx-10.5-x86_64.egg/biom/parse.py", line 654, in load_table


    table = parse_biom_table(fp)


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/biom_format-2.1.5-py2.7-macosx-10.5-x86_64.egg/biom/parse.py", line 408, in parse_biom_table


    t = Table.from_tsv(fp, None, None, lambda x: x)


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/biom_format-2.1.5-py2.7-macosx-10.5-x86_64.egg/biom/table.py", line 3893, in from_tsv


    t_md_name) = Table._extract_data_from_tsv(lines, **kwargs)


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/biom_format-2.1.5-py2.7-macosx-10.5-x86_64.egg/biom/table.py", line 4036, in _extract_data_from_tsv


    values = list(map(dtype, fields[1:]))


ValueError: could not convert string to float: CGGTGTT



Is that right? After doing that, I tried running the script with a formatted OTU table containing only my #SampleID and taxa abundance columns.

This is the error I am getting now:

(qiime1) h185-138:heatmap viniWS$ make_otu_heatmap.py -i phylum_table.biom -o ./test4.pdf  -t ../rep_set.tre -m ../map_silva.txt --no_log_transform


Traceback (most recent call last):


  File "/Users/viniWS/anaconda2/envs/qiime1/bin/make_otu_heatmap.py", line 4, in <module>


    __import__('pkg_resources').run_script('qiime==1.9.1', 'make_otu_heatmap.py')


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/setuptools-25.1.6-py2.7.egg/pkg_resources/__init__.py", line 719, in run_script


   


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/setuptools-25.1.6-py2.7.egg/pkg_resources/__init__.py", line 1505, in run_script


   


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/make_otu_heatmap.py", line 254, in <module>


    main()


  File "/Users/viniWS/anaconda2/envs/qiime1/lib/python2.7/site-packages/qiime-1.9.1-py2.7.egg-info/scripts/make_otu_heatmap.py", line 193, in main


    map_sample_ids = zip(*metadata[0])[0]


IndexError: list index out of range



And I couldn't move past it. I am attaching both of my OTU tables, the output from summarize_taxa.py with all metadata (map_silva_L2.txt) and the formatted one with only #SampleID and taxa abundance (phylum_table.biom).

Any ideas?


Thanks!
phylum_table.biom
map_silva_L2.txt

Jamie Morton

unread,
Oct 21, 2016, 1:11:01 AM10/21/16
to Qiime 1 Forum
Hmm.  That is interesting.  Looks like your biom is flipped.

When I try running the following commands

biom summarize-table -i phylum_table.biom


biom summarize-table -i phylum_table.biom  --observations

The phyla are labeled as samples, and the samples are labeled as phyla.

How did you run the summarize_taxa.py? (i.e. what did the original biom table look like?)


It is also important to note that the `-i` option requires a biom table, so your second command is correct.  


Best,

Jamie

Reply all
Reply to author
Forward
0 new messages