This function set provides tools to visualize smoothed gene expression trends along developmental trajectories derived from pseudotime analyses. GeneTrendCurve.Palantir() uses pseudotime results from Palantir, while GeneTrendCurve.Slingshot() utilizes outputs from Slingshot for similar purposes. These visualizations help elucidate the dynamics of gene expression as cells differentiate and develop.

GeneTrendCurve.Palantir(
  seu,
  features,
  pseudotime.data = "Pseudotime",
  magic = FALSE,
  method = c("smooth", "gam"),
  point = FALSE,
  line.size = NULL,
  pt.alpha = 0.3,
  pt.size = 1,
  ncol = NULL,
  se = TRUE,
  conda_env = "seuratextend"
)

GeneTrendCurve.Slingshot(
  seu,
  features,
  pseudotime.data = "PCA",
  magic = FALSE,
  method = c("smooth", "gam"),
  point = FALSE,
  line.size = NULL,
  pt.alpha = 0.3,
  pt.size = 1,
  ncol = NULL,
  se = TRUE,
  conda_env = "seuratextend"
)

Arguments

seu

A Seurat object that has undergone pseudotime analysis with either Palantir or Slingshot, containing necessary gene expression data and pseudotime calculations.

features

A vector of gene names whose expression trends will be plotted along the pseudotime axis.

pseudotime.data

The name of the slot within `seu@misc` where pseudotime data is stored or a data.frame containing pseudotime information; for Palantir, this is typically 'Pseudotime', and for Slingshot, 'PCA'.

magic

Logical indicating whether to use denoised gene expression data for plotting, obtained via MAGIC. Requires prior execution of Palantir.Magic() if set to TRUE. Default: FALSE.

method

The method used to smooth and visualize gene expression trends. Can be either "smooth" or "gam" to choose between simple moving averages or generalized additive models, respectively. Default: c("smooth", "gam").

point

Logical indicating whether to plot raw data points on top of the smoothed expression curves. Default: FALSE.

line.size

Size of the line used for plotting the gene expression trends. Default: NULL.

pt.alpha

Opacity of the plotted points if `point = TRUE`. Default: 0.3.

pt.size

Size of the plotted points if `point = TRUE`. Default: 1.

ncol

Number of columns in the plot layout if multiple genes are plotted. Default: NULL.

se

Logical indicating whether to include confidence intervals around the smoothed trends. Default: TRUE.

conda_env

Name of the Conda environment where necessary Python dependencies are installed for operations that require Python. Default: 'seuratextend'.

Value

A ggplot object displaying gene expression trends along computed pseudotime trajectories.

Details

GeneTrendCurve.Palantir() and GeneTrendCurve.Slingshot() are designed for researchers looking to understand how gene expression changes over the course of cellular development, providing clear visualizations that highlight trends and variations in gene expression along calculated trajectories. Each function tailors its approach based on the source of pseudotime data, ensuring that the visualizations are closely aligned with the underlying data and pseudotime analysis results.

Examples

library(Seurat)
library(SeuratExtend)

# Load an example Seurat Object
mye_small <- readRDS(url("https://zenodo.org/records/10944066/files/pbmc10k_mye_small_velocyto.rds", "rb"))

# Calculate diffusion map and pseudotime using Palantir
mye_small <- Palantir.RunDM(mye_small)
mye_small <- Palantir.Pseudotime(mye_small, start_cell = "sample1_GAGAGGTAGCAGTACG-1")

# Basic gene trend curve visualization
GeneTrendCurve.Palantir(mye_small, features = c("CD14", "FCGR3A"))

# Customizing gene trend curves with Palantir
ps <- mye_small@misc$Palantir$Pseudotime
colnames(ps)[3:4] <- c("fate1", "fate2")
GeneTrendCurve.Palantir(mye_small, pseudotime.data = ps, features = c("CD14", "FCGR3A"), point = TRUE, se = FALSE)

# Run Slingshot
mye_small <- RunSlingshot(mye_small, group.by = "cluster", start.clus = "Mono CD14")

# Using Slingshot for similar visualizations
GeneTrendCurve.Slingshot(mye_small, features = c("CD14", "FCGR3A"))