Skip to contents

Takes in a Seurat or cell_dat_set object, extracts UMAP dimensions and gene expression values. For Seurat, default assay is "RNA"; can be changed to if necessary. For cell_data_set, the assay parameter does nothing; the function extracts log and size-factor normalized counts which are similar but not identical to the Seurat "RNA" assay. If a vector of genes is supplied to gene_or_genes, a faceted plot will be generated. If a dataframe is supplied, an aggregated plot will be generated with a facet for each gene group. The dataframe must be of 2 colums: the first containing feature ids and the second containing grouping information. This is best generated using bb_rowmeta.

Usage

bb_gene_umap(
  obj,
  gene_or_genes,
  assay = "RNA",
  order = TRUE,
  cell_size = 1,
  alpha = 1,
  ncol = NULL,
  plot_title = NULL,
  color_legend_title = "Expression",
  max_expr_val = NULL,
  alt_dim_x = NULL,
  alt_dim_y = NULL,
  rasterize = FALSE,
  raster_dpi = 300,
  cds = NULL
)

Arguments

obj

A Seurat or cell_data_set object.

gene_or_genes

Individual gene or genes or aggregated genes to plot. Supply a character string for a single gene, a vector for multiple genes or a dataframe for aggregated genes. See description.

assay

For Seurat objects only: the gene expression assay to get expression data from, Default: 'RNA'

order

Whether or not to order cells by gene expression. When ordered, non-expressing cells are plotted first, i.e. on the bottom. Caution: when many cells are overplotted it may lead to a misleading presentation. Generally bb_genebubbles is a better way to present, Default: TRUE

cell_size

Size of the points, Default: 1

alpha

Transparency of the points, Default: 1

ncol

Specify the number of columns if faceting, Default: NULL

plot_title

Optional title for the plot, Default: NULL

color_legend_title

Option to change the color scale title, Default: 'Expression'

max_expr_val

Maximum expression value to cap the color scale, Default: NULL

alt_dim_x

Alternate/reference dimensions to plot by.

alt_dim_y

Alternate/reference dimensions to plot by.

rasterize

Whether to render the graphical layer as a raster image. Default is FALSE.

raster_dpi

If rasterize then this is the DPI used. Default = 300.

cds

Provided for backward compatibility. If a value is supplied a warning will be emitted., Default: NULL

Value

A ggplot