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
0
0
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: 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 • 1.2k views
ADD COMMENT

Login before adding your answer.

Traffic: 2605 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6