Calculating diversity from relative abundance

Hi,
I’m analyzing shotgun metagenomics data and have read-based relative abundance table (by tools like kraken-braken, metaphlan2 etc). I was wondering if I can use qiime2 to calculate diversity based on relative-abundance table. It seems that some metrics can be calculated from relative abundance (observed OTU, shannon index, Jaccard distance).
Do you know if it should work properly?
Any other suggestions from community members on how to approach it?
Thanks!

Good afternoon,

Yes, this should work fine. The alpha diversity metrics like Shannon and beta diversity metrics like Jaccard will work on any feature-abundance table (regardless if it’s relative abundance, and regardless if it’s amplicon).

Some of the metrics are phylogenetic, namely Faith’s PD and UniFrac. In this case, each feature will have to be placed somewhere on a phylogenetic tree, which is harder for shotgun metagenomics than amplicons, but not impossible.

Colin

1 Like

One slight hiccup is the types are currently over-specific. So qiime diversity alpha/beta will want a FeatureTable[Frequency] since that is a “lowest common denominator” for all of the different measures/metrics.

@ChrisKeefe is currently working on cleaning this up by separating each into their own method so that we can have a more refined notion of the available types. In the meanwhile you would need to lie about the type which I don’t strongly recommend, but a deadline is a deadline sometimes.

5 Likes

Have you made any progress on this? We have MetaPhlAn2 data that we would like to calculate alpha diversity.

Thanks, Sarah Highlander TGen North

Hi @shighlander!
q2-diversity-lib will not be officially released until January 2020, but even in its current form it should allow you to calculate common alpha diversity indices from relative frequency data. (FaithPD, Pielou’s Evenness, Shannon’s Entropy, and Observed Features)

The underlying algorithms are the same as those currently used in q2-diversity. q2-diversity-lib just provides a more robust system of semantic type constraints, slightly improved protections against user error, and method-by-method citations.

If you want to give it a shot, you should probably create a fresh QIIME 2 environment named div-lib or something like that. Once you’ve activated the conda environment you want to use, this should install the package for you:

pip install git+https://github.com/qiime2/q2-diversity-lib.git#egg=q2-diversity-lib

qiime diversity-lib --help will give you a list of available Actions, and qiime diversity-lib [action-name] --help will tell you how to use them.

Good luck, and please let me know if you run into any issues along the way!
Chris

1 Like

Thanks, I’ll give it a try!

Sarah

1 Like