Closed pangwopi closed 4 years ago
Can you post the output of traceback() after the error occurs please?
See below:
traceback() 5: stop("Invalid vertex names") 4: as.igraph.vs(graph, v) 3: igraph::distances(cell_wise_graph, v = closest_vertex_id) 2: extract_general_graph_ordering(cds, root_pr_nodes, verbose, reduction_method) 1: order_cells(cds)
Can you try pulling the latest develop version of monocle3 using devtools::install_github("cole-trapnell-lab/monocle3", ref="develop")
and let me know if that fixes the issue? There have been a couple of changes that may solve this issue. Be sure to start with reloading your data because one potential fix had to do with data classes in load_cellranger_data (if you were using that)
Hi Hannah,
I tried to reinstall the latest version of Monocle and reload the dataset using load_cellranger_data and follow the workflow, I still got the same error message when running order_cell:
cds = order_cells(k17)
Listening on http://127.0.0.1:7029 Error in as.igraph.vs(graph, v) : Invalid vertex names
Below are my sessionInfo:
sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4
Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] monocle3_0.1.3.0 igraph_1.2.4.1 shiny_1.3.2 dplyr_0.8.1 Matrix_1.2-17 reticulate_1.12
[7] SingleCellExperiment_1.4.1 SummarizedExperiment_1.12.0 DelayedArray_0.8.0 BiocParallel_1.16.6 matrixStats_0.54.0 GenomicRanges_1.34.0
[13] GenomeInfoDb_1.18.2 IRanges_2.16.0 S4Vectors_0.20.1 Biobase_2.42.0 BiocGenerics_0.28.0
loaded via a namespace (and not attached):
[1] colorspace_1.4-1 deldir_0.1-21 grr_0.9.5 class_7.3-15 rprojroot_1.3-2 XVector_0.22.0 fs_1.3.1
[8] rstudioapi_0.10 proxy_0.4-23 remotes_2.0.4 ggrepel_0.8.1 RSpectra_0.15-0 fansi_0.4.0 splines_3.5.2
[15] codetools_0.2-16 knitr_1.23 pkgload_1.0.2 zeallot_0.1.0 jsonlite_1.6 RhpcBLASctl_0.18-205 pheatmap_1.0.12
[22] uwot_0.1.3 HDF5Array_1.10.1 BiocManager_1.30.4 compiler_3.5.2 backports_1.1.4 assertthat_0.2.1 lazyeval_0.2.2
[29] limma_3.38.3 cli_1.1.0 later_0.8.0 htmltools_0.3.6 prettyunits_1.0.2 tools_3.5.2 coda_0.19-2
[36] gtable_0.3.0 glue_1.3.1 GenomeInfoDbData_1.2.0 RANN_2.6.1 reshape2_1.4.3 gmodels_2.18.1 Rcpp_1.0.1
[43] slam_0.1-45 vctrs_0.1.0 spdep_1.1-2 gdata_2.18.0 nlme_3.1-140 DelayedMatrixStats_1.4.0 xfun_0.7
[50] stringr_1.4.0 ps_1.3.0 mime_0.7 irlba_2.3.3 gtools_3.8.1 devtools_2.0.2 LearnBayes_2.15.1
[57] MASS_7.3-51.4 zlibbioc_1.28.0 scales_1.0.0 promises_1.0.1 expm_0.999-4 rhdf5_2.26.2 RColorBrewer_1.1-2
[64] yaml_2.2.0 curl_3.3 memoise_1.1.0 gridExtra_2.3 ggplot2_3.2.0 Matrix.utils_0.9.7 stringi_1.4.3
[71] desc_1.2.0 e1071_1.7-2 boot_1.3-22 pkgbuild_1.0.3 spData_0.3.0 rlang_0.3.4 pkgconfig_2.0.2
[78] bitops_1.0-6 evaluate_0.14 lattice_0.20-38 purrr_0.3.2 Rhdf5lib_1.4.3 sf_0.7-4 labeling_0.3
[85] processx_3.3.1 tidyselect_0.2.5 RcppAnnoy_0.0.12 plyr_1.8.4 magrittr_1.5 R6_2.4.0 DBI_1.0.0
[92] pillar_1.4.1 withr_2.1.2 units_0.6-3 sp_1.3-1 RCurl_1.95-4.12 tibble_2.1.3 crayon_1.3.4
[99] KernSmooth_2.23-15 utf8_1.1.4 rmarkdown_1.13 viridis_0.5.1 usethis_1.5.0 grid_3.5.2 callr_3.2.0
[106] digest_0.6.19 classInt_0.3-3 pbmcapply_1.4.1 xtable_1.8-4 tidyr_0.8.3 httpuv_1.5.1 RcppParallel_4.4.3
[113] munsell_0.5.0 viridisLite_0.3.0 sessioninfo_1.1.1
The traceback is still the same as before:
traceback() 5: stop("Invalid vertex names") 4: as.igraph.vs(graph, v) 3: igraph::distances(cell_wise_graph, v = closest_vertex_id) 2: extract_general_graph_ordering(cds, root_pr_nodes, verbose, reduction_method) 1: order_cells(k17)
Hello,
I think we've fixed this in develop. Can you give it another try? Thanks for your patience!
Reopen if the current develop build doesn't solve the issue!
Hi Hannah,
I do not think the issue is fixed. Still the same error. Just making sure, by running devtools::install_github("cole-trapnell-lab/monocle3", ref="develop")
The current develop version of monocle3 is still 0.1.3.0, right?
Yes, sorry, did you rerun learn_graph? It turned out that the bug was there, but didn't show up until order_cells. Try rerunning both and see if that solves it
I have met exactly the same issue which haven't been solved yet. I found this bug would happen while you want to use the parameter "use_partition=F" in order to connect your group through pseudotime methods and chose a custom start group as root rather than default partition(in peusotime plot these cells are in grey ) .
@chengarthur Can you let me know which version of monocle3 you are using and confirm that you reran learn_graph on the newest development version?
@chengarthur Can you let me know which version of monocle3 you are using and confirm that you reran learn_graph on the newest development version?
I'm using Monocle3 beta the latest version. But it seems that some vertexes just can't act as the root. Is there a way to list all the rootable nodes?
Hi Hannah,
@chengarthur was absolutely right. I am using monocle3 0.1.4.0 right now. The issue I described with order_cells only happen if I run learn_graph(cds,use_partition = FALSE). When I set use_partition = TRUE, everything seems to work correctly.
I'm going to reopen this and do some investigating
I've encountered the same problem when I run learn_graph(cds,use_partition = FALSE). packageVersion("monocle3") is ‘0.2.0’.
The error seems to appear when the node selected is not connected to a cell id (probably).
Unfortunately, I don't know enough of the igraph package to explain if the issue is exactly defined like this or why this problem appears. However, by restricting the closest vertices to those connected to a cell barcode, the order_cells()
method completes successfully. To do so, you can use a modified helper function that you can adapt for your case. The parameter grouping
and label
are an example of use of this helper function, in which I want to select a starting node from the cells having the label defined by label
in the column indicated by grouping
.
get_earliest_principal_node <- function(cds, grouping, label){
cell_ids <- colnames(cds)[which(colData(cds)[, grouping] == label)]
cwg <- cds@principal_graph_aux[['UMAP']]$pr_graph_cell_proj_tree
cwg <- as.data.frame(igraph::get.edgelist(cwg))
cwg <- cwg[-grep('Y_', cwg$V2),]
allowed <- levels(droplevels(unique(cwg[grep('Y_', cwg$V1), 'V1'])))
allowed <- as.numeric(substring(allowed, 3))
closest_vertex <-
cds@principal_graph_aux[["UMAP"]]$pr_graph_cell_proj_closest_vertex
closest_vertex <- as.matrix(closest_vertex[colnames(cds), ])
closest_vertex <- subset(closest_vertex, closest_vertex %in% allowed)
closest_vertex <- subset(closest_vertex, rownames(closest_vertex) %in% cell_ids)
root_pr_nodes <-
igraph::V(principal_graph(cds)[["UMAP"]])$name[as.numeric(names(which.max(table(closest_vertex))))]
root_pr_nodes
}
Hi,
We made some changes to Monocle3 to try to fix the problems related to running learn_graph(use_partition=FALSE) and my tests suggest that the changes are working. I pushed the changes to the Monocle3 develop repository branch on GitHub: it looks like you can install that branch using the command
devtools::install_github("cole-trapnell-lab/monocle3", ref="develop")
I am eager to hear whether or not this works for others.
But learn_graph(use_partition=FALSE) separates the clusters into microclusters and then draw micro-trajectories. Sometimes thats not meaningful.
Hi @pbpayal,
I am confused about the statement that learn_graph(use_partition=FALSE) draws micro-clusters. I ran learn_graph(use_partition=FALSE) and used the function
igraph::is_connected(principal_graph(cds_lg)$UMAP)
to check whether the graph is connected and it returned TRUE. I also ran
str(igraph::components(principal_graph(cds_lg)$UMAP))
List of 3
$ membership: Named num [1:372] 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "names")= chr [1:372] "Y_1" "Y_2" "Y_3" "Y_4" ...
$ csize : num 372
$ no : int 1
It appears to me that Monocle3 returns a single trajectory in my test. Perhaps I misunderstand or your test gives different results. An example may help me.
Hi, I am closing this issue in the absence of additional information.
The order_cells function throws an error like below, no matter which node I click on the interactive graphical user interface.
Listening on http://127.0.0.1:7029 Error in as.igraph.vs(graph, v) : Invalid vertex names
sessionInfo(): R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4
Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages: [1] shiny_1.3.2 dplyr_0.8.1 Matrix_1.2-17 reticulate_1.12 monocle3_0.1.1 SingleCellExperiment_1.4.1 [7] SummarizedExperiment_1.12.0 DelayedArray_0.8.0 BiocParallel_1.16.6 matrixStats_0.54.0 GenomicRanges_1.34.0 GenomeInfoDb_1.18.2
[13] IRanges_2.16.0 S4Vectors_0.20.1 Biobase_2.42.0 BiocGenerics_0.28.0
loaded via a namespace (and not attached): [1] bitops_1.0-6 fs_1.3.1 usethis_1.5.0 devtools_2.0.2 RColorBrewer_1.1-2 RcppAnnoy_0.0.12 rprojroot_1.3-2
[8] tools_3.5.2 backports_1.1.4 utf8_1.1.4 R6_2.4.0 irlba_2.3.3 HDF5Array_1.10.1 uwot_0.1.3
[15] lazyeval_0.2.2 colorspace_1.4-1 withr_2.1.2 tidyselect_0.2.5 gridExtra_2.3 prettyunits_1.0.2 processx_3.3.1
[22] curl_3.3 compiler_3.5.2 cli_1.1.0 desc_1.2.0 labeling_0.3 scales_1.0.0 proxy_0.4-23
[29] callr_3.2.0 stringr_1.4.0 digest_0.6.19 XVector_0.22.0 RhpcBLASctl_0.18-205 htmltools_0.3.6 pkgconfig_2.0.2
[36] sessioninfo_1.1.1 limma_3.38.3 rlang_0.3.4 rstudioapi_0.10 DelayedMatrixStats_1.4.0 jsonlite_1.6 RCurl_1.95-4.12
[43] magrittr_1.5 GenomeInfoDbData_1.2.0 fansi_0.4.0 Rcpp_1.0.1 munsell_0.5.0 Rhdf5lib_1.4.3 viridis_0.5.1
[50] stringi_1.4.3 zlibbioc_1.28.0 rhdf5_2.26.2 pkgbuild_1.0.3 plyr_1.8.4 grid_3.5.2 promises_1.0.1
[57] ggrepel_0.8.1 crayon_1.3.4 lattice_0.20-38 zeallot_0.1.0 ps_1.3.0 pillar_1.4.1 igraph_1.2.4.1
[64] reshape2_1.4.3 codetools_0.2-16 pkgload_1.0.2 glue_1.3.1 remotes_2.0.4 BiocManager_1.30.4 RcppParallel_4.4.3
[71] httpuv_1.5.1 vctrs_0.1.0 gtable_0.3.0 grr_0.9.5 RANN_2.6.1 purrr_0.3.2 tidyr_0.8.3
[78] assertthat_0.2.1 ggplot2_3.2.0 mime_0.7 xtable_1.8-4 RSpectra_0.15-0 later_0.8.0 viridisLite_0.3.0
[85] pheatmap_1.0.12 tibble_2.1.3 pbmcapply_1.4.1 Matrix.utils_0.9.7 memoise_1.1.0