calculateDiversity | R Documentation |
This function uses various methods to estimate the clonotypic diversity of samples based on a matrix of clonotype abundances (samples are columns).
calculateDiversity(x, ...)
## S4 method for signature 'clonoStats'
calculateDiversity(
x,
methods = c("all", "nCells", "nClonotypes", "shannon", "normentropy", "invsimpson",
"ginisimpson", "chao1", "chaobunge"),
...
)
## S4 method for signature 'SingleCellExperiment'
calculateDiversity(x, ...)
x |
A matrix of abundance values where rows are features (clonotypes)
and columns are samples. This is created with |
... |
Additional arguments passed to external calculation methods. |
methods |
A character vector specifying which diversity measures to use
(default = |
Available methods are total cells with appropriate TCR data
('nCells'
, not a diversity measure, but a useful point of
comparison), total clonotypes ('nClonotypes'
), Shannon entropy
('shannon'
), Simpson index ('simpson'
), inverse Simpson index
('invsimpson'
), Chao1 richness ('chao1'
), and Chao-Bunge
richness ('chaobunge'
). A special value of 'all'
is also
allowed, which will run all methods listed above.
The 'chao1'
and 'chaobunge'
estimates assume all
abundances are integers. When this is not the case for the input matrix,
k
, all values are multiplied by the scaling_factor
and
rounded to the nearest integer. The resulting estimate is then divided by
scaling_factor
to return to the original scale. The
'shannon'
, 'simpson'
, and 'invsimpson'
methods work
with any input type.
A matrix of diversity estimates for each sample. Note that the
'chaobunge'
method also includes an estimate of the standard error.
data('contigs')
x <- clonoStats(contigs)
calculateDiversity(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.