This function computes a set of diversity indices of a repertoire level for each sample.
The calculated indices are the following:
- Shannon index: Calculates the proportional abundance of species in a repertoire (Shannon, 1948).
- Simpson index: Takes into account the number of species present as well as their abundance. It gives relatively little weight to the rare species and more weight to the frequent ones (Simpson, 1949).
- Inverse Simpson index: Is the effective number of species that is obtained when the weighted arithmetic mean is used to quantify average proportional abundance of species.
- Berger-Parker index: Expresses the proportional importance of the most abundant species. This metric is highly biased by sample size and richness (Berger and Parker 1970).
- Gini coefficient: Measures the degree of inequality in a distribution of abundances (Gini, 1921).
Usage
diversityIndices(
x,
level = c("aaClone", "ntClone", "V", "J", "VJ", "ntCDR3", "aaCDR3")
)
Arguments
- x
an object of class
RepSeqExperiment
- level
a character specifying the level of the repertoire on which the diversity should be estimated. Should be one of "aaClone","ntClone", "V", "J", "VJ", "ntCDR3" or "aaCDR3".
Examples
data(RepSeqData)
diversityIndices(RepSeqData, level="V")
#> sample_id shannon simpson invsimpson bergerparker gini
#> <char> <num> <num> <num> <num> <num>
#> 1: tripod-30-813 4.042 0.977 42.656 2.76 0.56
#> 2: tripod-30-815 4.033 0.976 41.479 2.68 0.57
#> 3: tripod-31-846 4.064 0.977 44.097 2.84 0.55
#> 4: tripod-31-848 4.022 0.976 40.932 2.67 0.55
#> 5: tripod-35-970 4.037 0.975 39.528 2.41 0.54
#> 6: tripod-35-972 4.004 0.974 38.769 2.62 0.58
#> 7: tripod-36-1003 4.069 0.977 43.832 2.76 0.54
#> 8: tripod-36-1005 4.064 0.977 43.791 2.76 0.55