Transforming Metaphlan Relative Abundance Data For Visualization

Metaphlan is a tool for profiling the relative abundance of microbial taxa in genomic data. The output needs additional processing before it can be used to create compositional stacked bar charts or to input into R to create a phyloseq object.

I made some python functions for cleaning the data and making a compositional plot using Bokeh and also to convert the data into dataframes to import into R.

I spent a bit of time figuring out how best to handle the data for plotting so hopefully my approach can save some time as I found a couple of questions online proving I wasn’t the only one wondering how.

Jupyter notebook outlining the steps and script can be followed on my github.

Compositional plot example made in python’s bokeh.
Compositional plot sample made in R’s phyloseq.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.