Call hemibrain_reroot on neurons read from the hemibrain neuprintr project, that have no marked soma, and hemibrain_remove_bad_synapses on all neurons. Does not prune synapses from soma positions / along the primary neurite, but does remove synapses outside of the hemibrain volume.

hemibrain_skeleton_check(
  x,
  meshes = hemibrainr::hemibrain.surf,
  min.nodes.from.soma = 100,
  min.nodes.from.pnt = 5,
  OmitFailures = FALSE,
  ...
)

Arguments

x

a nat::neuronlist or nat::neuron object. It is assumed that this neuron has been read in by neuprintr::neuprint_read_neurons or possibly catmaid::read.neurons.catmaid.

meshes

a list/a single object of class mesh3d or hxsurf. Defaults to hemibrain.surf. See examples for alternatives.

min.nodes.from.soma

the minimum number of nodes (geodesic distance) a synapse can be from the soma. Synapses closes than this will be removed. For comparable results across neurons, recommended to use nat::resample on your neurons before using.

min.nodes.from.pnt

the minimum number of nodes (geodesic distance) a synapse can be from a point along the primary neurite. Synapses closes than this will be removed.

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.

...

methods sent to nat::nlapply

Value

a nat::neuronlist or nat::neuron object

See also

Examples

# \donttest{ # Choose some known trouble makers ids = c("5813056323", "579912201", "5813015982", "973765182", "885788485", "915451074", "5813032740", "1006854683", "5813013913", "5813020138", "853726809", "916828438", "5813078494", "420956527", "486116439", "573329873", "5813010494", "5813040095", "514396940", "665747387", "793702856", "451644891", "482002701", "391631218", "390948259", "390948580", "452677169", "511262901", "422311625", "451987038" ) # just use a subset for documentation purposes ids=ids[1:3] # Read in these neurons neurons = neuprintr::neuprint_read_neurons(ids) if (FALSE) { # Get all the roi meshes hemibrain.rois = hemibrain_roi_meshes() ## Using this as the argument for 'meshes' will also ## give you the ROI for each point and synapse in a neuron's skeleton!! # Re-root neurons.checked = hemibrain_skeleton_check(neurons, meshes = hemibrain.rois) } # Alternatively, we can do this faster using a single surface model for the # whole hemibrain neurons.checked = hemibrain_skeleton_check(neurons, meshes = hemibrain.surf)
#> Re-rooting 1 neurons without a soma
#> Removing synapses outside the hemibrain neuropil volume for 3 neurons
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
if (FALSE) { # Let's check that this worked nat::nopen3d() for(n in neurons.checked){ clear3d(); message(n$bodyid) plot3d(n,col="brown",lwd=2) points3d(nat::xyzmatrix(n$connectors),col="black") spheres3d(nat::xyzmatrix(n)[nat::rootpoints(n),],radius=500, alpha=0.5) p = readline("Done? ") } }# }