Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/satijalab/seurat-wrappers/llms.txt

Use this file to discover all available pages before exploring further.

SeuratWrappers provides two-way conversion between Seurat objects and Monocle 3 cell_data_set objects.

as.cell_data_set()

Converts a Seurat object to a Monocle 3 cell_data_set for trajectory analysis.

Syntax

as.cell_data_set(
  x,
  assay = DefaultAssay(object = x),
  reductions = AssociatedDimReducs(object = x, assay = assay),
  default.reduction = DefaultDimReduc(object = x, assay = assay),
  graph = paste0(assay, "_snn"),
  group.by = NULL,
  ...
)

Parameters

x
Seurat
required
A Seurat object to convert.
assay
character
Assay to use. Defaults to the active default assay.
reductions
character vector
Names of dimensional reductions to transfer. Defaults to all reductions associated with assay plus global reductions.
default.reduction
character
Name of the reduction to use as the primary clustering reduction in Monocle 3. Defaults to the default DimReduc (UMAP > tSNE > PCA).
graph
character
Name of the nearest-neighbor graph to transfer for clustering. Defaults to <assay>_snn.
group.by
character
default:"NULL"
Metadata column to use for cell identities. If NULL, uses the active Seurat identities.

What gets transferred

SeuratMonocle 3Notes
EmbeddingsreducedDimsNames uppercased (e.g., umapUMAP)
Feature loadingsreduce_dim_aux$gene_loadingsLast reduction only
Stdevreduce_dim_aux$prop_var_explLast reduction only
Seurat clustersclusters slotWith nearest-neighbor graph
monocle3_clusters / monocle3_partitions metadataclusters slotIf present, used directly
Monocle 3 trajectory inference requires cell partitions, which Seurat does not compute. After conversion, run cluster_cells() on the cell_data_set to generate partitions before calling learn_graph().

as.Seurat.cell_data_set()

Converts a Monocle 3 cell_data_set back to a Seurat object.

Syntax

as.Seurat(
  x,
  counts = "counts",
  data = NULL,
  assay = "RNA",
  project = "cell_data_set",
  loadings = NULL,
  clusters = NULL,
  ...
)

Parameters

x
cell_data_set
required
A Monocle 3 cell_data_set object.
counts
character
default:"counts"
Name of the assay in the cell_data_set to use as counts.
assay
character
default:"RNA"
Name for the assay in the resulting Seurat object.
loadings
character
default:"NULL"
Name of the reduction to transfer gene loadings into. Defaults to the first reduction containing "pca" (case-insensitive). Pass NA to suppress loadings transfer.
clusters
character
default:"NULL"
Name of the Monocle clustering method to use for Seurat identities. Defaults to DefaultDimReduc(object).

What gets transferred back

Monocle 3SeuratNotes
reduce_dim_aux$gene_loadingsLoadings of loadings reduction
Monocle clustersActive identity + monocle3_clusters metadata
Monocle partitionsmonocle3_partitions metadata
Monocle pseudotimemonocle3_pseudotime metadata
Nearest-neighbor graph<assay>_monocle3_graphConverted to Seurat Graph

Examples

library(SeuratWrappers)
remotes::install_github("cole-trapnell-lab/monocle3")

# Seurat → Monocle 3
cds <- as.cell_data_set(seurat_obj)
cds <- cluster_cells(cds)
cds <- learn_graph(cds)
cds <- order_cells(cds)

# Monocle 3 → Seurat
seurat_obj <- as.Seurat(cds)

See Also

Build docs developers (and LLMs) love