plotDensities: Plot densities

View source: R/plotDensities.R

plotDensitiesR Documentation

Plot densities

Description

Plot densities

Usage

plotDensities(
  x,
  cepoOutput,
  nGenes = 2,
  assay = "logcounts",
  celltypeColumn,
  celltype = NULL,
  genes = NULL,
  plotType = c("histogram", "density"),
  color = NULL
)

Arguments

x

a SummarizedExperiment or a SingleCellExperiment object.

cepoOutput

an output from Cepo or doLimma/doVoom/doTtest/doWilcoxon functions

nGenes

number of top genes from each celltype to plot. Default to 2.

assay

a character ('logcounts' by default), indicating the name of the assays(x) element which stores the expression data (i.e., assays(x)$name_assays_expression). We strongly encourage using normalized data, such as counts per million (CPM) or log-CPM.

celltypeColumn

a character, indicating the name of the name of the cell type column in the colData(x).

celltype

a character, indicating the name of the cell type to plot. Default is NULL which selects all celltypes in the cepoOutput.

genes

a character vector, indicating the name of the genes to plot. Default to NULL, so that 2 top genes from each celltype will be plotted.

plotType

Either 'histogram' or 'density'

color

a named color vector. The names should correspond to the celltype argument above

Value

A ggplot object with cell-type specific densities for a gene.

A ggplot object.

Examples

library(SingleCellExperiment)
data('cellbench', package = 'Cepo')
cellbench
cepoOutput <- Cepo(logcounts(cellbench), cellbench$celltype)

plotDensities(
  x = cellbench,
  cepoOutput = cepoOutput,
  assay = 'logcounts',
  plotType = 'histogram',
  celltypeColumn = 'celltype'
)

plotDensities(
  x = cellbench,
  cepoOutput = cepoOutput,
  genes = c('PLTP', 'CPT1C', 'MEG3', 'SYCE1', 'MICOS10P3', 'HOXB7'),
  assay = 'logcounts',
  plotType = 'histogram',
  celltypeColumn = 'celltype'
)

PYangLab/Cepo documentation built on March 6, 2023, 9:01 a.m.