Given a tbl_kgx graph, retrieve the last-used engine.

get_engine(g, fail_if_missing = TRUE)

Arguments

g

A tbl_kgx graph.

fail_if_missing

If TRUE, fail if there is no engine associated with the graph.

Value

A graph engine object.

Examples

# Using 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(get_engine(g))
#> $name
#> [1] "file_engine"
#> 
#> $preferences
#> $preferences$category_priority
#>  [1] "biolink:Disease"           "biolink:PhenotypicFeature"
#>  [3] "biolink:Gene"              "biolink:AnatomicalEntity" 
#>  [5] "biolink:BiologicalProcess" "biolink:Pathway"          
#>  [7] "biolink:Cell"              "biolink:CellularComponent"
#>  [9] "biolink:ChemicalEntity"    "biolink:Drug"             
#> 
#> $preferences$node_property_priority
#> [1] "id"             "pcategory"      "name"           "symbol"        
#> [5] "in_taxon_label" "description"    "synonym"       
#> 
#> $preferences$edge_property_priority
#> [1] "subject"   "predicate" "object"   
#> 
#> 
#> $filename
#> [1] "/__w/_temp/Library/monarchr/extdata/eds_marfan_kg.tar.gz"
#> 
#> $graph
#> # A tbl_graph: 3000 nodes and 7148 edges
#> #
#> # A directed acyclic multigraph with 1 component
#> #
#> # Node Data: 3,000 × 16 (active)
#>    id       name  symbol in_taxon_label description synonym category iri   xref 
#>    <chr>    <chr> <chr>  <chr>          <chr>       <list>  <list>   <chr> <lis>
#>  1 MONDO:0… Marf… NA     NA             A disorder… <chr>   <chr>    http… <chr>
#>  2 MONDO:0… Ehle… NA     NA             The Ehlers… <chr>   <chr>    http… <chr>
#>  3 MONDO:0… Ehle… NA     NA             Ehlers-Dan… <chr>   <chr>    http… <chr>
#>  4 MONDO:0… ehle… NA     NA             NA          <chr>   <chr>    http… <chr>
#>  5 MONDO:0… Beth… NA     NA             NA          <chr>   <chr>    http… <chr>
#>  6 MONDO:0… Ehle… NA     NA             A form of … <chr>   <chr>    http… <chr>
#>  7 MONDO:0… Ehle… NA     NA             A form of … <chr>   <chr>    http… <chr>
#>  8 MONDO:0… brit… NA     NA             Brittle co… <chr>   <chr>    http… <chr>
#>  9 MONDO:0… brit… NA     NA             Any brittl… <chr>   <chr>    http… <chr>
#> 10 MONDO:0… comb… NA     NA             NA          <chr>   <chr>    http… <chr>
#> # ℹ 2,990 more rows
#> # ℹ 7 more variables: namespace <chr>, provided_by <chr>, in_taxon <chr>,
#> #   full_name <chr>, type <list>, has_gene <chr>, pcategory <chr>
#> #
#> # Edge Data: 7,148 × 25
#>    from    to subject       predicate          object agent_type knowledge_level
#>   <int> <int> <chr>         <chr>              <chr>  <chr>      <chr>          
#> 1     3     2 MONDO:0009159 biolink:subclass_… MONDO… not_provi… not_provided   
#> 2     4     2 MONDO:0040501 biolink:subclass_… MONDO… not_provi… not_provided   
#> 3     5     2 MONDO:0034022 biolink:subclass_… MONDO… not_provi… not_provided   
#> # ℹ 7,145 more rows
#> # ℹ 18 more variables: 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>,
#> #   onset_qualifier <chr>, publications <chr>, qualifiers <chr>, …
#> 
#> attr(,"class")
#> [1] "file_engine" "base_engine" "list"