An arbor in this context is a tight-packing sub-neuronal tree of a neuron morphology. This arborization of a morphology is done by the Auto-Arbor program (Peng et al., Nature, 2021). The automatic arbor detection algorithm operates under the assumption that a morphology can be represented as a graph, wherein each node corresponds to a vertex, and the parent-child compartment relations are treated as edges. It leverages spectral clustering techniques to partition all nodes into various number of clusters, which we call arbors in this work.
Within our current framework, we treat each dendrite as a separate arbor, and the axons are segmented into one or several arbors using the Auto-Arbor (autoarbor_v1_yf.py
). While users can utilize original version of the registered version of SWCs as input, we highly recommend employing down-sampled SWCs to enhance calculation speed. In our own practice, we down-sampled each SWC, achieving a morphology with approximately 80-micron spaced intervals, utilizing the resample_swc
plugin and sorting the nodes using sort_neuron_swc
plugin available in Vaa3D.
For testing purposes, we have included several down-sampled examples within the data
folder. These examples are readily accessible, and anyone is welcome to explore with them.
The generation of axonal arbors can be divided into 3 steps:
-
Run the initial round of automatic arbor detection using the
run_arbor_r2.py
script with the specified parameters, you can run the following command in bash:python run_arbor_r2.py --r 1 --L 1 --H 4
This command will execute the script with the following parameter settings:
--r: first round of arbor generation
--L: minimal number of arbors for axons from a single neuron
--H: maximal number of arbors for axons from a single neuron
This command will generate the arbors in the format of SWC files, and their statistics in a separate txt
file.
-
Calculate the median number of arbors for each projection-differentiated soma-types. Based on the statistical
txt
files generated in the previous step and the neuronal categorizing file:../../common_lib/41586_2021_3941_MOESM4_ESM.csv
, you can calculate the median number of arbors for each neuronal subtypes. An example of such file can be found in "log/axonal_arbor_params_round2.csv" -
Run the second round of automatic arbor detection using the median arbor numbers with the following command in your Bash terminal:
python run_arbor_r2.py --r 2 --L 0 --H 0
You can create a new folder, for example, ../data/axon_arbors_round2
, and move all generated files into the folder.
To extract features using the arbor_analyzer_r2.py
script located in the analyses
directory, you can follow these instructions:
- To Get Features for All Soma-Types:
-
Execute the following command to extract features for all soma-types:
python arbor_analyzer_r2.py
This command will run the feature extraction script and generate feature files for all soma-types.
- To Get Features for Projection-Differentiated Soma-Types:
-
Set the
soma_type_merge
argument to False in the script. You may need to edit the script to change this parameter. -
Re-run the script with the updated parameter:
python arbor_analyzer_r2.py
This command will run the feature extraction script with the argument soma_type_merge
set to False, resulting in feature files specifically for projection-differentiated soma-types.
-
After running these commands, you should have two sets of feature files for each neurite type (axonal, dendritic):
features_r2_somaTypes_{neurite_type}.pkl
: Features for all soma-types.features_r2_projAndSomaTypes_{neurite_type}.pkl
: Features for projection-differentiated soma-types.
Make sure you are in the correct working directory where the script arbor_analyzer_r2.py is located and where the data files are present.
- Generate the feature dotted heatmap for arbor features: Turn on the specific plotting functions in the script
arbor_analyzer_r2.py
. - Other panels can be found in the R scripts and ipython notebook files in the
analyses
directory. Related input and intermediate files can be found in../../data_notebook/arbors
. The examplar and intermediate files are stored atdata/Fig5