Skip to contents

This function splits the feature plots according to a grouping variable defined in subset.by. The main difference is that the whole dataset is also shown in the background as smaller points.

Usage

subset_feature_plot(
  seu,
  subset.by,
  feature,
  reduction = "umap",
  max.cutoff = "q98",
  min.cutoff = NA,
  slot = "data",
  ncol = NULL,
  col_pal = NULL,
  legend.position = "right",
  pt.size = 2,
  pt.stroke = 0.05,
  pt.shape = 21,
  pt.alpha = 1,
  back.pt.size = 0.5,
  back.pt.alpha = 0.1,
  back.pt.color = "grey",
  combine = TRUE,
  dims_plot = c(1, 2),
  order_points_by_value = TRUE,
  ...
)

Arguments

seu

Seurat object

subset.by

Metadata column whose unique values will generate split feature plots.

feature

Feature to plot.

reduction

Dimensionality reduction to use.

max.cutoff

Maximum cutoff value for feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10').

min.cutoff

Minimum cutoff value for feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10').

slot

Slot to extract data from.

ncol

Number of columns for display when having multiple features.

col_pal

Continuous colour palette to use, default "RdYlBu".

legend.position

Position of legend, default "right" (set to "none" for clean plot).

pt.size

Adjust point size for plotting.

pt.stroke

Stroke value for each point.

pt.shape

Adjust point shape for plotting.

pt.alpha

Adjust alpha value for each point.

back.pt.size

Adjust background point size for plotting.

back.pt.alpha

Adjust opacity for background points.

back.pt.color

Colour for background points.

combine

Combine plots into a single patchworked ggplot object. If FALSE, return a list of ggplot objects

dims_plot

Dimensions to plot, must be a two-length numeric vector specifying x- and y-dimensions.

order_points_by_value

Logical, should points be ordered by their value (e.g. expression levels), which corresponds to plotting on top cells that have high expression, instead of getting 'buried' by lowly expressed cells.

...

Additional parameters passed to ggplot2::geom_point.

Value

A ggplot2 object.

Author

C.A.Kapourani C.A.Kapourani@ed.ac.uk