One taxa barplot into many?

Hi!

I have generated a taxa barplot for 56 samples, everything went smoothly.

However, now I would like to separate each of those samples and put them into their own plot (so I would have 56 individual taxa barplots instead of one w/ 56 samples). Is this possible?

Thanks!

Hi @Alyssa_Cochran,

If you want to do this in QIIME, you could use the qiime feature-table filter-samples function to get a single sample, and then generate the bar chart. (You could also use this in general to separate by say, group.)

The other option I can come up with would be to export your data to your favorite plotting program, and generate them there. Depending on what your inclination is, you might be able to script that. If you're a python or R-user, there are direct interfaces. You could also potentially extract your table to a text file, and then import into something like excel, SAS, prisma, etc.

I don't think there is a more automated way to do this, but @colinbrislawn tends to have more creative solutions qiime-y than I do. (:qiime2:-man seems to be his not-so-secret superhero identity.)

Best,
Justine

2 Likes

Hello Alyssa,

I like Justine's suggestion of building this graph in R or python, as these include fully flexible plotting libraries. I don't know how you could do this using Qiime... :crying_cat_face:


Have you used R? If you have, I would recommend checking out the phyloseq packages for building graphs like this. It includes excellent tutorials that do almost exactly what you are looking for.
https://joey711.github.io/phyloseq/plot_bar-examples.html#enterotypes_dataset_examples

When you said

separate each of those samples and put them into their own plot

I immediately thought of the facet_wrap() function in ggplot2 that will make all these individual graphs for each sample. You could use it like this:

plot_bar(phyloseqdata, "Genus", fill="Family") + facet_wrap(~X.SampleID) 

Colin

1 Like

Thanks for the replies!

I like that idea too. I tend to sway towards python, but I was just wondering if there was an easy way to do this in qiime before I played around with something else.

Thanks!

2 Likes

You could do it in python too! After all, qiime includes python APIs and your can use a python graphing library like seaborn to make facets.

https://seaborn.pydata.org/generated/seaborn.FacetGrid.html

>>> att = sns.load_dataset("attention")
>>> g = sns.FacetGrid(att, col="subject", col_wrap=5, height=1.5)
>>> g = g.map(plt.plot, "solutions", "score", marker=".")

Or plotly: https://plot.ly/python/facet-plots/

Let me know what you find!

Colin

2 Likes

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