Plugin error from diversity: Cannot infer number of levels from empty list

New user here. I’ve filtered and clustered my data in DADA2 standalone (my sequencing run had multiple amplicons I needed to handle separately) and imported it into QIIME2 as a BIOM 2.1 file for taxonomic assignment and visualisations. Almost everything is working as expected, However when I enter:

qiime diversity alpha-rarefaction
–i-table table.qza
–i-phylogeny rooted-tree.qza
–p-max-depth 4000
–m-metadata-file test_metadata.tsv
–o-visualization alpha-rarefaction.qzv

I get the following error message message:

Plugin error from diversity: Cannot infer number of levels from empty list

Can someone help me identify (and fix) the problem?

Thanks so much!

HI @jelly_fan,
Could you please share the complete error traceback? (you can re-run the command with --verbose added to the end of the command to see the full error)

Please also run qiime feature-table summarize on your feature table and share the results (you can send directly to me if these are sensitive data). I suspect either you may be using a higher max-depth than there are sequences in any single sample or else there is something wrong with the phylogeny.

Let’s start there and see where it takes us!

Thank you for you for the quick response! I really appreciate it.

When I entered the verbose command I didn't get any additional information. However, when I re-ran the command without the verbose command the server logged some debug information to file. Hopefully this is what you need / helps:

Traceback (most recent call last):
File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2cli/", line 246, in call
results = action(**arguments)
File "", line 2, in alpha_rarefaction
File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/", line 228, in bound_callable
output_types, provenance)
File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/", line 424, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2_diversity/_alpha/", line 328, in alpha_rarefaction
[(c, '') for c in metadata_df.columns])
File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/pandas/core/indexes/", line 1189, in from_tuples
raise TypeError(msg)
TypeError: Cannot infer number of levels from empty list

I don't think my data is sensitive. (The community data came from wild fish - so no data privacy issues!). Here is the table summary:

table_summary.qzv (360.8 KB)


This error message is pretty helpful, and this is a new error for me — it looks like there is an issue somehow related to your metadata. Can you please send test_metadata.tsv along when you get a chance? Thanks! :qiime2:

Thank you for looking into this further for me.

Glad the output was useful.

Here is the .tsv file. It's the bare minimum, just sample IDs - I wanted to keep everything as simple as possible while running a pilot pipeline.

test_metadata.tsv (2.2 KB)

Ah ha! Thanks for the metadata, @jelly_fan! I see the issue — your metadata has no defined metadata columns, effectively it is just a list of IDs, or, empty metadata.

To get you moving forward right now, you can just run this command sans metadata and get the exact same results:

qiime diversity alpha-rarefaction \
  --i-table table.qza \
  --i-phylogeny rooted-tree.qza \
  --p-max-depth 4000 \
  --o-visualization alpha-rarefaction.qzv

I have opened an issue on the relevant bug tracker to make sure that this viz gracefully handles empty metadata in the future.

As well, I would suggest taking a read through the Metadata Tutorial!

Good luck! :t_rex: :qiime2:

1 Like


Just wanted to confirm my rarefaction curves came out nicely with your code, and also when I added in some relevant metadata - the original command started working too.

Thank you for all your help (and developing such a good program).


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.