feat {scUtils}R Documentation

Feature Plot

Description

Highlight gene expression data in a 2D-embedding (UMAP, tSNE, etc.).

Usage

feat(embedding, expression, legend_name = "Expression")

Arguments

embedding

A matrix/data.frame/tibble/... with exactly two columns. If colnames are missing, the axis will be named "Dim1" and "Dim2". Other classes than matrix/data.frame/tibble are possible, as long as data.frame(embedding)) produces a numeric data.frame.

expression

Numeric vector with expression values of the gene of interest. Order has to correspond to the row order in embedding. Typically, expression is normalized gene expression and we recommend k/s/mean(1/s), where k are UMI counts for the gene of interest and s are totalUMI of the cell (aka library size).

legend_name

Text displayed above the legend. Most commonly the name of the displayed gene.

Details

This function discourages customization on purpose, because it bundles geoms, themes and settings that I found important for visualizing gene expression in scRNAseq data:

If you insist on customizing, think of this function as a great starting point, you can simply copy-paste the code after typing feat into your console.

Value

A ggplot2 object storing a colored scatter plot.

See Also

ggplot, closed_labels, closed_breaks_log2

Examples

 # expression goes from 0 to 22:
 set.seed(100)
 feat(matrix(rnorm(2000, c(.1, 3)), ncol=2), rpois(1000, c(.1, 11)))
 # expression goes from 2 to 52:
 set.seed(100)
 feat(matrix(rnorm(2000, c(.1, 3)), ncol=2), rpois(1000, c(10, 31)))

[Package scUtils version 0.1.0 Index]