Given a 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.

example_graph(engine, ...)

Arguments

engine

A KG 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")

# prints a readable summary and returns a list of dataframes
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>, …

# prints a readable summary and returns a list of dataframes
g <- monarch_engine() |> example_graph()
#> Trying to connect to https://neo4j.monarchinitiative.org
#> Connected to https://neo4j.monarchinitiative.org
print(g)
#> # A tbl_graph: 68 nodes and 41 edges
#> #
#> # A directed acyclic simple graph with 30 components
#> #
#> # Node Data: 68 × 17 (active)
#>    id     category pcategory name  symbol description synonym full_name in_taxon
#>    <chr>  <list>   <chr>     <chr> <chr>  <chr>       <named> <chr>     <named >
#>  1 NCBIG… <chr>    biolink:… ATP5… ATP5F… ATP syntha… <lgl>   ATP synt… <chr>   
#>  2 GO:19… <chr>    biolink:… prot… NA     The direct… <chr>   NA        <lgl>   
#>  3 dicty… <chr>    biolink:… psmA3 psmA3  NA          <lgl>   psmA3     <chr>   
#>  4 Xenba… <chr>    biolink:… psma3 psma3  NA          <chr>   proteaso… <chr>   
#>  5 GO:00… <chr>    biolink:… spli… NA     Any of a s… <chr>   NA        <lgl>   
#>  6 NCBIG… <chr>    biolink:… SNRN… SNRNP… small nucl… <lgl>   small nu… <chr>   
#>  7 GO:00… <chr>    biolink:… posi… NA     Any proces… <chr>   NA        <lgl>   
#>  8 NCBIG… <chr>    biolink:… TEK   TEK    TEK recept… <lgl>   TEK rece… <chr>   
#>  9 MONDO… <chr>    biolink:… over… NA     A disease … <chr>   NA        <lgl>   
#> 10 CLINV… <chr>    biolink:… NM_0… NA     NA          <lgl>   NA        <chr>   
#> # ℹ 58 more rows
#> # ℹ 8 more variables: namespace <chr>, provided_by <named list>, iri <chr>,
#> #   in_taxon_label <chr>, xref <named list>, type <named list>,
#> #   has_gene <named list>, deprecated <chr>
#> #
#> # Edge Data: 41 × 22
#>    from    to subject                predicate    object knowledge_level negated
#>   <int> <int> <chr>                  <chr>        <chr>  <chr>           <lgl>  
#> 1     1     2 NCBIGene:338081        biolink:act… GO:19… knowledge_asse… TRUE   
#> 2     4     3 Xenbase:XB-GENE-976787 biolink:ort… dicty… knowledge_asse… NA     
#> 3     6     5 NCBIGene:535113        biolink:par… GO:00… knowledge_asse… TRUE   
#> # ℹ 38 more rows
#> # ℹ 15 more variables: primary_knowledge_source <chr>, original_subject <chr>,
#> #   species_context_qualifier <chr>, agent_type <chr>, knowledge_source <chr>,
#> #   aggregator_knowledge_source <named list>, has_evidence <named list>,
#> #   provided_by <named list>, id <chr>, category <named list>,
#> #   publications <named list>, qualifiers <named list>,
#> #   original_predicate <chr>, disease_context_qualifier <chr>, …