Entering edit mode
2.6 years ago
leranwangcs
▴
150
Hi,
I kept getting this error says:
Error in (function (edges, n = max(edges), directed = TRUE) : At type_indexededgelist.c:117 : cannot create empty graph with negative number of vertices, Invalid value
When running
tidygraph::tbl_graph(nodes = treeNodes, edges = treeEdges, directed = TRUE)
Below is my code:
library(microviz)
library(phyloseq)
library(tidygraph)
ps0.microviz <- ps0 %>%
tax_fix(sep = "_") %>%
tax_prepend_ranks("_")
treeNodes <- taxatree_nodes(ps = ps0.microviz, .sort = NULL,
ranks = "Genus", .use_counts = TRUE)
treeEdges <- taxatree_edges(treeNodes)
treeGraph <- tidygraph::tbl_graph(nodes = treeNodes, edges = treeEdges, directed = TRUE)
Error in (function (edges, n = max(edges), directed = TRUE) :
At type_indexededgelist.c:117 : cannot create empty graph with negative number of vertices, Invalid value
And here are the screenshots of the treeNodes and treeEdges variables:
I'm wondering if there is anything wrong with my treeNodes file and treeEdges file formats? But I'm not familiar with the tree structures so don't know where to start to debug.
Anyone can provide any suggestions?
Thanks so much! Leran