Given a KGX file-based KG engine, returns a graph representing the diversity of node categories and edge predicates for browsing. The returned graph is guaranteed to contain at least one node of every category, and at least one edge of every predicate. No other guarantees are made: the example graph is not minimal to satisfy these criteria, it is not random or even pseudo-random, and it may not be connected.

# S3 method for class 'file_engine'
example_graph(engine, ...)

Arguments

engine

A file_engine object

...

Other parameters (not used)

Value

A tbl_kgx graph

Examples

# Using example KGX file packaged with monarchr
filename <- system.file("extdata", "eds_marfan_kg.tar.gz", package = "monarchr")

# Retrieve and print an example graph:
g <- file_engine(filename) |> example_graph()
print(g)
#> # A tbl_graph: 12 nodes and 10 edges
#> #
#> # A directed acyclic multigraph with 3 components
#> #
#> # Node Data: 12 × 16 (active)
#>    id         pcategory name  symbol in_taxon_label description synonym category
#>    <chr>      <chr>     <chr> <chr>  <chr>          <chr>       <list>  <list>  
#>  1 MONDO:000… biolink:… Marf… NA     NA             A disorder… <chr>   <chr>   
#>  2 MONDO:002… biolink:… Ehle… NA     NA             The Ehlers… <chr>   <chr>   
#>  3 MONDO:000… biolink:… Ehle… NA     NA             Ehlers-Dan… <chr>   <chr>   
#>  4 MONDO:001… biolink:… Ehle… NA     NA             A form of … <chr>   <chr>   
#>  5 ZFIN:ZDB-… biolink:… b3ga… NA     Danio rerio    NA          <chr>   <chr>   
#>  6 HGNC:3603  biolink:… FBN1  FBN1   Homo sapiens   NA          <chr>   <chr>   
#>  7 HP:0000974 biolink:… Hype… NA     NA             A conditio… <chr>   <chr>   
#>  8 HP:0000007 biolink:… Auto… NA     NA             A mode of … <chr>   <chr>   
#>  9 MONDO:002… biolink:… rare  NA     NA             A disease … <chr>   <chr>   
#> 10 CHEBI:508… biolink:… doxy… NA     NA             Tetracycli… <chr>   <chr>   
#> 11 CLINVAR:2… biolink:… NM_0… NA     Homo sapiens   NA          <chr>   <chr>   
#> 12 CLINVAR:2… biolink:… NM_0… NA     Homo sapiens   NA          <chr>   <chr>   
#> # ℹ 8 more variables: iri <chr>, xref <list>, namespace <chr>,
#> #   provided_by <chr>, in_taxon <chr>, full_name <chr>, type <list>,
#> #   has_gene <chr>
#> #
#> # Edge Data: 10 × 25
#>    from    to subject        predicate         object agent_type knowledge_level
#>   <int> <int> <chr>          <chr>             <chr>  <chr>      <chr>          
#> 1    11     1 CLINVAR:200198 biolink:associat… MONDO… manual_ag… knowledge_asse…
#> 2     6     1 HGNC:3603      biolink:causes    MONDO… manual_ag… knowledge_asse…
#> 3     6     1 HGNC:3603      biolink:gene_ass… MONDO… manual_ag… knowledge_asse…
#> # ℹ 7 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>, …