View source: R/hemibrain_reroot.R
hemibrain_reroot | R Documentation |
Re-root neurons by predicting their soma location. Somas have been manually tagged by the FlyEM project.
However, in some cases the roots are wrong, or somas are outside of the volume. The Fly Connectome team at the University of Cambridge has
manually tagged better root points for these neurons. Soma locations, updated by this work, as saved as hemibrain_somas
in this package.
A user can read somas from here, or get a bleeding edge version from
the Google Sheet. Alternatively, they
can 'estimated' a good root-point. This works by finding the longest path outside of a given neuropil mesh/meshes, as in insect
neurons the soma should be located in a cortex outside of the neuropil proper.
hemibrain_reroot(
x,
method = c("manual", "estimated"),
meshes = NULL,
googlesheet = FALSE,
hemibrain_somas = hemibrainr::hemibrain_somas,
...
)
x |
a |
method |
whether to use the manually curated soma list or estimate soma location. |
meshes |
a list/a single object of class |
googlesheet |
logical, whether to read soma locations from the Google Sheet
if |
hemibrain_somas |
a |
... |
methods sent to |
flywire_nuclei |
a |
try_hairball |
logical, if TRUE when a match to flywire_nuclei cannot be foudn soma is estimated using fafbseg:::reroot_hairball. |
rootid_backup |
logical, if TRUE then if the nucleus_id cannot be used, attempt to use root_id with result rfom fafbseg::flywire_nuclei. |
a nat::neuronlist
or nat::neuron
object
flow_centrality
, hemibrain_somas
# Choose some known trouble makers
bad.soma = c("5813015982","885788485","5813013913")
# Read in these neurons
neurons.bs = neuprintr::neuprint_read_neurons(bad.soma)
# Re-root
neurons = hemibrain_reroot(neurons.bs, meshes = hemibrain.surf)
## Not run:
# Let's check that this worked. Old root in red, new in green
nat::nopen3d()
for(i in 1:length(neurons)){
n = neurons[[i]]
bs = neurons.bs[[i]]
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, col = "green")
spheres3d(nat::xyzmatrix(bs)[nat::rootpoints(bs),],radius=500, alpha=0.5, col = "red")
p = readline("Done? ")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.