This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to calculate pseudo time for all cells with monocle3

I use the latest version of monocle3 and follow the official tutorial to calculate the pseudotime ,but since there are two partitions in the calculation result, when I set the root node, half of my pseudotime is always gray. How can I do this for all Cell calculates pseudo time?

my code is like this:

cds <- preprocess_cds(cds, num_dim = 20)
cds <- reduce_dimension(cds,umap.n_neighbors = 20L)
cds <- cluster_cells(cds,resolution = 0.1)
cds <- learn_graph(cds)
##PF is the earliest sample
get_earliest_principal_node <- function(cds, time_bin="PF"){
  cell_ids <- which(colData(cds)[, "time"] == time_bin)
  closest_vertex <-
  cds@principal_graph_aux[["UMAP"]]$pr_graph_cell_proj_closest_vertex
  closest_vertex <- as.matrix(closest_vertex[colnames(cds), ])
  root_pr_nodes <-
  igraph::V(principal_graph(cds)[["UMAP"]])$name[as.numeric(names
  (which.max(table(closest_vertex[cell_ids,]))))]
  root_pr_nodes
}
cds <- order_cells(cds, root_pr_nodes=get_earliest_principal_node(cds))
names(table(partitions(cds)))
##1 2
scrnaseq monocle3

0 answers

No answers yet.

Log in to answer this question.