Runs the Monocle3 algorithm on a Seurat object.
Usage
RunMonocle3(
srt,
assay = NULL,
layer = "counts",
reduction = DefaultReduction(srt),
clusters = NULL,
graph = NULL,
partition_qval = 0.05,
k = 50,
cluster_method = "louvain",
num_iter = 2,
resolution = NULL,
use_partition = NULL,
close_loop = TRUE,
root_pr_nodes = NULL,
root_cells = NULL,
seed = 11
)
Arguments
- srt
A Seurat object.
- assay
The name of the assay in the Seurat object to use for analysis. Defaults to NULL, in which case the default assay of the object is used.
- layer
The layer in the Seurat object to use for analysis. Default is "counts".
- reduction
The reduction used. Defaults to NULL, in which case the default reduction of the Seurat object is used.
- clusters
The cluster variable in the Seurat object to use for analysis. Defaults to NULL, in which case use Monocle clusters is used.
- graph
The name of the graph slot in the Seurat object to use for analysis. Defaults to NULL, in which case Monocle graph is used.
- partition_qval
The q-value threshold for partitioning cells. Defaults to 0.05.
- k
The number of nearest neighbors to consider for clustering. Defaults to 50.
- cluster_method
The clustering method to use. Defaults to "louvain".
- num_iter
The number of iterations for clustering. Defaults to 2.
- resolution
The resolution parameter for clustering. Defaults to NULL.
- use_partition
Whether to use partitions to learn disjoint graph in each partition. If not specified, user will be prompted for input. Defaults to NULL.
- close_loop
Whether to close loops in the graph. Defaults to TRUE.
- root_pr_nodes
The root nodes to order cells. If not specified, user will be prompted for input. Defaults to NULL.
- root_cells
The root cells to order cells. If not specified, user will be prompted for input. Defaults to NULL.
- seed
The random seed to use for reproducibility. Defaults to 11.
Examples
if (interactive()) {
data("pancreas_sub")
# Use Monocle clusters to infer the trajectories
pancreas_sub <- RunMonocle3(
srt = pancreas_sub,
reduction = "UMAP"
)
names(pancreas_sub@tools$Monocle3)
trajectory <- pancreas_sub@tools$Monocle3$trajectory
milestones <- pancreas_sub@tools$Monocle3$milestones
CellDimPlot(
pancreas_sub,
group.by = "Monocle3_partitions",
reduction = "UMAP",
label = TRUE,
theme_use = "theme_blank"
) +
trajectory +
milestones
CellDimPlot(
pancreas_sub,
group.by = "Monocle3_clusters",
reduction = "UMAP",
label = TRUE,
theme_use = "theme_blank"
) +
trajectory
FeatureDimPlot(
pancreas_sub,
features = "Monocle3_Pseudotime",
reduction = "UMAP",
theme_use = "theme_blank"
) +
trajectory
## Select the lineage using monocle3::choose_graph_segments
# cds <- pancreas_sub@tools$Monocle3$cds
# cds_sub <- monocle3::choose_graph_segments(
# cds,
# starting_pr_node = NULL,
# ending_pr_nodes = NULL
# )
# pancreas_sub$Lineages_1 <- NA
# pancreas_sub$Lineages_1[colnames(
# cds_sub)] <- pancreas_sub$Monocle3_Pseudotime[colnames(cds_sub)]
# CellDimPlot(
# pancreas_sub,
# group.by = "SubCellType",
# lineages = "Lineages_1",
# lineages_span = 0.1,
# theme_use = "theme_blank"
# )
# Use Seurat clusters to infer the trajectories
pancreas_sub <- standard_scop(pancreas_sub)
CellDimPlot(
pancreas_sub,
group.by = c("Standardclusters", "CellType"),
label = TRUE,
theme_use = "theme_blank"
)
pancreas_sub <- RunMonocle3(
srt = pancreas_sub,
clusters = "Standardclusters"
)
trajectory <- pancreas_sub@tools$Monocle3$trajectory
CellDimPlot(
pancreas_sub,
group.by = "Monocle3_partitions",
reduction = "StandardUMAP2D",
label = TRUE, theme_use = "theme_blank"
) + trajectory
CellDimPlot(
pancreas_sub,
group.by = "Monocle3_clusters",
reduction = "StandardUMAP2D",
label = TRUE, theme_use = "theme_blank"
) + trajectory
FeatureDimPlot(
pancreas_sub,
features = "Monocle3_Pseudotime",
reduction = "StandardUMAP2D",
theme_use = "theme_blank"
) + trajectory
# Use custom graphs and cell clusters to infer
# the partitions and trajectories, respectively
pancreas_sub <- standard_scop(
pancreas_sub,
cluster_resolution = 5
)
CellDimPlot(
pancreas_sub,
group.by = c("Standardclusters", "CellType"),
label = TRUE
)
pancreas_sub <- RunMonocle3(
srt = pancreas_sub,
clusters = "Standardclusters",
graph = "Standardpca_SNN"
)
trajectory <- pancreas_sub@tools$Monocle3$trajectory
CellDimPlot(
pancreas_sub,
group.by = "Monocle3_partitions",
reduction = "StandardUMAP2D",
label = TRUE, theme_use = "theme_blank"
) + trajectory
CellDimPlot(
pancreas_sub,
group.by = "Monocle3_clusters",
reduction = "StandardUMAP2D",
label = TRUE, theme_use = "theme_blank"
) + trajectory
FeatureDimPlot(
pancreas_sub,
features = "Monocle3_Pseudotime",
reduction = "StandardUMAP2D",
theme_use = "theme_blank"
) + trajectory
}