The goal of neuprintr is to provide R client utilities for interacting with the neuPrint connectome analysis service. neuPrint is set of tools for loading and analysing connectome data into a Neo4j database. You can find neuprint on Github. There is also a great python client available from Philipp Schlegel, neuprint-python if that’s your thing. neuPrint is currently being used for connectome analysis in aid of neuronal reconstruction efforts at Janelia Research Campus. The main focus is analysis of the hemibrain, densely reconstructed adult Drosophila brain dataset available at https://neuprint.janelia.org/. For more information, have a look here. Using this R package in concert with the natverse ecosystem is highly recommended.

Tutorial

To help you get to grips with neuprintr, we have made a tutorial in classic presentation form. This tutorial uses data from the Janelia Fly EM team’s hemibrain project. You can also see the vignettes in this package for the same examples and more.

Accessing hemibrain data using Neuprintr from Alexander Bates

Installation

# install
if (!require("devtools")) install.packages("devtools")
devtools::install_github("natverse/neuprintr")

# use 
library(neuprintr)

Authentication

In order to use neuprintr you will need to be able to login to a neuPrint server and be able to access it underlying Neo4j database. You may need an authenticated accounted, or you may be able to register your @gmail address without an authentication process. Navigate to a neuPrint website, e.g. https://neuprint.janelia.org, and hit ‘login’. Sign in using an @gmail account. If you have authentication/the server is public, you will now be able to see your access token by going to ‘Account’:

access your bearer token

To make life easier, you can then edit your .Renviron file to contain information about the neuPrint server you want to speak with, your token and the dataset hosted by that server, that you want to read. A convenient way to do this is to do

usethis::edit_r_environ()

and then edit the file that pops up, adding a section like

neuprint_server="https://neuprint.janelia.org"
# nb this token is a dummy
neuprint_token="asBatEsiOIJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImIsImxldmVsIjoicmVhZHdyaXRlIiwiaW1hZ2UtdXJsIjoiaHR0cHM7Ly9saDQuZ29vZ2xldXNlcmNvbnRlbnQuY29tLy1QeFVrTFZtbHdmcy9BQUFBQUFBQUFBDD9BQUFBQUFBQUFBQS9BQ0hpM3JleFZMeEI4Nl9FT1asb0dyMnV0QjJBcFJSZlI6MTczMjc1MjU2HH0.jhh1nMDBPl5A1HYKcszXM518NZeAhZG9jKy3hzVOWEU"

Make sure you have a blank line at the end of your .Renviron file. Note that you can optionally specify a default dataset:

neuprint_dataset = "hemibrain:v1.0"

if your neuPrint server has more than one dataset. For further information about neuprintr login, see the help for neuprint_login().

Finally you can also login on the command line once per session, like so:

conn = neuprint_login(server= "https://neuprint.janelia.org/",
   token= "asBatEsiOIJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImIsImxldmVsIjoicmVhZHdyaXRlIiwiaW1hZ2UtdXJsIjoiaHR0cHM7Ly9saDQuZ29vZ2xldXNlcmNvbnRlbnQuY29tLy1QeFVrTFZtbHdmcy9BQUFBQUFBQUFBDD9BQUFBQUFBQUFBQS9BQ0hpM3JleFZMeEI4Nl9FT1asb0dyMnV0QjJBcFJSZlI6MTczMjc1MjU2HH0.jhh1nMDBPl5A1HYKcszXM518NZeAhZG9jKy3hzVOWEU")

This is also the approach that you would take if you were working with more than two neuPrint servers.

Example

Now we can have a look at what is available

# What data sets are available?
neuprint_datasets()

# What's the underlying database
neuprint_database()

# What are the regions of interrst in your default datasest (specified in R.environ, see ?neuprint_login)
neuprint_ROIs()

Use the client to request data from neuprint. The neuprint_fetch_custom method will run an arbitrary cypher query against the database. For information about the neuprint data model, see the neuprint explorer web help: https://neuprint.janelia.org/help.

Some cyphers and other API endpoints have been explored by this package. Have a look a the functions, for example, that give you neuron skeletons, synapse locations, connectivity matrices, etc.

?neuprint_search
?neuprint_get_adjacency_matrix
?neuprint_ROI_connectivity
?neuprint_get_synapses
?neuprint_read_neurons

Example data

Acknowledging the data and tools

neuPrint comprises a set of tools for loading and analyzing connectome data into a Neo4j database. Analyze and explore connectome data stored in Neo4j using the neuPrint ecosystem: neuPrintHTTP, neuPrintExplorer, Python API.

This package was created by Alexander Shakeel Bates and Gregory Jefferis with Romain Franconville now providing key contributions. You can cite this package as:

citation(package = "neuprintr")

Bates AS, Franconville R, Jefferis GSXE (2019). neuprintr: R client utilities for interacting with the neuPrint connectome analysis service. R package version 0.4.0. https://github.com/natverse/neuprintr