qiime2 :Plugin error from feature-table: list index out of range

Hi, I am a new qiime2 user, i met an error when i conducted following code: qiime feature-table summarize
–i-table table.qza --o-visualization table.qzv
–m-sample-metadata-file metadatadeep.tsv
the error is:
Plugin error from feature-table:
list index out of range
i thought my metadatafile had some mistake, however ,i could succeffully run :
qiime taxa barplot
–i-table table.qza
–i-taxonomy taxonomy.qza
–m-metadata-file metadatadeep.tsv
–o-visualization taxa-bar-plots.qzv
so i am very confused, someone could help me? thanks a lot!!!
The delog file:
/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2_feature_table/_summarize/_visualizer.py:122: FutureWarning: The signature of Series.to_csv was aligned to that of DataFrame.to_csv, and argument ‘header’ will change its default value from False to True: please pass an explicit value to suppress this warning.
os.path.join(output_dir, ‘sample-frequency-detail.csv’))
/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2_feature_table/_summarize/_visualizer.py:124: FutureWarning: The signature of Series.to_csv was aligned to that of DataFrame.to_csv, and argument ‘header’ will change its default value from False to True: please pass an explicit value to suppress this warning.
os.path.join(output_dir, ‘feature-frequency-detail.csv’))
Traceback (most recent call last):
File “/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2cli/commands.py”, line 328, in call
results = action(**arguments)
File “</home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/decorator.py:decorator-gen-326>”, line 2, in summarize
File “/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 245, in bound_callable
output_types, provenance)
File “/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 452, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File “/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2_feature_table/_summarize/_visualizer.py”, line 156, in summarize
sample_frequencies
File “/home/wanghuilin/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2_feature_table/_summarize/_vega_spec.py”, line 106, in vega_spec
‘value’: metadata_categories[0]
IndexError: list index out of range

The error implies that your metadata has no metadata columns in it - can you please share your metadata file? You can send me a download link in a direct message if you don’t want to share on this topic thread. Thanks!

2 Likes

Thank you for you reply. Here is my metadata file.metadatadeep.tsv (43 Bytes)
The file only contains ID column.

1 Like

Hi @whl! The problem seems to be due to the definition of “column” – the qiime feature-table summarize visualizer requires that your metadata file has at least one column besides the ID column, because it uses this other column as a default value when creating a visualization. Long story short: if you add in another column to your metadata file in addition to the ID column, I bet summarize will work. (You could even just add another column named sample-id-2 or something that is identical to the first column and it should still work, but I’d recommend adding a more meaningful column if possible.)

In general, having a metadata file that contains only the sample IDs will cause you problems (edit: although it is technically allowed by QIIME 2, see here). Many programs will assume that your metadata has at least two columns – they’ll use the first column, which contains sample IDs, as the “index” of the metadata, and then consider all of the other columns as the only “columns” in the metadata file. This makes sense, since the first column in a metadata file doesn’t actually contain any “metadata” – it doesn’t tell us anything new about the samples, since the sample IDs are already present in the feature table. So I’m guessing you’ll likely run into this type of error with at least a few other QIIME 2 plugins, or with other software tools. (Also, the more information you have in your metadata file, the easier it will be to visualize and analyze your data!)

The reason qiime taxa barplot worked for you is that that visualizer doesn’t directly try to look at any of the metadata columns – instead, it just tries to “merge” the metadata, including the ID column, into the table. (If you’re interested, the Python code where this is done is here. :snake:) Since this doesn’t assume that the metadata file has other columns, it works with metadata files that only have the ID column – but I don’t think this is an assumption you can make safely with other programs.

Let us know if adding another column to your metadata file solves this problem! :qiime2:

2 Likes

I shall say your advice is perfectly correct!It worked. Thank you very much for your help!

1 Like