Skip to contents

Query VFB's Neo4J graph database

Usage

vfb_neo4j_query(
  x,
  ...,
  path = "db/data",
  server = getOption("vfbr.server.neo4j")
)

Arguments

x

A character query in Neo4J's cypher language

...

Additional arguments passed to neo2R::cypher()

path

The relative path on the server for the Neo4J endpoint

server

The server's root URL

Value

A data.frame of query results

Details

Under the hood, this uses the RNeo4j::cypher function to call a Neo4J service running on the specified VFB server.

See also

RNeo4j::RNeo4j, RNeo4j::cypher and https://neo4j.com/docs/rest-docs/3.3/

Other query: vfb_owl_query(), vfb_solr_query()

Examples

# \donttest{
# ask for all neuronal classes
nclasses=vfb_neo4j_query("MATCH (n:Neuron:Class) RETURN n.label")
nrow(nclasses)
#> [1] 14247
head(nclasses)
#>                                             n.label
#> 1                        adult Drosulfakinin neuron
#> 2 adult natalisin small pars intercerebralis neuron
#> 3      labellar taste bristle mechanosensory neuron
#> 4                           wedge projection neuron
#> 5            wind sensitive wedge projection neuron
#> 6                          interoceptive SEZ neuron

# Find all images with an associated neuronal class
q=paste("MATCH (p:Class:Neuron)<-[:INSTANCEOF]-(i:Individual:has_image)",
  "RETURN distinct i.label, p.label, p.symbol;")
nclasses_image=vfb_neo4j_query(q)
nrow(nclasses_image)
#> [1] 98821
head(nclasses_image)
#>                             i.label                 p.label p.symbol
#> 1   WEDPN13_R (FlyEM-HB:5812989041) wedge projection neuron      WPN
#> 2   WEDPN13_R (FlyEM-HB:5813023929) wedge projection neuron      WPN
#> 3   WEDPN14_R (FlyEM-HB:1080886521) wedge projection neuron      WPN
#> 4 WEDPN17_c_R (FlyEM-HB:1224069121) wedge projection neuron      WPN
#> 5 WEDPN17_a_R (FlyEM-HB:1386858837) wedge projection neuron      WPN
#> 6   WEDPN15_R (FlyEM-HB:5813018784) wedge projection neuron      WPN

# how many neuronal classes have images?
length(unique(nclasses_image$p.label))
#> [1] 5968

# look at number of images for each neuronal class
# NB some of these are rather generic classes where
# a specific cell type annotation was not available.
table_by_nclass <- table(nclasses_image$p.label)
subset(as.data.frame(table_by_nclass), Freq>200)
#>                                                                     Var1  Freq
#> 91                                             adult ALl1 lineage neuron   284
#> 106                                             adult DM6 lineage neuron   294
#> 114                                               adult GABAergic neuron  6534
#> 149                                       adult alpha'/beta' Kenyon cell   264
#> 1041                                            adult cholinergic neuron 15119
#> 1521                                           adult dopaminergic neuron  2431
#> 1572                       adult fan-shaped body 1 column-crepine neuron   254
#> 1575 adult fan-shaped body 1 column-superior medial protocerebrum neuron   277
#> 1620                         adult fan-shaped body vertical delta neuron   354
#> 1624                                           adult fruitless MB neuron   682
#> 1700                                             adult gamma Kenyon cell  1040
#> 1701                                          adult glutamatergic neuron  5666
#> 2573               adult multiglomerular antennal lobe projection neuron   210
#> 2658                                                        adult neuron 18026
#> 5060                                              alpha/beta Kenyon cell   629
#> 5061                                         alpha/beta core Kenyon cell  1019
#> 5063                                      alpha/beta surface Kenyon cell   595
#> 5064                                 alpha/beta surface/core Kenyon cell   211
#> 5073                     antennal lobe projection neuron of ALl1 lineage   281
#> 5217                                             embryonic/larval neuron  4104
#> 5224                                              gamma main Kenyon cell   614
#> 5634                     larval mushroom body second order output neuron   208
#> 5708                                         lobula columnar neuron LC10   627
#> 5710                                         lobula columnar neuron LC12   439
#> 5742                            lobula-lobula plate columnar neuron LLPC   328
#> 5764                        medial antennal lobe tract projection neuron   248
#> 5769                                        medulla columnar neuron MC61   347
#> 5792                                   mushroom body dopaminergic neuron  1933
#> 5835                                                              neuron  7288
# }