Skip to content

Instantly share code, notes, and snippets.

@vjcitn
Created October 6, 2023 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vjcitn/c62a0db7c04fe6b001d5e13579beb9b0 to your computer and use it in GitHub Desktop.
Save vjcitn/c62a0db7c04fe6b001d5e13579beb9b0 to your computer and use it in GitHub Desktop.
neo4r and biocypher
# assumes https://github.com/biocypher/igan.git README instructions
# followed, docker compose up -d succeeded and localhost:7474 gives
# a neo4j browser interface (at localhost:7687/browser on my machine)
#
# BiocManager::install("neo4j-rstats/neo4r")
# want 0.1.3
library(neo4r)
library(magrittr)
con <- neo4j_api$new(
url = "http://localhost:7474", user="", password="")
con$ping() # not 404!
'MATCH (n:Disease) RETURN n LIMIT 25;' %>% call_neo4j(con)
#
# > 'MATCH (n:Disease) RETURN n LIMIT 25;' %>% call_neo4j(con)
# $n
# # A tibble: 25 × 3
# keywords preferred_id id
# <chr> <chr> <chr>
# 1 Mild proteinuria id Heno…
# 2 NA id Glom…
# 3 microbiome|systemic lupus erythematosus|IgA nephropathy|I… id Syst…
# 4 microbiome|systemic lupus erythematosus|IgA nephropathy|I… id Immu…
# 5 Cohort Study|Children|Henoch-Schonlein Purpura Nephritis|… id Heno…
# 6 CellCept|Dialysis|Kidney|Renal|Nephropathy|Glomerulonephr… id Glom…
# 7 NA id Peri…
# 8 NA id Necr…
# 9 NA id Ster…
# 10 Glomerulonephritis, IGA|Kidney Diseases|Autoimmune Diseas… id Prim…
# # ℹ 15 more rows
# # ℹ Use `print(n = ...)` to see more rows
#
# attr(,"class")
# [1] "neo" "list"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment