Extract the cell body fibre for an insect neuron, assuming that this neuron has a soma and that the soma is the neuron's root. Based on the nat::simplify_neuron neuron function. Alternatively, extract the primary branch point by a different method that counts the numbers of leaf nodes downstream of each branch from a branch point. The primary branchpoint is chosen as the branchpoint where (number of leaf nodes/synapses on branch one)*(number on branch two) is the greatest. Synapses are used when available, leaf nodes if not.

primary_neurite(x, neuron = TRUE, invert = FALSE, ...)

# S3 method for neuron
primary_neurite(x, neuron = TRUE, invert = FALSE, ...)

# S3 method for neuprintneuron
primary_neurite(x, neuron = TRUE, invert = FALSE, ...)

# S3 method for catmaidneuron
primary_neurite(x, neuron = TRUE, invert = FALSE, ...)

# S3 method for neuronlist
primary_neurite(x, neuron = TRUE, invert = FALSE, ...)

primary_branchpoint(x, primary_neurite = FALSE, first = FALSE, ...)

# S3 method for neuron
primary_branchpoint(x, primary_neurite = FALSE, first = FALSE, ...)

# S3 method for neuronlist
primary_branchpoint(x, primary_neurite = FALSE, first = FALSE, ...)

Arguments

x

a nat::neuronlist or nat::neuron object

neuron

logical, whether to return a neuron/neuronlist object (TRUE) or the IDs for nodes in the primary neurite

invert

logical, whether to return the primary neurite (TRUE) or the rest of the neuron with its primary neurite removed (FALSE). (note: not x$d$PointNo, but rownames(x$d)).

...

methods sent to nat::nlapply.

primary_neurite

logical, if TRUE only branchpoints in the cable extracted by primary_neurite can be chosen.

first

if a number between 0-1, then the first branchpoint from the root that meets the requirement of max(score)*first, fill be chosen as the primary branchpoint. The score of each branchpoint is calculated as (number of leaf nodes/synapses on branch one)*(number on branch two). This is important to use if, for example, dealing with neurons that have small dendrites distributed off of the main body of the neuron, such as Kenyon cells.A value of 0.25 often works well.

Value

a neuron or neuronlist when using primary neurite.

See also

Examples

# \donttest{ # Get neuron neuron = neuprintr::neuprint_read_neurons("451987038") # Extract primary neurite pnt = primary_neurite(neuron) if (FALSE) { # Plot the primary neurite nat::nopen3d() plot3d(pnt, lwd = 2, col = "#C70E7B", soma = 1000) plot3d(neuron, lwd = 2, col = "grey30") }# }