View source: R/calc-diversity.R
plot_rarefaction | R Documentation |
This method involves calculating species diversity for different sized samples generated by randomly downsampling each cluster. By default the bootstrapped 95% confidence interval will also be plotted.
plot_rarefaction(
input,
data_col,
cluster_col = NULL,
method = "richness",
n_boots = 50,
chain = NULL,
chain_col = global$chain_col,
sep = global$sep,
plot_colors = NULL,
plot_lvls = names(plot_colors),
panel_nrow = NULL,
panel_scales = "free",
ci_alpha = 0.15,
n_label = "legend",
label_params = list(),
...
)
input |
Single cell object or data.frame containing V(D)J data. If a data.frame is provided, the cell barcodes should be stored as row names. |
data_col |
meta.data column containing values to use for calculating diversity |
cluster_col |
meta.data column containing cluster IDs to use for grouping cells when calculating clonotype abundance |
method |
Method to use for calculating diversity, available methods include:
|
n_boots |
Number of bootstrap replicates for calculating standard error, if n_boots is 0 this will be skipped. |
chain |
Chain to use for calculating diversity. To calculate diversity for a single chain, the column passed to the data_col argument must contain per-chain data such as CDR3 sequences. Set to NULL to include all chains. |
chain_col |
meta.data column containing chains for each cell |
sep |
Separator used for storing per-chain V(D)J data for each cell |
plot_colors |
Character vector containing colors for plotting |
plot_lvls |
Character vector containing levels for ordering |
panel_nrow |
The number of rows to use for arranging plot panels |
panel_scales |
Should scales for plot panels be fixed or free. This passes a scales specification to ggplot2::facet_wrap, can be 'fixed', 'free', 'free_x', or 'free_y'. 'fixed' will cause panels to share the same scales. |
ci_alpha |
Transparency to use when plotting 95% confidence interval |
n_label |
Location on plot where n label should be added, this can be any combination of the following:
|
label_params |
Named list providing additional parameters to modify n label aesthetics, e.g. list(size = 4, color = "red") |
... |
Additional arguments to pass to ggplot2, e.g. color, fill, linetype, etc. |
ggplot object
calc_diversity()
, plot_diversity()
# Plot rarefaction curve for each cluster
plot_rarefaction(
vdj_sce,
data_col = "clonotype_id",
cluster_col = "orig.ident",
method = "shannon"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.