monocle3 icon indicating copy to clipboard operation
monocle3 copied to clipboard

choose_graph_segments() keeping original path

Open RAEjarq opened this issue 3 years ago • 7 comments

I have a cds object in which I have run pseudotime analysis. Rplot01

From here, I want to study the gene expression differences between the 2 paths that depart from root 1. I have been able to do this by running choose_cells(). However, I would prefer not having to manually gate the cells for reproducibility purposes, something that I can do by using choose_graph_segments(clear_cds = F). However, when I run choose_graph_segments() I run into the following error when running graph_test():

Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE) : invalid character indexing

Something that I assume is due to the fact that there are parts of the original path missing, as seen in here:

choose_cells() Rplot

choose_graph_segments(clear_cds = F) Rplot04

I don’t want to run learn_graph() again as I will lose my original trajectory.

Is there a way of making choose_graph_segments() keep the same information as choose_cells() so the downstream analysis can be performed with the original path? (as shown, this is not achieved by choosing clear_cds = F)

Thank you for your help!

RAEjarq avatar Mar 16 '21 11:03 RAEjarq

Any updates on this? Running into the same issue :/

massisnascimento avatar Sep 09 '22 00:09 massisnascimento

I would also like this answered- very frustrating!

anichols0 avatar Oct 20 '22 16:10 anichols0

I am running into exactly the same issue and would much prefer to be able to do this using choose_graph_segment() instead of choose_cells() for reproducibility purposes. Has this been answered or dealt with?

wolf5996 avatar Oct 27 '22 03:10 wolf5996

I actually found that updating the the newest version of Monocle (monocle3_1.2.9) solved my issue.

anichols0 avatar Oct 27 '22 20:10 anichols0

Hi! Thank you for a great package. Still running into this issue when I'm subsetting a specific branch in order to analyze pseudotime. Using Monocle3 version 1.3.1 - did anyone figure out how to solve this?

`> cds_sub_memory <- choose_graph_segments(cds, clear_cds = F)

plot_cells(cds_sub_memory) Error in names(root_pr_nodes) <- cds@principal_graph_aux[[reduction_method]]$root_pr_nodes : 'names' attribute [1] must be the same length as the vector [0] cds_sub_memory_genes <- graph_test(cds_sub_memory, neighbor_graph="principal_graph") Error in intI(i, n = d[1L], dn[[1L]], give.dn = FALSE) : invalid character indexing`

cwibrand avatar May 09 '23 21:05 cwibrand

Hi!

Found a way around it, in case anyone else is looking for a solution. So far it's working! cds_sub_graph <- choose_graph_segments(cds, clear_cds = F, return_list = T) cds_sub_graph <- cds[,cds_sub_graph$cells]

cwibrand avatar May 20 '23 01:05 cwibrand

Hi!

Found a way around it, in case anyone else is looking for a solution. So far it's working! cds_sub_graph <- choose_graph_segments(cds, clear_cds = F, return_list = T) cds_sub_graph <- cds[,cds_sub_graph$cells]

It works, thanks so much!

Lindseynicer avatar Aug 11 '23 05:08 Lindseynicer