Skip to contents

This function takes a group of modules and calculates module scores for the expression programs. In addition, if plot_dir is not NULL creates feature plots with marker genes and the module score and saved them in plot_dir directory.

Usage

module_score_analysis(
  seu,
  modules_group,
  plot_dir = NULL,
  reduction = "umap",
  max.cutoff = "q98",
  min.cutoff = NA,
  legend.position = "top",
  col_pal = NULL,
  dims_plot = c(1, 2),
  seed = 1,
  pt.size = 1.4,
  fig.res = 200,
  alpha = c(0.1, 0.9),
  pt.size.factor = 1.1,
  spatial_col_pal = "inferno",
  crop = FALSE,
  plot_spatial_markers = FALSE,
  spatial_legend_position = "top",
  ...
)

Arguments

seu

Seurat object (required).

modules_group

Group of modules (named list of lists) storing features (e.g. genes) to compute module score for each identified cluster. This step can be useful for annotating the different clusters by saving dot plots for each group. Assumes that we already have computed the modules e.g. by calling the 'module_score_analysis' function. If 'plot_dir' is NULL, no plots will be generated.

plot_dir

Directory to save generated plots. If NULL, plots are not saved.

reduction

Which dimensionality reduction to use (required).

max.cutoff

Vector of maximum cutoff values for each feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10').

min.cutoff

Vector of minimum cutoff values for each feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10').

legend.position

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

col_pal

Continuous colour palette to use, default "RdYlBu".

dims_plot

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

seed

Set a random seed, for reproducibility.

pt.size

Adjust point size for plotting.

fig.res

Figure resolution in ppi (see 'png' function).

alpha

(Spatial) Controls opacity of spots. Provide as a vector specifying the min and max range of values (between 0 and 1).

pt.size.factor

(Spatial) Scale the size of the spots.

spatial_col_pal

(Spatial) Continuous colour palette to use from viridis package to colour spots on tissue, default "inferno".

crop

(Spatial) Crop the plot in to focus on spots that passed QC. Set to FALSE to show entire background image.

plot_spatial_markers

(Spatial) Logical, whether to create spatial feature plots with expression of individual genes.

spatial_legend_position

(Spatial) Position of legend for spatial plots, default "top" (set to "none" for clean plot).

...

Additional named parameters passed to Seurat's AddModuleScore and FeaturePlot

Value

Updated Seurat object with calculated module scores in metadata.

Author

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