neuprint_read_neurons is a full service function that tries to build as complete neuron objects as possible. Choose whether or not to heal the fetched skeletons, assign a soma (if tagged in neuprint) and assign synapses to approximate treenode positions, in the style of neuron objects used by the rcatmaid package.

If neuprint_read_skeletons is used, just a simple skeleton is retrieved.

neuprint_read_neurons(
  bodyids,
  meta = TRUE,
  nat = TRUE,
  drvid = FALSE,
  soma = TRUE,
  heal = TRUE,
  heal.threshold = 1000,
  connectors = TRUE,
  all_segments = TRUE,
  dataset = NULL,
  resample = FALSE,
  conn = NULL,
  OmitFailures = TRUE,
  ...
)

neuprint_read_skeletons(
  bodyids,
  dataset = NULL,
  conn = NULL,
  heal = TRUE,
  heal.threshold = 1000,
  ...
)

neuprint_read_neurons_simple(bodyids, ...)

Arguments

bodyids

the body IDs for neurons/segments (bodies) you wish to query. This can be in any form understood by neuprint_ids.

meta

whether or not to fetch a meta data for the given bodyids, using neuprint_get_meta

nat

whether or not to read neurons are nat::neuronlist objects (TRUE) or get SWC data frame (FALSE)

drvid

whether or not to use drvid::read.neuron.dvid rather than a cypher post request to neuprint_fetch_custom, in order to read a neuron. This might be faster, and this might also enable access to skeletons on an underlying DVID database that have not yet been ported to neuprint.

soma

whether or not to fetch a possible soma location for the given bodyids, using neuprint_locate_soma

heal

whether or not to heal a fragmented skeleton using a minimum spanning tree, via nat::stitch_neurons_mst

heal.threshold

distance in raw units beyond which isolated fragments will not be merged onto the main skeleton. The default of 1000 implies 8000 nm for the hemibrain dataset. Use Inf to merge all fragments.

connectors

whether or not to add synapse data to the retrieved skeletons in the format used by the rcatmaid package, for easy use with rcatmaid or catnat functions. This can be done for synapse-less skeletons using neuprint_assign_connectors

all_segments

if TRUE, all bodies are considered, if FALSE, only 'Neurons', i.e. bodies with a status roughly traced status.

dataset

optional, a dataset you want to query. If NULL, the default specified by your R environ file is used or, failing that the current connection, is used. See neuprint_login for details.

resample

if a number, the neuron is resampled using nat::resample, stepsize = resample. If 0 or FALSE (default), no resampling occurs.

conn

optional, a neuprintr connection object, which also specifies the neuPrint server. If NULL, the defaults set in your .Rprofile or .Renviron are used. See neuprint_login for details.

OmitFailures

Whether to omit neurons for which FUN gives an error. The default value (NA) will result in nlapply stopping with an error message the moment there is an error. For other values, see details.

...

methods passed to neuprint_login

Value

a data frame in SWC format, or a

nat::neuronlist/nat::neuron object as used by the nat and catmaid packages

Examples

# \donttest{
neurons = neuprint_read_neurons(c(818983130, 1796818119))
library(nat)
#> Loading required package: rgl
#> Some nat functions depend on a CMTK installation. See ?cmtk and README.md for details.
#> 
#> Attaching package: ‘nat’
#> The following object is masked from ‘package:rgl’:
#> 
#>     wire3d
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, union
plot3d(neurons, col = "purple", lwd = 2)

## In this example, in hemibrain:v1.0, an erroneously connected bit
## of neuron skeleton is removed.
n1 = neuprint_read_neurons(5812980863, heal.threshold = 20e3)
## compare with
n2 = neuprint_read_neurons(5812980863, heal = FALSE)
# }
# \donttest{
dl1s=neuprint_read_skeletons('DL1 adPN')
#> Error in neuprint_ids(bodyids, conn = conn, dataset = dataset): No valid ids provided!
plot(dl1s, WithNode=FALSE)
#> Error in eval(expr, envir, enclos): object 'dl1s' not found
# }