This page demonstrates how to run trajectory inference and pseudotime calculations with Monocle 3 on Seurat objects using SeuratWrappers.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.
The single-cell transcriptional landscape of mammalian organogenesis Junyue Cao, Malte Spielmann, Xiaojie Qiu, Xingfan Huang, Daniel M. Ibrahim, Andrew J. Hill, Fan Zhang, Stefan Mundlos, Lena Christiansen, Frank J. Steemers, Cole Trapnell & Jay Shendure Nature, 2019. doi: 10.1038/s41586-019-0969-x
Installation
The following packages are required before proceeding:
Workflow
Prepare and integrate data
Load your dataset and run standard Seurat preprocessing. This example uses the HCA Bone Marrow 40k dataset.
Convert to cell_data_set
Use
as.cell_data_set() to convert the Seurat object to a Monocle 3 cell_data_set. Then run Monocle 3’s own clustering to compute partitions, which are required for trajectory inference.Subset to a single partition and learn graph
Trajectories can only be inferred within a single connected partition. Subset cells to the partition of interest, convert back to Seurat, then convert again to a fresh
cell_data_set before learning the graph.Order cells by pseudotime
Set a root cell (or cells) to define the start of the trajectory, then order all cells along the pseudotime axis.
Functions
as.cell_data_set()
Converts a Seurat object to a Monocle 3 cell_data_set. Uses as.SingleCellExperiment() internally to transfer expression data and cell-level metadata, then adds the following:
- Cell embeddings are transferred to
reducedDims. Reduction names are uppercased (e.g."umap"→"UMAP") to match Monocle 3 conventions. - Feature loadings from the last dimensional reduction are written to
cds@reduce_dim_aux$gene_loadings. - Standard deviations from the last dimensional reduction are written to
cds@reduce_dim_aux$prop_var_expl. - If
monocle3_clustersandmonocle3_partitionscolumns exist in cell metadata, they are used directly. Otherwise, Seurat’s nearest-neighbor graph is converted to anigraphobject and Seurat’s cluster identities are used (with all cells assigned to a single partition).
A Seurat object to convert.
Name of the assay to transfer. Defaults to the active assay.
Names of dimensional reductions to include. Defaults to all reductions associated with
assay plus global reductions.Name of the dimensional reduction to use for storing clustering results. Defaults to the object’s default reduction for
assay.Name of the nearest-neighbor graph to use for clustering. Defaults to
"{assay}_snn".Name of a cell-level metadata column to use as cluster identities. Pass
NULL (the default) to use the active identities.as.Seurat() for cell_data_set
Converts a Monocle 3 cell_data_set back to a Seurat object. Builds on as.Seurat.SingleCellExperiment() and additionally transfers:
- Feature loadings from
cds@reduce_dim_aux$gene_loadingsinto the reduction specified byloadings(or the first reduction whose name contains"pca"). - Monocle 3 cluster assignments → metadata column
monocle3_clustersand the active identity class. - Monocle 3 partitions → metadata column
monocle3_partitions. - Monocle 3 pseudotime values → metadata column
monocle3_pseudotime. - The nearest-neighbor graph (if present) → a Seurat
Graphobject stored as"{assay}_monocle3_graph".
A Monocle 3
cell_data_set object to convert.Name of the assay slot in the
cell_data_set to use as counts.Name of the assay slot to use as normalized data. Pass
NULL to skip.Name to give the assay in the resulting Seurat object.
Project name for the resulting Seurat object.
Name of the dimensional reduction in the resulting Seurat object to receive feature loadings. Defaults to the first reduction whose name contains
"pca" (case-insensitive). Pass NA to suppress transfer of loadings.Name of the clustering method stored in the
cell_data_set to use when pulling cluster assignments and pseudotime. Defaults to the default dimensional reduction of the resulting Seurat object.What gets transferred
| Data | Seurat → Monocle 3 | Monocle 3 → Seurat |
|---|---|---|
| Expression matrix | counts assay via as.SingleCellExperiment | Counts/data slots via as.Seurat.SingleCellExperiment |
| Cell metadata | All columns | All columns |
| Cell embeddings | reducedDims (uppercased names) | DimReduc objects (lowercased names) |
| Feature loadings | cds@reduce_dim_aux$gene_loadings | Added to reduction specified by loadings |
| Cluster assignments | cds@clusters[[reduction]]$clusters | monocle3_clusters column + active identity |
| Partitions | cds@clusters[[reduction]]$partitions | monocle3_partitions column |
| Pseudotime | — | monocle3_pseudotime column |
| Nearest-neighbor graph | igraph in cds@clusters[[reduction]]$cluster_result$g | "{assay}_monocle3_graph" Graph object |