PitchInteractiveInc / Phinch

Phinch is an open-source framework for visualizing biological data, funded by a grant from the Alfred P. Sloan foundation. This project represents an interdisciplinary collaboration between Pitch Interactive, a data visualization studio in Oakland, CA, and biological researchers at UC Riverside.
http://phinch.org/
BSD 2-Clause "Simplified" License
149 stars 30 forks source link

Adding metadata converts biom file back to hdf5 in QIIME_1.9 #58

Closed fjmob closed 8 years ago

fjmob commented 8 years ago

Hi,

I have been trying to add metadata to my biom file in MacQIIME v1.9.1. I converted the biom file to json, then added the metadata- but the output file has been converted back to an hdf5 file. I tried converting this back to json, but it seems to have lost the metadata file/returns error messages :(

Here's my script:

biom convert -i otu_table_rarefied204864_Lachnospiraceae-Clostridium_removed.biom -o otu_rare_json.biom --table-type="OTU table" --to-json

biom add-metadata -i otu_rare_json.biom -o OTU_JSON_with_meta.biom --observation-metadata-fp qiime_metadata_new.txt --observation-header SampleID,BarcodeSequence,LinkerPrimerSequence,Treatment,Bulk_or_Rhizo,TimePoint,Description --sc-separated taxonomy

Any tips?

Thanks, Flora

hollybik commented 8 years ago

Hi Flora,

I recommend converting the BIOM files and adding metadata in QIIME 1.8 (if you use Macqiime on a laptop this is as simple as switching the root macqiime folders to change versions of QIIME). Conversion in QIIME 1.9 seems to be generally problematic for many people, although you might want to have a look through the BIOM documentation to see if there is a flag you're missing to retain the JSON format: http://biom-format.org/documentation/adding_metadata.html

Hope you can find a workaround!

Holly

fjmob commented 8 years ago

Hi Holly,

Thanks for replying! I have tried with versions 1.8 and 1.6 but both are producing hdf5 files... will keep trying!

colinbrislawn commented 8 years ago

Using any new version of qiime or the biom-format package, you can convert the HDF5 tables into the old JSON format. This works in qiime 1.9.1:

biom convert -i otu_table.biom -o otu_table_json.biom --table-type="OTU table" --to-json
fjmob commented 8 years ago

Yeah I've done that, but it doesn't seem to work after the metadata has been added... is there a way of keeping the metadata when converting to json?

colinbrislawn commented 8 years ago

Strange. That command kept all my taxonomy and metadata. Are you sure that you have added the metadata to your input file when it was in the HDF5 format? Also, what version of biom-format are you using?

fjmob commented 8 years ago

Actually I've just realised it must have been a problem with the metadata file - I'd been using a .txt file, but it worked when I used the tab-delim version of it. Sorry for the confusion!

colinbrislawn commented 8 years ago

Glad you found this! It's great to get stuff like this working.

I think this issue could be closed: the current version of biom-format does keep the format while adding metadata. Issues with biom could also be tracked in that repo with issues like biocore/biom-format#695

Cheers!

hollybik commented 8 years ago

Agree - closing this issue!