Skip to contents

Converts a Monocle3 cell_data_set object into a Seurat object. Optionally, dimensionality reduction embeddings can be transferred.

Usage

monocle3_to_seurat(
  cds,
  assay_name = "RNA",
  monocle_reduction = "UMAP",
  seurat_reduction = "umap",
  row.names = "gene_short_name",
  handle_duplicate_features = c("make_unique", "remove"),
  normalize = TRUE
)

Arguments

cds

A Monocle3 cell_data_set object to convert.

assay_name

A character string specifying the assay name for the Seurat object. Default is "RNA".

monocle_reduction

The name of the reduction in Monocle3 to transfer (e.g., "UMAP"). Use NULL to skip transferring reductions. Default is "UMAP".

seurat_reduction

The name to assign to the reduction in the Seurat object (e.g., "umap"). Use NULL to skip transferring reductions. Default is "umap".

row.names

A character string specifying the column in rowData(cds) to use as feature names. Default is "gene_short_name".

handle_duplicate_features

How to handle duplicate feature names. Options are "make_unique" or "remove". Default is "make_unique".

normalize

Logical, whether to run NormalizeData() on the Seurat object. Default is TRUE.

Value

A Seurat object.

Details

This function converts a Monocle3 cell_data_set object into a Seurat object by extracting the counts data, cell metadata, and feature metadata. It can also transfer dimensionality reduction embeddings from the Monocle3 object to the Seurat object if specified.

Examples

if (FALSE) {
# Assuming 'cds' is a Monocle3 cell_data_set
seurat_obj <- monocle3_to_seurat(
  cds,
  assay_name = "RNA",
  monocle_reduction = "UMAP",
  seurat_reduction = "umap"
)
}