R: Calculate clonal alpha diversity

alphaDiversity {alakazam} | R Documentation

## Calculate clonal alpha diversity

### Description

`alphaDiversity` takes in a data.frame or AbundanceCurve and computes diversity scores (D) over an interval of diversity orders (q).

### Usage

    alphaDiversity(data, min_q = 0, max_q = 4, step_q = 0.1, ci = 0.95,
      ...)

### Arguments

`data` | data.frame with Change-O style columns containing clonal assignments or a AbundanceCurve generate by estimateAbundance object containing a previously calculated bootstrap distributions of clonal abundance.
`min_q` | minimum value of q.
`max_q` | maximum value of q.
`step_q` | value by which to increment q.
`ci` | confidence interval to calculate; the value must be between 0 and 1.
`...` | additional arguments to pass to estimateAbundance. Additional arguments are ignored if a AbundanceCurve is provided as input.

### Details

Clonal diversity is calculated using the generalized diversity index (Hill numbers) proposed by Hill (Hill, 1973). See calcDiversity for further details.

Diversity is calculated on the estimated complete clonal abundance distribution. This distribution is inferred by using the Chao1 estimator to estimate the number of seen clones, and applying the relative abundance correction and unseen clone frequency described in Chao et al, 2015.

To generate a smooth curve, D is calculated for each value of q from `min_q` to `max_q` incremented by `step_q`. When `uniform=TRUE` variability in total sequence counts across unique values in the `group` column is corrected by repeated resampling from the estimated complete clonal distribution to a common number of sequences.

The diversity index (D) for each group is the mean value of over all resampling realizations. Confidence intervals are derived using the standard deviation of the resampling realizations, as described in Chao et al, 2015.

Of note, the complete clonal abundance distribution is inferred by using the Chao1 estimator to estimate the number of seen clones, and then applying the relative abundance correction and unseen clone frequencies described in Chao et al, 2015.

### Value

A DiversityCurve object summarizing the diversity scores.

### References

1. Hill M. Diversity and evenness: a unifying notation and its consequences. Ecology. 1973 54(2):427-32.

2. Chao A. Nonparametric Estimation of the Number of Classes in a Population. Scand J Stat. 1984 11, 265270.

3. Chao A, et al. Rarefaction and extrapolation with Hill numbers: A framework for sampling and estimation in species diversity studies. Ecol Monogr. 2014 84:45-67.

4. Chao A, et al. Unveiling the species-rank abundance distribution by generalizing the Good-Turing sample coverage theory. Ecology. 2015 96, 11891201.

### See Also

See calcDiversity for the basic calculation and DiversityCurve for the return object. See plotDiversityCurve for plotting the return object.

### Examples

    # Group by sample identifier in two steps
    abund <- estimateAbundance(ExampleDb, group="SAMPLE", nboot=100)
    div <- alphaDiversity(abund, step_q=1, max_q=10)
    plotDiversityCurve(div, legend_title="Sample")

    # Grouping by isotype rather than sample identifier in one step
    div <- alphaDiversity(ExampleDb, group="ISOTYPE", min_n=40, step_q=1, max_q=10,
                          nboot=100)
    plotDiversityCurve(div, legend_title="Isotype")

[Package alakazam version 0.3.0 Index]