Plot diversity distributions (density) by sample type
Source:R/generate_plots.R
plot_diversity_density.RdPlot diversity distributions (density) by sample type
Arguments
- se
A `SummarizedExperiment` returned by `calculate_diversity`.
- assay_name
Name of the assay to use (default: "diversity").
- sample_type_col
Optional column name in `colData(se)` with sample types. If missing, sample types are inferred from column names (suffix after the last underscore) or set to 'Group'.
Examples
data("tcga_brca_luma", package = "TSENAT")
rc <- as.matrix(tcga_brca_luma[1:100, -1, drop = FALSE])
gs <- tcga_brca_luma[1:100, 1]
se <- calculate_diversity(rc, gs, q = 0.1, norm = FALSE)
# Manually set sample_type in colData for plotting
SummarizedExperiment::colData(se)$sample_type <-
factor(gsub(".*_", "", colnames(rc)))
plot_diversity_density(se)