Hello everybody, I'm trying to add metadata to a JSON-formatted BIOM file in QIIME 1.9.0 release and I incurred in an error message which I could not understand completely.
The command I'm using to add metadata is:
biom add-metadata -i t.biom -o OUT.biom --observation-metadata-fp t.metadata --observation-header "KO,annotation" --sc-separated "annotation" --sc-pipe-separated "annotation"
The same command produced a correctly formatted BIOM file (with metadata) in QIIME 1.8.0, thus I'm guessing that something changed in the latest QIIME 1 release
t.biom and t.metadata are attached.
The error traceback is as follows:
Traceback (most recent call last):
File "/opt/miniconda3/envs/qiime_1_9_0/bin/biom", line 11, in <module>
sys.exit(cli())
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/biom/cli/metadata_adder.py", line 114, in add_metadata
write_biom_table(result, fmt, output_fp)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/biom/cli/util.py", line 35, in write_biom_table
table.to_hdf5(f, biom.parse.generatedby())
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/biom/table.py", line 4123, in to_hdf5
self.group_metadata(axis='observation'), 'csr', compression)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/biom/table.py", line 4095, in axis_dump
formatter[category](grp, category, md, compression)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/biom/table.py", line 277, in general_formatter
vlen_list_of_str_formatter(grp, header, md, compression)
File "/opt/miniconda3/envs/qiime_1_9_0/lib/python2.7/site-packages/biom/table.py", line 341, in vlen_list_of_str_formatter
data[i, :len(value)] = [v.encode('utf8') for v in value]
AttributeError: 'numpy.ndarray' object has no attribute 'encode'
Thank you very much for your help,
Marco Severgnini