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

phinch won't load mothur-exported BIOM file #48

Open rec3141 opened 9 years ago

rec3141 commented 9 years ago

This is because phinch throws an error on "metadata":null and locks up on the loading screen.

I'm not sure whether this is a mothur problem or a phinch problem, but here is a gnu solution that worked for me:

sed 's#null#{}#g' file-from-mothur.biom > file-for-phinch.biom
rec3141 commented 9 years ago

test-broken.biom { "id":"test", "format": "Biological Observation Matrix 0.9.1", "format_url": "http://biom-format.org", "type": "OTU table", "generated_by": "mothur1.35.1", "date": "Tue Jul 7 03:00:26 2015", "rows":[ {"id":"Otu1419", "metadata":{"taxonomy":["Bacteria", "Proteobacteria", "Gammaproteobacteria", "Enterobacteriales", "Enterobacteriaceae", "Morganella"], "bootstrap":[100, 100, 100, 100, 100, 100]}}, {"id":"Otu1420", "metadata":{"taxonomy":["Bacteria", "Firmicutes", "Bacilli", "Lactobacillales", "Carnobacteriaceae", "Desemzia"], "bootstrap":[100, 100, 100, 100, 100, 100]}}, {"id":"Otu1421", "metadata":{"taxonomy":["Bacteria", "Bacteroidetes", "Bacteroidia", "Bacteroidales", "Porphyromonadaceae", "Butyricimonas"], "bootstrap":[100, 100, 100, 100, 100, 100]}} ], "columns":[ {"id":"Svea_0-1_A", "metadata":null}, {"id":"Svea_1-3_A", "metadata":null}, {"id":"Svea_SW", "metadata":null} ], "matrix_type": "sparse", "matrix_element_type": "int", "shape": [3,3], "data": [[0,0,1], [0,1,1], [0,2,1], [1,0,1], [1,1,1], [1,2,1], [2,0,1], [2,1,1], [2,2,1]] }

test-fixed.biom { "id":"test", "format": "Biological Observation Matrix 0.9.1", "format_url": "http://biom-format.org", "type": "OTU table", "generated_by": "mothur1.35.1", "date": "Tue Jul 7 03:00:26 2015", "rows":[ {"id":"Otu1419", "metadata":{"taxonomy":["Bacteria", "Proteobacteria", "Gammaproteobacteria", "Enterobacteriales", "Enterobacteriaceae", "Morganella"], "bootstrap":[100, 100, 100, 100, 100, 100]}}, {"id":"Otu1420", "metadata":{"taxonomy":["Bacteria", "Firmicutes", "Bacilli", "Lactobacillales", "Carnobacteriaceae", "Desemzia"], "bootstrap":[100, 100, 100, 100, 100, 100]}}, {"id":"Otu1421", "metadata":{"taxonomy":["Bacteria", "Bacteroidetes", "Bacteroidia", "Bacteroidales", "Porphyromonadaceae", "Butyricimonas"], "bootstrap":[100, 100, 100, 100, 100, 100]}} ], "columns":[ {"id":"Svea_0-1_A", "metadata":{}}, {"id":"Svea_1-3_A", "metadata":{}}, {"id":"Svea_SW", "metadata":{}} ], "matrix_type": "sparse", "matrix_element_type": "int", "shape": [3,3], "data": [[0,0,1], [0,1,1], [0,2,1], [1,0,1], [1,1,1], [1,2,1], [2,0,1], [2,1,1], [2,2,1]] }

rec3141 commented 9 years ago

FYI the sed conversion also works for .biom files downloaded from the Earth Microbiome Project, after they've been converted from HDF5 to JSON format with QIIME:

biom convert -i file-from-emp.biom -o file-for-phinch.biom --table-type="OTU table" --to-json
sed -i 's#null#{}#g' file-for-phinch.biom
conle215 commented 9 years ago

So the work around sed 's#null#{}#g' file_name.unique.good.filter.phylip.nn.unique.biom > file_name.unique.biom

works and i'm able to load my data into the parse screen, but when I try to proceed and pick a chart, it just loads forever again.

Any ideas?