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.

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
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 a specific version of this package as:

citation(package = "neuprintr")

To cite package 'neuprintr' in publications use:

  Alexander Bates, Gregory Jefferis and Romain Franconville (2021).
  neuprintr: R client utilities for interacting with the neuPrint
  connectome analysis service. https://natverse.org/neuprintr,
  https://github.com/natverse/neuprintr.

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {neuprintr: R client utilities for interacting with the neuPrint connectome analysis service},
    author = {Alexander Bates and Gregory Jefferis and Romain Franconville},
    year = {2021},
    note = {https://natverse.org/neuprintr, https://github.com/natverse/neuprintr},
  }

however we would appreciate if you would cite the natverse journal article in which neuprintr was first introduced. You can get full citation details for that as follows:

citation(package = "natverse")

If you use the natverse, please cite our paper (Bates, Manton et al,
eLife 2020). You may need to cite additional publications if you use
specific packages that implement specialised algorithms or provide
datasets for reanalysis. Use a command like:
citation(package="flycircuit") to see if there is a specific citation
to use for a given package in addition to the general natverse paper.

Bates AS, Manton JD, Jagannathan SR, Costa M, Schlegel P, Rohlfing T,
Jefferis GSXE (2020). "The natverse, a versatile toolbox for combining
and analysing neuroanatomical data." _Elife_, *9*. doi:
10.7554/eLife.53350 (URL: https://doi.org/10.7554/eLife.53350), <URL:
https://doi.org/10.7554/eLife.53350>.

A BibTeX entry for LaTeX users is

  @Article{Bates:2020aa,
    author = {Alexander Shakeel Bates and James D. Manton and Sridhar R. Jagannathan and Marta Costa and Philipp Schlegel and Torsten Rohlfing and Gregory S. X. E. Jefferis},
    journal = {Elife},
    month = {Apr},
    title = {The natverse, a versatile toolbox for combining and analysing neuroanatomical data},
    volume = {9},
    year = {2020},
    doi = {10.7554/eLife.53350},
    url = {https://doi.org/10.7554/eLife.53350},
  }