HDF to JSON filtering of samples

Hi everyone, I am running qiime2 on macOS Catalina and have a question regarding biom tables. I have a JSON formatted table and ran the below script to filter out certain samples. After doing this, it changes format to HDF and I’m trying to figure out how to get it back into JSON. Is there an option I can pass this script or another way I can convert this table? I tried the biom-convert function, also below, but receive an error I don’t understand. Thanks

qiime feature-table filter-samples --i-table feature_table.qza --m-metadata-file RISK_metadata_no_mixed.txt --p-where “[Diagnosis]=‘CD’” --o-filtered-table CD-filtered-table.qza

biom convert -i CD-filtered-table.qza -o CD-filtered-table-JSON.biom --to-json
Traceback (most recent call last):
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/bin/biom”, line 11, in
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/biom/cli/table_converter.py”, line 114, in convert
table = load_table(input_fp)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/biom/parse.py”, line 660, in load_table
table = parse_biom_table(fp)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/biom/parse.py”, line 403, in parse_biom_table
c = fp.read(1)
File “/Users/rajeshshah/miniconda3/envs/qiime2-2019.7/lib/python3.6/codecs.py”, line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x93 in position 11: invalid start byte

1 Like

Hi @rajesh512,

Since biom isn’t an official part of QIIME 2, we’ve moved this to the “other bioinformatics tools” part of the forum.


@rajesh512 QZA files are not biom format, so biom cannot parse these. You need to use qiime tools export to export a feature table to biom format first. See the online tutorials at qiime2.org for more details.

Good luck!

1 Like

Thanks Nicholas. So I am clear, the file labeled biom in the extracted QZA file is not actually a biom table. Is that right? I’ll try the above suggestion. Thanks again

The file labeled biom in the extracted QZA file is indeed a biom table. extract and export and unzip are 3 slightly different ways to get a biom table from a FeatureTable[*] artifact.

So, I think I got that point. However, I’m still not able to go from HDF5 to JSON formats. I tried converting the biom file in the extracted folder and still get an empty file with a error/warning similar to the original post. When filtering a table, can I force the resulting table to be json format instead of HDF5? Thanks

if you are doing biom convert -i hdf5-table.biom -o json-table.biom --to-json and getting that error, then this is a biom issue and off-topic for this forum. I am not able to provide support for biom issues.

Why does it matter what the format of the table is inside the artifact? QIIME 2 is happy to work with HDF5 under the hood (unless if you are getting an error that indicates otherwise).

The main reason I’m trying to convert the table format, is to use it with another outside microbiome analysis resource, which is limited to json format. I will try your suggestions and see if that works. Thanks

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