navis.split_axon_dendrite¶
- navis.split_axon_dendrite(x, metric='synapse_flow_centrality', flow_thresh=0.9, split='prepost', cellbodyfiber=False, reroot_soma=True, label_only=False)[source]¶
Split a neuron into axon and dendrite.
The result is highly dependent on the method and on your neuron’s morphology and works best for “typical” neurons.
- Parameters:
x (TreeNeuron | MeshNeuron | NeuronList) – Neuron(s) to split into axon, dendrite (and cell body fiber if possible).
metric ('synapse_flow_centrality' | 'bending_flow' | 'segregation_index' | "flow_centrality", optional) –
Defines which flow metric we will try to maximize when splitting the neuron(s). There are four flavors:
’synapse_flow_centrality’ via
synapse_flow_centrality()
(note that this metric was previously called just “flow_centrality”)’bending_flow’ via
bending_flow()
’segregation_index’ via
arbor_segregation_index()
’flow_centrality’ via
flow_centrality()
Will try using existing columns in the node table. If not present, will invoke the respective functions with default parameters. All but flow_centrality require the neuron to have connectors.
flow_thresh (float [0-1]) – The “linker” between axon and dendrites will be the part of the neuron with the highest flow (see metric). We define it by
max(flow) * flow_thresh
. You might have to decrease this value for atypical or not well segregated neurons.split ('prepost' | 'distance') –
Method for determining which compartment is axon and which is the dendrites:
’prepost’ uses number of in- vs. outputs
’distance’ assumes the compartment proximal to the soma is the dendrites
cellbodyfiber ("soma" | "root" | False) –
Determines whether we will try to find a cell body fiber (CBF).
”soma” will try finding the CBF only if the neuron has a soma
”root” will consider the root to be the source of the CBF as fallback if there is no soma
False will not attempt to extract the CBF
A CBF is something typically found in insect neurons which are not bipolar unlike most vertebrate neurons but rather have a passive soma some distance away from axon/dendrites.
reroot_soma (bool,) – If True and neuron has a soma, will make sure the neuron is rooted to its soma.
label_only (bool,) – If True, will not split the neuron but rather add a “compartment” column to the node and connector table of the input neuron.
parallel (bool) – If True and input is NeuronList, use parallel processing. Requires pathos.
n_cores (int, optional) – Numbers of cores to use if
parallel=True
. Defaults to half the available cores.progress (bool) – Whether to show a progress bar. Overruled by
navis.set_pbars
.omit_failures (bool) – If True will omit failures instead of raising an exception. Ignored if input is single neuron.
- Returns:
Axon, dendrite, linker and CBF (the latter two aren’t guaranteed). Fragments will have a new property
compartment
(see example).- Return type:
Examples
>>> import navis >>> x = navis.example_neurons(1) >>> split = navis.split_axon_dendrite(x, metric='synapse_flow_centrality', ... reroot_soma=True) >>> split <class 'navis.NeuronList'> of 3 neurons neuron_name id n_nodes n_connectors compartment 0 neuron 123457 16 148 0 axon 1 neuron 123457 16 9682 1766 linker 2 neuron 123457 16 2892 113 dendrite >>> # For convenience, split_axon_dendrite assigns colors to the resulting >>> # fragments: axon = red, dendrites = blue, CBF = green >>> _ = split.plot3d(color=split.color)
Alternatively just label the compartments
>>> x = navis.split_axon_dendrite(x, label_only=True) >>> x.nodes[~x.nodes.compartment.isnull()].head() node_id label x y z radius parent_id type compartment 110 111 0 17024.0 33790.0 26602.0 72.462097 110 slab linker 111 112 0 17104.0 33670.0 26682.0 72.462097 111 slab linker 112 113 0 17184.0 33450.0 26782.0 70.000000 112 slab linker 113 114 0 17244.0 33270.0 26822.0 70.000000 113 slab linker 114 115 0 17324.0 33150.0 26882.0 74.852798 114 slab linker
See also
navis.heal_skeleton()
Axon/dendrite split works only on neurons consisting of a single tree. Use this function to heal fragmented neurons before trying the axon/dendrite split.