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

collapse bar charts based on metadata categories #44

Open jennomics opened 9 years ago

jennomics commented 9 years ago

I would like to be able to collapse or merge bar charts based on my metadata categories. For example, if I have a male/female category, I'd like to be able to produce 2 bar charts that summarize the data for those categories. Is this currently a feature?

hollybik commented 9 years ago

Right now you would need to use the donut charts to summarize based on non-numerical metadata such as male/female labels (but that doesn't give you a bar chart - I agree that we should add this feature to the taxonomy bar charts in the future).

Two options - you could re-code Male/Female as numerical values (e.g. 1 and 0) in your mapping file and then do "biom add-metadata" to regenerate the file for use in Phinch. Then you'd be able to view the summarized bar charts with using these numerical values in the "Attributes Column Chart"

The second option is to summarize by category command in QIIME, so first run:

summarize_otu_by_cat.py -m mapping_file.txt -i originalBIOM.biom -c MappingFileColumnName -o SummarizedBIOM.biom

Then you'll need to do "biom add-metadata" again, with a new mapping file containing only two lines (one for male, one for female since these would be your new sample IDs I think

I know its a workaround, but hope this helps?

jennomics commented 9 years ago

Phinch gets hung up when I try to load the merged table. It works for the QIIME summarize_taxa_through_plots.py script, so I know it's in good shape...

On Tue, Jan 13, 2015 at 9:24 AM, hollybik notifications@github.com wrote:

Right now you would need to use the donut charts to summarize based on non-numerical metadata such as male/female labels (but that doesn't give you a bar chart - I agree that we should add this feature to the taxonomy bar charts in the future).

Two options - you could re-code Male/Female as numerical values (e.g. 1 and 0) in your mapping file and then do "biom add-metadata" to regenerate the file for use in Phinch. Then you'd be able to view the summarized bar charts with using these numerical values in the "Attributes Column Chart"

The second option is to summarize by category command in QIIME, so first run:

summarize_otu_by_cat.py -m mapping_file.txt -i originalBIOM.biom -c MappingFileColumnName -o SummarizedBIOM.biom

Then you'll need to do "biom add-metadata" again, with a new mapping file containing only two lines (one for male, one for female since these would be your new sample IDs I think

I know its a workaround, but hope this helps?

— Reply to this email directly or view it on GitHub https://github.com/PitchInteractiveInc/Phinch/issues/44#issuecomment-69782642 .

hollybik commented 9 years ago

Can you just clarify what you mean by "merged table"? Do you mean that you tried the second option I mentioned, the summarize_otu_by_cat.py? Not sure what the issue is here...if you're still having problems you can email me the problematic BIOM file and I'll look into this further.

jennomics commented 9 years ago

Yep, I tried the second option. I'll send it tomorrow. Well, later..,

Sent from my iPhone

On Jan 28, 2015, at 1:18 AM, hollybik notifications@github.com wrote:

Can you just clarify what you mean by "merged table"? Do you mean that you tried the second option I mentioned, the summarize_otu_by_cat.py? Not sure what the issue is here...if you're still having problems you can email me the problematic BIOM file and I'll look into this further.

— Reply to this email directly or view it on GitHub.