This function plots the Renyi Entropy or Hill Diversity at any repertoire level for all the samples in the dataset. The alpha parameters can be personalized, thus allowing to focus on certain indices such as the Shannon index for alpha=1 or the Simpson index for alpha=2.
Arguments
- x
an object of class
RepSeqExperiment
- alpha
a numerical vector specifying the alpha values to compute. If not specified, the following values are estimated: c(0, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, Inf).
- level
a character specifying the level of the repertoire to be taken into account when calculating VJ usages. Should be one of "aaClone","ntClone", "V", "J", "VJ", "ntCDR3" or "aaCDR3".
- Hill
a boolean if TRUE the Hill's index is computed.
- colorBy
a character indicating a column name in mData. Colors are thus attributed to the different groups within this column. The chosen column must be of class factor.
- facetBy
a vector of character indicating one or two column names in mData to apply a facet on.
- grouped
a boolean indicating whether or not the mean and se of samples belonging to the same experimental group specified in the ColorBy parameter should be calculated. Grouping will be performed on the group chosen in the colorBy parameter. Default is FALSE.
- label_colors
a list of colors for each variable in ColorBy. See
plotColors
. If NULL, default colors are used.
Details
Hill diversity uses a parameter q to adjust how species are count. If q=0, it just counts the number of species (species richness). If q=1, it gives equal weight to all species, balancing rare and common ones. If q=2, it focuses more on the most common species. Rényi diversity is a generalization of the Shannon index. It also uses a parameter alpha that works similarly. When alpha is small, it gives more weight to rare species. When alpha is large, it focuses more on the dominant species. Alpha =1 is an approximation of the Shannon index; alpha = 2 corresponds to the Simpson index and alpha=Inf corresponds to the Berger-Parker index. The main difference is that Hill diversity is designed to give “effective species numbers” i.e. how many equally abundant species would give the same diversity, while Rényi diversity is based on entropy and doesn't directly translate to species counts. Both are useful for exploring how diversity changes depending on whether you care more about rare or common species.
Examples
data(RepSeqData)
plotRenyiIndex(x = RepSeqData,
alpha = c(0, 1, 2, 8, 16, 32, 64),
level = "V",
colorBy = "sex")
#> Error in plotRenyiIndex(x = RepSeqData, alpha = c(0, 1, 2, 8, 16, 32, 64), level = "V", colorBy = "sex"): could not find function "plotRenyiIndex"
plotRenyiIndex(x = RepSeqData,
alpha = c(0, 1, 2, 8, 16, 32, 64),
level = "V",
colorBy = "sample_id")
#> Error in plotRenyiIndex(x = RepSeqData, alpha = c(0, 1, 2, 8, 16, 32, 64), level = "V", colorBy = "sample_id"): could not find function "plotRenyiIndex"
plotRenyiIndex(x = RepSeqData,
level = "J",
colorBy = "cell_subset",
grouped=TRUE)
#> Error in plotRenyiIndex(x = RepSeqData, level = "J", colorBy = "cell_subset", grouped = TRUE): could not find function "plotRenyiIndex"
plotRenyiIndex(x = RepSeqData,
level = "J",
colorBy = "sex",
facetBy= "cell_subset",
grouped=TRUE, Hill=TRUE)
#> Error in plotRenyiIndex(x = RepSeqData, level = "J", colorBy = "sex", facetBy = "cell_subset", grouped = TRUE, Hill = TRUE): could not find function "plotRenyiIndex"
plotRenyiIndex(x = RepSeqData,
level = "J",
colorBy = "sample_id",
grouped=FALSE)
#> Error in plotRenyiIndex(x = RepSeqData, level = "J", colorBy = "sample_id", grouped = FALSE): could not find function "plotRenyiIndex"