This is a test version of Biostars. For the public version, visit https://www.biostars.org.
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

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: treeNodes

treeEdges

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

tidygraph

0 answers

No answers yet.

Log in to answer this question.