IdentPlotQC: QC plot with cell type highlight

View source: R/IdentPlotQC.R

IdentPlotQCR Documentation

QC plot with cell type highlight

Description

This function makes interactive quality control (QC) plots from a Seurat object, by default percent.mito vs nFeature_RNA, while color-coding various cell types. Any metadata column, signature, or feature can be also be used for the x/y axis. To pick from a particular assay, use an underscore separator, as in "assay_feature" or set the assay parameter. Features are picked up from the data layer by default, set layer to change.

Usage

IdentPlotQC(
  object,
  ident = NA,
  x = "nFeature_RNA",
  y = "percent.mito",
  log.scale = TRUE,
  ncol = NA,
  pt.size = 1,
  interactive = TRUE,
  colors.use = NULL,
  assay = DefaultAssay(object),
  layer = "data",
  ...
)

Arguments

object

Seurat object. Must contain nFeature_RNA and percent.mito metadata columns, or the x and y plot parameters must be changed accordingly to plot other QC info otherwise.

ident

The name of the categorical metadata column to use as cell types (Default: NA, using the current active annotations, i.e. Idents(object)). If ident is a list, an array of plots for the various set of annotations provided will be returned.

x

Which parameter to set to the x axis in the QC plot (Default: nFeature_RNA).

y

Which parameter to set to the y axis in the QC plot (Default: percent.mito).

log.scale

Whether to plot with log.scale or not (Default: TRUE)

ncol

Number of columns (Default = NA, determined from the data)

pt.size

The point size, passed to ggplot (Default: 1)

interactive

Enable interactive plot? (Default: TRUE).

colors.use

For interactive plots, a colorbrewer2.org palette name (e.g. "YlOrRd" or "Blues"), or a vector of colors to interpolate in hexadecimal "#RRGGBB" format, or a color interpolation function like colorRamp(). For non-interactive plots, a vector of colors passed to ggplot2 scale_color_manual. If the vector is named, the values will be matched based on names.

assay

character(1). If axes are features rather than metadata columns, the assay from which they should be pulled in priority (Default: DefaultAssay(object)).

layer

character(1). If axes are features rather than metadata columns, the layer from which they should be pulled (Default: "data").

...

Other arguments passed to plot_ly in the case of interactive plots.

Details

Plotly interactions: click on legend categories to toggle the display on/off, double click to isolate one cell type/category/ident. Hover to get cell info (useful to choose filtering parameters), and select pan/zoom in the top-right menu to do close-ups and navigate.

This is useful when making scRNA-seq from heterogeneous samples: for example immune cells are small and might be discarded as debris from much larger epithelial cancer cells if one is not aware of the differences in QC parameters occuring between various cell types.

Value

If one ident is plotted and interactive is enabled, returns interactive plot (plotly). If several, returns a ggplot grid (cowplot).

Examples

# After MySeuratObject has been log-normalized in order to contain an RNA>data assay>layer and been augmented with a percent.mito metadata column:
# SignatureList should be a list of character vectors, each containing a series of feature/gene names. In this example, the signatures correspond to cell types, and the name of each signature is the name of the corresponding cell type (e.g. Tcell, Bcell, EpithelialCell, Fibroblasts, etc).
MySeuratObject <- Impute(MySeuratObject)
MySeuratObject <- ScoreSignatures(MySeuratObject,SignatureList)
MySeuratObject <- Classify(MySeuratObject,names(SignatureList),"CellType") # Automatic cell type annotation based on cell type signatures.
IdentPlotQC(MySeuratObject,"celltype")

nbroguiere/burgertools documentation built on Jan. 30, 2024, 3:48 a.m.