What is the best way to calculate the biological diversity of samples from bacterial/viral OTU tables?
I mostly concur with @Nathan's answer, and in particular with the references he provided.

As Shannon &amp; Simpson indices can be hard to interpret and can be non-intuitive, I prefer using Hill diversities as suggested by Nathan (the Jost 2006 and 2007 refs are great to read up on this). The main argument is that Hill diversities give effective number of species that are comparable between samples and follow the duplication principle.

Hill diversities rely on a unified formula (see this wikipedia article) with one parameter, q. Increasing values for q correspond to increasing weighting of taxa abundances in the diversity calculation:


D with q=0 does not account for taxon abundance, so is just the number of taxa, or richness
D with q=1 is not defined, but asymptotically approximated by e^H where H is the Shannon entropy. D_q1 is the effective number of species with abundance weights.
D with q=2 corresponds to the Inverse Simpson index (1/D_Simpson). D_q2 weighs more abundant taxa even more strongly.


One can choose any value for q (with q=1 with the limit e^H), and comparing diversity estimates for varying q can give you an idea of sample evenness. Setting q=∞ gives the Berger-Parker index (the fraction of individuals in the sample belonging to the most abundant species).

Importantly, for alpha div analyses on (16S/18S-based) OTUs, I would always generate rarefaction curves first, and then generate diversity estimates at a common, rarefied number of reads per sample.

You can do most of this using the R package vegan. The phyloseq package provides various alpha div estimates in one command, but no Hill diversities. I've written a few simple functions to perform rarefaction and calculate (rarefied or non-rarefied) Hill diversities from an OTU count table matrix:

function.rarefaction.R

function.alpha_diversity.R