Read standardised neurons from neuromorpho.org, given a single, or vector of, neuron ID or neuron name. Neurons can be returned as SWC-style data frames or as a nat package neuron/neuronlist object, that can be be plotted in 3D using rgl and analysed with tools from the nat ecosystem. Each neuron in the neuromorpho repository is represented by a name, general information (metadata), the original and standardised SWC files of the digital morphological reconstruction (see details on standardisation process), and a set of morphometric features (see details on available measures).

neuromorpho_read_neurons(
  neuron_name = NULL,
  neuron_id = NULL,
  nat = TRUE,
  batch.size = 2,
  meta = TRUE,
  light = TRUE,
  find = FALSE,
  progress = TRUE,
  neuromorpho_url = "http://neuromorpho.org",
  ...
)

neuromorpho_read_neuron(
  neuron_name = NULL,
  neuron_id = NULL,
  nat = TRUE,
  neuromorpho_url = "http://neuromorpho.org",
  ...
)

Arguments

neuron_name

a neuron name, or vector of neuron names, as recorded in the neuromorpho database. Names and neuron IDs can be found by searching the repository, for example via neuromorpho_search

neuron_id

a neuron ID, or vector of neuron IDs, as recorded in the neuromorpho database. If neuron_name is given this supersedes neuron_id, which is then treated as if its value were NULL.

nat

if TRUE, neurons are returned formatted as a neuron object, in a neuronlist See details for more information. Otherwise, a data frame is returned in the SWC file type format. If TRUE, the resulting neuronlist object's associated meta data will be pulled using neuromorpho_neuron_meta

batch.size

the number of requests sent at once to the neuromorpho.org, using multi_run. Requests are sent to neuromorpho.org in parallel to speed up the process of reading neurons. Batches of queries are processed serially. Increasing the value of batch.size may reduce read time.

meta

if TRUE, meta data is retrieved for the returned neuronlist or list object, using neuromorpho_neuron_meta.

light

if TRUE, the only a subset of the full meta data for each neurons is returned with the resulting neuronlist.

find

if TRUE, then we scrape each neuron's webpage to find the correct link to download its SWC file. This is more stable, but more time consuming, than setting find = FALSE and using the standard neuromorpho.org format for the download link. If the database changes, or you cannot find your neuron even though you know it exists, try setting find = TRUE

progress

if TRUE or a numeric value, a progress bar is shown. The bar progresses when each batch is completed. If TRUE, or 100, the bar completes where all batches are done.

neuromorpho_url

the base URL for querying the neuromorpho database, defaults to http://neuromorpho.org

...

methods passed to neuromorpho_async_req, or in some cases, neuromorphr:::neuromorpho_fetch

Value

if nat = TRUE, then a neuronlist object is returned. If FALSE, then a list of data frames for neuron morphologies in SWC format are returned.

Details

A single neuron can be read using using neuromorpho_read_neuron, or multiple using neuromorpho_read_neurons. If nat = TRUE, then neurons are returned as a neuron object, If multiple neurons are returned, they will be given together in a neuronlist. This format and its manipulation is described in detail here. When using neuromorpho_read_neurons, meta data for the neuron is also returned using neuromorpho_neuron_meta. If light = TRUE, then only a subset of this metadata is returned, i.e. the fields: neuron_id neuron_name species brain_region cell_type archive . Note that since neurons are reconstructed from many different neural systems and species, there is no 'standard' orientation. Instead, neuromorpho.org's standardisation process orients the morphologies by placing the soma in the origin of coordinates and aligning the first three principal components of all XYZ coordinates with heights, width, and depth.

Examples

if (FALSE)  # Let's get all the elephant neurons in the repository

## First, we need to find their names or IDs
elephant.df = neuromorpho_search(search_terms="species:elephant")

## Let's see what cell types we have here
t = table(elephant.df$cell_type)
#> Error in table(elephant.df$cell_type): object 'elephant.df' not found
t
#> function (x) 
#> UseMethod("t")
#> <bytecode: 0x7fbf8bceb380>
#> <environment: namespace:base>

## We have many pyramidal cells. Let's get those.
neuron_names = subset(elephant.df, cell_type == names(t)[which.max(t)])$neuron_name
#> Error in subset(elephant.df, cell_type == names(t)[which.max(t)]): object 'elephant.df' not found

## Now we are ready to read some neurons!
elephant.principal.cells = neuromorpho_read_neurons(neuron_name = neuron_names, nat = TRUE)
#> Error in neuromorpho_read_neurons(neuron_name = neuron_names, nat = TRUE): object 'neuron_names' not found

## Great, now we can plot them
nopen3d()
#> Error in nopen3d(): could not find function "nopen3d"
plot3d(elephant.principal.cells, soma=T)
#> Error in plot3d(elephant.principal.cells, soma = T): could not find function "plot3d"

## And get some summary information on the skeleton we have retrieved
summary(elephant.principal.cells)
#> Error in summary(elephant.principal.cells): object 'elephant.principal.cells' not found