Explode a graph into a list of single-node graphs
explode(graph, ...)
A list of tbl_kgx graphs.
# (using the example KGX file packaged with monarchr)
filename <- system.file("extdata", "eds_marfan_kg.tar.gz", package = "monarchr")
g <- file_engine(filename) |>
fetch_nodes(query_ids = c("MONDO:0007525", "MONDO:0007526"))
print(explode(g))
#> [[1]]
#> # A tbl_graph: 1 nodes and 0 edges
#> #
#> # A rooted tree
#> #
#> # Node Data: 1 × 16 (active)
#> id pcategory name symbol in_taxon_label description synonym category iri
#> <chr> <chr> <chr> <chr> <chr> <chr> <list> <list> <chr>
#> 1 MOND… biolink:… Ehle… NA NA Arthrochal… <chr> <chr> http…
#> # ℹ 7 more variables: xref <list>, namespace <chr>, provided_by <chr>,
#> # in_taxon <chr>, full_name <chr>, type <list>, has_gene <chr>
#> #
#> # Edge Data: 0 × 25
#> # ℹ 25 variables: from <int>, to <int>, subject <chr>, predicate <chr>,
#> # object <chr>, agent_type <chr>, knowledge_level <chr>,
#> # knowledge_source <chr>, aggregator_knowledge_source <chr>,
#> # primary_knowledge_source <chr>, provided_by <chr>, id <chr>,
#> # category <chr>, original_object <chr>, original_subject <chr>,
#> # frequency_qualifier <chr>, has_evidence <chr>, has_total <dbl>,
#> # has_quotient <dbl>, has_count <dbl>, has_percentage <dbl>, …
#>
#> [[2]]
#> # A tbl_graph: 1 nodes and 0 edges
#> #
#> # A rooted tree
#> #
#> # Node Data: 1 × 16 (active)
#> id pcategory name symbol in_taxon_label description synonym category iri
#> <chr> <chr> <chr> <chr> <chr> <chr> <list> <list> <chr>
#> 1 MOND… biolink:… Ehle… NA NA A form of … <chr> <chr> http…
#> # ℹ 7 more variables: xref <list>, namespace <chr>, provided_by <chr>,
#> # in_taxon <chr>, full_name <chr>, type <list>, has_gene <chr>
#> #
#> # Edge Data: 0 × 25
#> # ℹ 25 variables: from <int>, to <int>, subject <chr>, predicate <chr>,
#> # object <chr>, agent_type <chr>, knowledge_level <chr>,
#> # knowledge_source <chr>, aggregator_knowledge_source <chr>,
#> # primary_knowledge_source <chr>, provided_by <chr>, id <chr>,
#> # category <chr>, original_object <chr>, original_subject <chr>,
#> # frequency_qualifier <chr>, has_evidence <chr>, has_total <dbl>,
#> # has_quotient <dbl>, has_count <dbl>, has_percentage <dbl>, …
#>