neuron_morphology_tools package
Submodules
neuron_morphology_tools.morphopy_utils module
Purpose: Utils functions for using the morphopy module to compute morphology statistics of a neuron
cell types were saved in https://raw.githubusercontent.com/berenslab/mini-atlas/master/data/m1_patchseq_meta_data.csv
- neuron_morphology_tools.morphopy_utils.morphometrics(N=None, swc=None, depth=100, thickness=1000, cell_id=None, stats_to_remove=('dendrite z-profile', 'axon z-profile', 'axon soma-centered z-profile', 'dendrite soma-centered z-profile'))[source]
- neuron_morphology_tools.morphopy_utils.ntree_obj_from_swc(swc=None, filepath=None, plot=False)[source]
- neuron_morphology_tools.morphopy_utils.plot_ntree(N, figsize=(10, 5), xlim=None, ylim=None, zlim=None)[source]
Ex: mpu.plot_ntree(ntree_obj,ylim = [-300,100])
neuron_morphology_tools.neuron_nx_feature_processing module
- neuron_morphology_tools.neuron_nx_feature_processing.add_any_missing_node_features(G, features=None, verbose=False, inplace=False)[source]
Purpose: 1) Check that all the features are requested 2) Generate the features that are not
- neuron_morphology_tools.neuron_nx_feature_processing.add_node_feature(G, feature_func, feature_name=None, nodes=None, inplace=True, verbose=False, default_value=None, feature_value_dict=None, verbose_loop=False)[source]
Puprose: Will apply an feature_func to a node based on the current node values
- neuron_morphology_tools.neuron_nx_feature_processing.add_skeleton_vector_features(G, use_polar_coords=True, verbose=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.compartment_one_hot(node_dict, compartment)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.feature_clip(row_dict, feature_name, a_min=0, a_max=100000)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.features_list(G, limb_branch_features=True, features_to_ignore=('u',), verbose=False)[source]
Purpose: Find all of the current features
Ex: from neuron_morphology_tools from neurd import neuron_nx_feature_processing as nxf nxf.features_list(G)
- neuron_morphology_tools.neuron_nx_feature_processing.filter_G_features(G, features=None, inplace=False, verbose=False)[source]
Purpose: To reduce a networkx graph to a certain number of features (and all other superflous features are deleted)
Ex: axon_vs_dendrite_features = [ “mesh_volume”, “n_spines”, “total_spine_volume”, “n_synapses_post”, “n_synapses_pre”, #”n_synapse_head”, #”parent_skeletal_angle”, “skeletal_length”, “skeleton_vector_upstream_theta”, “skeleton_vector_upstream_phi”, “skeleton_vector_downstream_theta”, “skeleton_vector_downstream_phi”, “width_upstream”, “width_no_spine”, “width_downstream”, ]
- G_feat_filt = nxf.filter_G_features(
G, features=axon_vs_dendrite_features, inplace = False, verbose = True,
)
xu.node_df(G_feat_filt)
- neuron_morphology_tools.neuron_nx_feature_processing.merge_axon_on_dendrite_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.merge_double_back_dendrite_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.merge_high_degree_branching_dendrite_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.merge_high_degree_branching_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.merge_low_degree_branching_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.merge_width_jump_up_axon_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.merge_width_jump_up_dendrite_label(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.min_dist_synapses_pre_downstream_clip(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.min_dist_synapses_pre_upstream_clip(row_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.skeleton_vector_downstream_phi(node_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.skeleton_vector_downstream_theta(node_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.skeleton_vector_downstream_x(node_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.skeleton_vector_downstream_y(node_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.skeleton_vector_downstream_z(node_dict)[source]
- neuron_morphology_tools.neuron_nx_feature_processing.skeleton_vector_upstream_phi(node_dict)[source]
neuron_morphology_tools.neuron_nx_io module
- neuron_morphology_tools.neuron_nx_io.GNN_info_axon_vs_dendrite(G, distance_threshold=100000, distance_threshold_min=None, remove_starter_branches=True, divide_into_limbs=False, label_name='axon_label', graph_label=None, return_filepaths=False, folder='./Axon_vs_Dendrite/', description='ax_vs_dendr', verbose=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_io.GNN_info_cell_type_fine(G, distance_threshold=None, distance_threshold_min=None, remove_starter_branches=True, divide_into_limbs=False, label_name=None, graph_label=None, axon_dendrite='dendrite', return_filepaths=False, folder='./Cell_Type_Fine/', description='cell_type_fine', verbose=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_io.GNN_info_compartment_proof(G, distance_threshold=None, distance_threshold_min=None, remove_starter_branches=True, divide_into_limbs=False, label_name=('axon_label', 'basal_label', 'apical_label'), graph_label=None, return_filepaths=False, folder='./Compartments_Proof/', description='compartment_proof', verbose=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_io.GNN_info_merge_errors(G, distance_threshold=None, distance_threshold_min=None, remove_starter_branches=True, divide_into_limbs=False, label_name=('merge_clean', 'merge_high_degree_branching_label', 'merge_low_degree_branching_label', 'merge_width_jump_up_axon_label', 'merge_axon_on_dendrite_label', 'merge_high_degree_branching_dendrite_label', 'merge_width_jump_up_dendrite_label', 'merge_double_back_dendrite_label'), graph_label=None, axon_dendrite=None, return_filepaths=False, folder='./Merge_Errors/', description='merge_errors', verbose=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_io.G_from_adj_feature_dict(adj_feature_dict=None, filepath=None, plot=False, verbose=False)[source]
Purpose: To recover the original graph stored in the adjacency dict information
Ex: from neuron_morphology_tools from neurd import neuron_nx_io as nxio G_rec = nxio.G_from_adj_feature_dict(
filepath = filepaths[1], plot = True, verbose = True )
- neuron_morphology_tools.neuron_nx_io.add_density_to_graph_data(data, verbose=False, replace_features=False, in_place=False)[source]
Purpose: To compute density features for all features that
1) Get the features to compute densities for and the columns they will be derived from 2) Compute the densities 3) Either replace existing columns or append
- neuron_morphology_tools.neuron_nx_io.add_density_to_graph_data_in_df(df, in_place=False, replace_features=False, verbose=False)[source]
Purpose: to increment the graph data in a dataframe storage with density attributes
- neuron_morphology_tools.neuron_nx_io.add_skeletal_length_xyz_to_df_x_features_x_pool(df, verbose=False)[source]
Purpsose: Want to add skeletal length to the features list and x features if didn’t already exist
Pseudocode: For each row in the dataframe: 1) Check if the [skeletal_length_x/y,z] in the features if not 2) Estimate the skeletal_length_x/y/z using the upstream_theta/phi for all of the branches 3) Add the skeletal_length_x/y/z names to the x_features_pool0 4)
- neuron_morphology_tools.neuron_nx_io.aggregate_embedding_df_by_seg_split(df, embed_cols, decoder_map, weight_by_skeleton=True)[source]
Purpose: Want a combined embedding from all the limbs
- neuron_morphology_tools.neuron_nx_io.combine_limb_graph_data(graph_data, limb_idx, return_cluster_matrix=True, flat_cluster_matrix=True, verbose=False, max_nodes=250, max_limbs=25, limb_attributes_to_add=None)[source]
- neuron_morphology_tools.neuron_nx_io.compressed_dict_from_G(G, features=None, graph_identifiers=('segment_id', 'split_index', 'nucleus_id', 'external_layer'), dense_adjacency=True, data_name='data')[source]
Creates a dictionary from a graph where the key/values are 1) global graph attributes 2) data: dictionary
nodelist: list o fnodes features: names of the features in feature matrix adjacency: dense adjacency matrix feature_matrix: matrix storing feature vectors for each node
- neuron_morphology_tools.neuron_nx_io.export_GNN_info_dict(G, features_to_output, axon_dendrite=None, remove_starter_branches=True, distance_threshold=100000, distance_threshold_min=None, divide_into_limbs=True, label_name=None, graph_label=None, feature_matrix_dtype='float', folder='./', filename=None, description=None, verbose=False, return_filepaths=False, return_G_before_output=False)[source]
To process a neuron object before output in dictionary format to be used by a GNN
- neuron_morphology_tools.neuron_nx_io.feature_df_from_gnn_info(gnn_info, return_data_labels_split=True, inf_fill_value=10000, add_negative_label=False, label_name=None)[source]
- neuron_morphology_tools.neuron_nx_io.limb_df_for_train_from_limb_df(df, limb_attributes_to_add_to_branches=('soma_start_angle_max', 'max_soma_volume', 'n_syn_soma'), node_weight_name='skeletal_length', edge_weight=False, edge_weight_method='max', add_pool_suffix=True, verbose=False, add_self_loops=False)[source]
- neuron_morphology_tools.neuron_nx_io.neuron_df_for_train_from_limb_df(df, sort_attributes=None, limb_attributes_to_add_to_branches=('soma_start_angle_max', 'max_soma_volume', 'n_syn_soma'), add_limb_attributes_to_branches_even_if_hierarchical=False, add_pool_suffix=True, node_weight_name='skeletal_length', edge_weight=False, edge_weight_method='max', export_pool1_clusters=True, hierarchical=False, attributes_pool1=('soma_start_angle_max',), attributes_pool1_extra=None, attributes_pool2=('max_soma_volume', 'n_syn_soma'), graph_type='binary_tree', add_density_to_graph_data=False, verbose=False, verbose_time=False)[source]
Purpose:
Creates a dataframe that has all of the necessary features for the dataset of a whole neuron
- returns:
‘segment_id’, ‘split_index’, ‘limb_idx’, ‘soma_start_angle_max’, ‘skeletal_length’, ‘max_soma_volume’, ‘n_syn_soma’, ‘table_of_origin’, ‘names_pool0’, #all the names of the nodes in the graph (48 for ex) ‘x_features_pool0’, #names of all of the features in the x (24)
# includes the hierarchical
‘x_pool0’, # values holding all the features for all the nodes (48x24) ‘edge_index_pool0’, all the bidirectional edges (172, 2) ‘node_weight_pool0’, the skeletal length that will be used for pooling (48,) ‘pool1_names’, # names as ints for next hierarchical layer (just the limb indexes) (5,) ‘pool1’, # the indexing that groups which nodes should be pooled together
# just giving the nodes ons the same limb the same index number
‘x_pool1’, #fvalues eatures to add on after 1st pooling (the soma start angle max) (5,1) ‘x_features_pool1’, #name of the features to add on after 1st pooling ‘edge_index_pool1’, #the edge index for all of the limbs ‘node_weight_pool1’, #weight for the pooling (total skeletal length) (5,) ‘x_pool2’, #values features to add on after 2nd pooling (synapses and max soma volume) (1,2) ‘x_features_pool2’ #names of the features to add on after 2nd pooling
- rtype:
Dataframe with the following columns
neuron_morphology_tools.neuron_nx_stats module
Purpose: To create functions that can compute statistics over a graph object (whether it be a full neuron graph or a subgraph)
- neuron_morphology_tools.neuron_nx_stats.add_summary_statistic_over_dynamic_attributes_to_G(G, attributes=('synapses', 'spines'), verbose=False)[source]
- neuron_morphology_tools.neuron_nx_stats.skeletal_length_downstream(G, node, include_self=True)[source]
- neuron_morphology_tools.neuron_nx_stats.skeleton_bounding_box(G, soma_relative=False, soma_center=None, verbose=False, return_dict=False)[source]
Purpose: To compute the bounding box of a certain limb based on the skeleton data
Pseudocode: 1) Get the skeleton nodes 2) Computes the bounding box of the scatter points 3) If soma_relative flag set –> subtracts the soma
- neuron_morphology_tools.neuron_nx_stats.starting_coordinate(G, attribute='endpoint_upstream', return_dict=False)[source]
Purpose: To find the startng centroid of a graph
Pseudocode: 1) Get the most upstream node
- neuron_morphology_tools.neuron_nx_stats.statistics_survey_from_graph(G, attributes_to_sum=None, attributes_to_mean=None, attributes_to_max=None, attributes_to_min=None, soma_center=None, compute_compartments=True, add_features=True, divisor=1000000000, attributes_to_divide={'spine_volume_sum': 1000000000}, verbose=False)[source]
Purpose: List of graph statistics that by default would want to measure
stats that need to be manually calculatd - n_nodes
- neuron_morphology_tools.neuron_nx_stats.summary_statistic_over_attributes(attributes, summary_statistic='mean', summary_statisic_args=None, weight=None, G=None, node_df=None, verbose=False, return_df=False, append_statistic_name=False)[source]
- neuron_morphology_tools.neuron_nx_stats.summary_statistic_over_dynamic_attribute(G, node, attribute, prefix=None, category_columns=None, attribute_summary_dicts=({'columns': 'volume', 'summary_statistic': 'sum', 'summary_statisic_args': None},), verbose=False, default_value=None, debug_time=False)[source]
Purpose: To get the dynamic attributes dictionary for a node in the graph
- neuron_morphology_tools.neuron_nx_stats.summary_statistic_over_spines(G, node, verbose=False, **kwargs)[source]
Calculates the total spine volume and number of spines
- Return type:
Dictionary with sums/counts
Example Output
{‘spine_volume_sum’: 26567481267.249374, ‘n_spines’: 88}
- neuron_morphology_tools.neuron_nx_stats.summary_statistic_over_synapses(G, node, verbose=False, **kwargs)[source]
Gets the number and total volume of synapses of a certain head/neck/shaft type and presyn/postsyn type
(and does for every super category)
- Return type:
Dictionary with sums/counts
Example Output
{‘synapse_volume_no_head_postsyn_sum’: 48932, ‘n_synapses_no_head_postsyn’: 16, ‘synapse_volume_no_head_sum’: 48932, ‘n_synapses_no_head’: 16, ‘synapse_volume_shaft_postsyn_sum’: 186960, ‘n_synapses_shaft_postsyn’: 44, ‘synapse_volume_shaft_sum’: 186960, ‘n_synapses_shaft’: 44, ‘synapse_volume_head_postsyn_sum’: 696432, ‘n_synapses_head_postsyn’: 65, ‘synapse_volume_head_sum’: 696432, ‘n_synapses_head’: 65, ‘synapse_volume_neck_postsyn_sum’: 4680, ‘n_synapses_neck_postsyn’: 3, ‘synapse_volume_neck_sum’: 4680, ‘n_synapses_neck’: 3, ‘synapse_volume_postsyn_sum’: 937004, ‘n_synapses_postsyn’: 128, ‘synapse_volume_sum’: 937004, ‘n_synapses’: 128}
neuron_morphology_tools.neuron_nx_utils module
Purpose: tools that will help process a neuron that is represented as a networkx graph
- neuron_morphology_tools.neuron_nx_utils.adjusted_scholl_coordinates(array, soma_coordinate, upstream_endpoint, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.all_compartment_conn_comp_subgraph_vector_stats(G, small_starter_branch_skeletal_length_min=1000, filter_starter_branches=True, upstream_dist_max=None, verbose=True, debug_idx=None, mesh=None, return_subgraphs=False, include_scholl_coordinates=True, include_scholl_coordinates_adjusted=True, return_df=False)[source]
Purpose: To divide a neuron into individual connected components of the interested compartments. and then to calculate the following stats about them
soma vector
skeleton vector
width
y above the soma
skeletal length
6) The intersection points at different lengths from the soma (on the xz plane) - predefine a stepsize and go as far as need be
Pseudocode: 1) Divide neuron into different compartment subgraphs 2) Divide all subgraphs into connected components (put into one list) 3) For each graph in the list compute: a. starting width b. starting y above the soma c. soma angle d. skeletal angle e. skeletal width f. intersection points of skeleton g. starting endpoint (for as far as can go or max distance)
- neuron_morphology_tools.neuron_nx_utils.all_compartment_conn_comp_subgraphs(G, compartments=None, verbose=False, return_compartments=True)[source]
Purpose: Divide a neuron graph into the connected components of each compartment type (so 2 oblique branches should be 2 different subgraphs)
- neuron_morphology_tools.neuron_nx_utils.all_compartment_skeletons(G, compartments=None, verbose=False, plot=False, mesh=None, return_empty_skeletons=False)[source]
Purpose: To get all the compartment skeletons from a graph
- neuron_morphology_tools.neuron_nx_utils.all_compartment_subgraphs(G, compartments=None, verbose=False, return_empty_graphs=False)[source]
- neuron_morphology_tools.neuron_nx_utils.attribute_graph_from_graph_obj(G, attribute, ids_name=None, verbose=False, return_attribute_nodes=False, return_attribute_nodes_to_branch_dict=True, return_upstream_dist=False, exclude_presyn=False)[source]
Purpose: To convert a graph object into a graph where an attribute of the graph object are the nodes along with the branch points. The edges between nodes will be the upstream distance.
Application: Will help find the distances between the attributes
- neuron_morphology_tools.neuron_nx_utils.axon_dendrite_nodes(G, compartment='axon', return_node_df=False)[source]
- neuron_morphology_tools.neuron_nx_utils.axon_dendrite_subgraph(G, compartment, include_soma=True, verbose=False, remove_node_method=True)[source]
- neuron_morphology_tools.neuron_nx_utils.axon_skeleton(G, include_path_to_soma=False, verbose=False, plot=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.calculate_soma_distance_to_data_objs(G, verbose=False, data_to_update=('synapse_data', 'spine_data', 'width_data'))[source]
Purpose: To set the soma distance for all attributes
Pseudocode: Iterate through all of the nodes with L in name 1) Find the path back to the soma 2) Calculate the sum of skeletal length back to the soma for each attrbute 3) Add skeletal length to the upstream dist to get the soma distance
- neuron_morphology_tools.neuron_nx_utils.clean_G(G, verbose=False, debug_time=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.clear_nodes_auto_proof_filter_feature(G, nodes, filter_feature='auto_proof_filter', verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.closest_node_to_coordinates(G, coordinates, node_coordinate_type='skeleton', closest_idx_algorithm='linalg', verbose=False, suppress_errors=False)[source]
Purpose: map a coordinate(s) to the closest branch (using branches’ endpoints, upstream endpoints or all skeleton data, midpoint, etc..)
Pseudocode: 1) Get a mapping of all of the coordinates to the node name 2) Do a kdtree mapping of coordinates to list of coordinates (or iteratively do the linalg.norm) to find the closest idx 3) Map closest idx to the label
- neuron_morphology_tools.neuron_nx_utils.cluster_and_downstream_filter_coordinates(G, coordinates, radius=5000, mapping_node_coordinate_type='skeleton', filter_away_downstream_nodes=True, verbose=False, return_downstream_skeletal_length=False, suppress_errors=True)[source]
Purpose: Given a set of edit coordinates want to filter them to non-redundant coordinates with the option of filtering away any coordinates that are downstream of others (can return nodes or coordinates)
Pseudocode: 1) Filter the coordinates with a radius thresholding – how to keep only those most upstream 2) Map the filtered coordinates to the closest branches 3) (Optional) Filter away any downstream branches 4) Return the branches are convert them to coordinates
- neuron_morphology_tools.neuron_nx_utils.compartment_from_node(G, n=None, replace_underscore=True)[source]
Purpose: To get the compartment from a node in a graph
- neuron_morphology_tools.neuron_nx_utils.compartment_nodes(G, compartment, include_path_to_soma=False, verbose=False)[source]
Ex: nxu.compartment_nodes(G_presyn,”apical_shaft”)
- neuron_morphology_tools.neuron_nx_utils.compartment_skeleton(G, compartment, include_path_to_soma=False, include_soma=False, verbose=False, plot=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.compartment_subgraph(G, compartment, include_path_to_soma=False, verbose=False, plot=False)[source]
Purpose: To get the axon skeleton (and optionally the skeleton in between axon and soma)
- neuron_morphology_tools.neuron_nx_utils.compartment_vector_width_stats_from_G(G, small_starter_branch_skeletal_length_min=1000, upstream_dist_max=None, min_skeletal_length_limb=10000, verbose=False)[source]
Purpose: To determine the max vector and weighted vector of all the compartments of a neuron
Download the neuron graph
Filter the neuron graph for small starter branches
- For each limb and then for each compartment:
Find if nodes exist with that label
Find the most upstream node
Determine the width of that node (using the width data and upstream search distance)
Save off the soma starting angle of that branch and the current skeleton angle and width
- For each compartment:
Find the soma starting vector and skeleton vector of the weighted options (weight by width_max and width)
5) Save off curr data to datajoint for each compartment: - angles (max and not max) - n_limbs in compartment
- neuron_morphology_tools.neuron_nx_utils.coordinate_array_with_node_map_from_G(G, coordinate_type='skeleton', nodes=None, suppress_errors=False, verbose=True)[source]
Purpose: to get two parallel arrays of coordinates pulled from a node somhow (skeletons points, midpoints, endpoints…) and the node name
Pseudocode: 1) For each node in limb branch: a. extract the coordinates b. Create an array of the same lenght with name of node
Possible coordinate types: 1) skeleton_data/skeleton 2) endpoints, endpoint_upstream, endpoint_downstream 3) mesh_center
- neuron_morphology_tools.neuron_nx_utils.coordinate_estimation_from_upstream_dist_from_node(G, n, attribute='spine_data')[source]
Purpose: To estimate the coordinates of the a data attribute with an upstream distance
Pseudocode: 1) Get the skeleton and calculate the distance between each 2) Get the cumulative distance 3) Find the two skeleton points it’s in between 4) Do a weighted average of the skeleton points after subtracting the cumulative distance
Ex: nxu.coordinate_estimation_from_upstream_dist_from_node(
G_postsyn, “L1_6”
).shape
- neuron_morphology_tools.neuron_nx_utils.coordinates_from_coordinate_type(G, node, coordinate_type)[source]
- neuron_morphology_tools.neuron_nx_utils.delete_attributes(G, inplace=True, attributes=None, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.dendrite_subgraph(G, include_soma=True, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.distance_downstream_from_soma(G, node, verbose=False, from_attributes=False, **kwargs)[source]
Ex: nxu.distance_downstream_from_soma(
G, “L0_19”, verbose = True,
)
- neuron_morphology_tools.neuron_nx_utils.distance_downstream_from_soma_df(G, nodes=None, from_attributes=False)[source]
- neuron_morphology_tools.neuron_nx_utils.distance_from_node_to_soma(G, node, include_self_distance=False, distance_attribute='skeletal_length', destination_node='S0', verbose=False, return_path=False)[source]
Purpose: To find the distance of a node from soma (both with inclusion and without of its own skeletal length)
Pseudocode: 1)
- neuron_morphology_tools.neuron_nx_utils.distance_from_soma_df(G, nodes=None, distance_type='upstream', from_attributes=False)[source]
Purpose: Find all the soma distances of all the nodes
- neuron_morphology_tools.neuron_nx_utils.distance_upstream_from_soma(G, node, verbose=False, from_attributes=False, **kwargs)[source]
nxu.distance_upstream_from_soma( G, “L0_19”, verbose = True, )
- neuron_morphology_tools.neuron_nx_utils.distance_upstream_from_soma_df(G, nodes=None, from_attributes=False)[source]
- neuron_morphology_tools.neuron_nx_utils.draw_tree(G, draw_type='dot', node_size=4000, font_size=20, font_color='white', figsize=(32, 32), compartment_colors=True, compartment_color_dict=None, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.export_swc_dicts(G, use_skeletal_coordinates=True, soma_node_name='S0', default_skeleton_pt='mesh_center', default_compartment='basal', center_on_soma=True, coordinate_divisor=1000, width_divisor=1000, verbose=False, return_df=False)[source]
Purpose: To convert a Graph Neuron Object into a SWC file dict objects by creating dictionaries of all of the points
Pseudocode: In a depth first search manner of searching For each node:
get the skeleton points
Get the compartment
Get the parent idx
- neuron_morphology_tools.neuron_nx_utils.export_swc_file(G, filename=None, filename_append=None, directory='./', filepath=None, verbose=False, header=True, **kwargs)[source]
Purpose: Create a SWC file from graph object
- neuron_morphology_tools.neuron_nx_utils.filter_axon_on_dendrite_splits_to_most_upstream(G, verbose=False, inplace=False, filter_out_only_if_parent_in_split=False, **kwargs)[source]
Purpose: To reduce the axon on dendrite merges to only those that are the most upstream of the group
Pseudocode: 1) Get all of the nodes that are in axon on dendrite mergers 2) For each node: a. Get either just the parent or all of the upstream node b. add node to list ot be cleared if has upstream axon on dendrite
Ex: G_filt = filter_axon_on_dendrite_splits_to_most_upstream(G,verbose = True) nxu.nodes_with_auto_proof_filter(G_filt,”axon_on_dendrite”)
- neuron_morphology_tools.neuron_nx_utils.filter_graph(G, remove_starter_branches=True, distance_threshold=None, distance_threshold_min=None, features_to_output=None, filter_away_soma=True, output_graph_type='Graph', verbose=False)[source]
Purpose: To filter the graph object before the GNN processes
Pseudocode: 1) Reduces to only dendrite subgraph 2) Removes any small starter nodes 3) Restricts to a certain distance 4) Filter to certain features 5) Filter into soma 6) Turn into non-directed graph
- neuron_morphology_tools.neuron_nx_utils.filter_small_starter_branches(G, skeletal_length_min=None, inplace=False, verbose=False, maintain_skeleton_connectivity=True, loop_until_fail=True, **kwargs)
Purpose: To remove small starter branches from the graph
Ex: nxu.remove_small_starter_branches(G,verbose = True)
Ex 2: new_G = nxu.remove_small_starter_branches(
G, skeletal_length_min = 100000000000,
)
- neuron_morphology_tools.neuron_nx_utils.fix_flipped_skeleton(G, verbose=False)[source]
Purpose: To fix the skeleton data in Graph objects if they are not aligned correctly
Ex: segment_id,split_index = 864691135162621741,0
- G_obj = hdju.graph_obj_from_auto_proof_stage(
segment_id=segment_id, split_index=split_index,
)
G_obj = fix_flipped_skeletons(G_obj,verbose = True)
- neuron_morphology_tools.neuron_nx_utils.fix_flipped_skeletons(G, verbose=False)[source]
Purpose: To fix the skeleton data in Graph objects if they are not aligned correctly
Ex: segment_id,split_index = 864691135162621741,0
- G_obj = hdju.graph_obj_from_auto_proof_stage(
segment_id=segment_id, split_index=split_index,
)
G_obj = fix_flipped_skeletons(G_obj,verbose = True)
- neuron_morphology_tools.neuron_nx_utils.fix_width_inf_nan(G, default_value=300, verbose=False)[source]
Purpose: to replace all inf width values in node with either the upstream, downstream width, or default value
Pseudocode: 1a) Try and get an upstream width 1b) Try and get a downstream width 1c) Use the default width 2) Go and replace all width values and in the width array with the default value
Width values to replace: - width (scalar) - width_new (a dictionary) - width_upstream (scalar) - width_downstream (scalar) - width_data: list of dict with width as key
- neuron_morphology_tools.neuron_nx_utils.inter_attribute_G_preprocessing(G, dendrite_only=True, remove_starter_branches=True)[source]
- neuron_morphology_tools.neuron_nx_utils.inter_attribute_intervals_dict_from_neuron_G(G, attribute=None, dendrite_only=True, remove_starter_branches=True, verbose=True, n_closest_neighbors=3, branch_features_to_add=('mesh_volume', 'n_synapses_head', 'n_synapses_neck', 'n_synapses_no_head', 'n_synapses_post', 'n_synapses_pre', 'n_synapses_shaft', 'n_synapses_spine', 'total_spine_volume', 'soma_distance_euclidean', 'parent_skeletal_angle', 'siblings_skeletal_angle_max', 'width_upstream', 'width_downstream'), shuffle_upstream_dist=False, attribute_sk_nullification=None, exclude_presyn=True, discretization_length=100, seed=None)[source]
Purpose: Want to build an inter attribute distance for all branches in a neuron
- neuron_morphology_tools.neuron_nx_utils.inter_attribute_intervals_from_G(G, attribute, n_closest_neighbors=1, default_value=-1, debug_time=False, plot=False, verbose=False, separate_branches=True, return_upstream_dist=True, exclude_presyn=True)[source]
Purpose: To find the k inter-attribute distances for the attributes on the graph
Turn the graph into an attribute graph
- For every attribute id:
Remove the attribute id from the total list a. For 1 to k (the number of attributes away):
if list empty then add distance of -1 and continue Calculate the closest neighbors from remaining nodes and get distance
Save the distance Remove that closest neighbor from the list
Return the lists of closest distances
- neuron_morphology_tools.neuron_nx_utils.internal_branching_coordinates(G, verbose=False)[source]
Purpose: Calculate the internal branch coordinates
Application: Can calculate the closest and farthest away internal branch points
Pseudocode: 2) Find all nodes not the leaf nodes and record their endpoints
- neuron_morphology_tools.neuron_nx_utils.internal_branching_coordinates_max_min(G, default_value=None, verbose=False, plot=False, return_dict=False, return_distance=False, suffix='_nm')[source]
Purpose: Find the farthest and closest internal branching point
Pseudocode: 1) Get the most upstream endpoint 2) Get all the internal branch points 3) Calculate the distance of all the internal branch points 4) Pick the largest and smallest distance
Ex: nxu.internal_branching_coordinates_max_min(
subG, plot = True, return_dict = True, verbose = True,
)
- neuron_morphology_tools.neuron_nx_utils.internal_branching_stats(G, include_max_min_coordinates=True, include_max_min_dist=True, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.limb_graph(G, limb_idx=None, most_upstream_node=None, branches_idx=None, verbose=False)[source]
Purpose: To return a graph of a certain limb
Ex: nxu.limb_graph(G_ax,limb_idx = 3,verbose = True)
- neuron_morphology_tools.neuron_nx_utils.limb_graphs_from_soma_connected_nodes(G, verbose=False, plot=False)[source]
Purpose: To get all of the limb graphs defined by those boardering the soma
Pseucode: 1) Get all of the soma connected nodes 2) For each soma connected node: get the connected subgraph
Ex: limb_graphs = nxu.limb_graphs_from_soma_connected_nodes( G, verbose = True, plot = False, )
- neuron_morphology_tools.neuron_nx_utils.morphometrics(G=None, swc=None, apply_basal_dendrite_swap=True, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.most_upstream_coordinate(G)[source]
Purpose: Get upstream skeleton point of the most upstream node
- neuron_morphology_tools.neuron_nx_utils.most_upstream_node_on_axon_limb(G, return_endpoint_upstream=False, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.most_upstream_node_vector_stats(G, soma_coordinate=None, most_upstream_node=None, upstream_dist_max=None, verbose=False)[source]
Purpose: to compute the soma and skeleton vector and other statitistics about the most upstream node on a graph
- neuron_morphology_tools.neuron_nx_utils.most_upstream_nodes(G, nodes=None, verbose=False, return_downstream_count=True)[source]
Purpose: To get a count of the number of downstream nodes
Ex: nxu.most_upstream_nodes(
G, nodes = [“L1_10”,”L1_2”,”L1_8”,”L0_20”], verbose = True
)
- neuron_morphology_tools.neuron_nx_utils.n_data_attribues(G, attribute, n=None, exclude_presyn=True)[source]
Purpose: To get the number of data attributes belonging to a branch
- neuron_morphology_tools.neuron_nx_utils.n_scholl_dict_from_scholl_dict(scholl_dict, return_named_dict=True, prefix='')[source]
- neuron_morphology_tools.neuron_nx_utils.node_compartment_color_dict(G, compartment_color_dict=None)[source]
- neuron_morphology_tools.neuron_nx_utils.node_map(G_source, G_target, verbose=False)[source]
Purpose: To find the matches of all the nodes of one graph to another:
Pseudocode: For each node in the source graph
- Iterate through the target graph nodes
Compare the certain properties, and if all match then assign as the correct mapping
- nxu.node_map(
G_source = G_ax, G_target = G_proof, verbose = True
)
- neuron_morphology_tools.neuron_nx_utils.node_match_by_dict(dict1, dict2, attributes=('endpoint_upstream', 'skeleton_vector_upstream'), verbose=False)[source]
Purpose: To compare whether two nodes are the same or not
Ex: node_match_by_dict( G_ax.nodes[“L0_0”], G_ax.nodes[“L0_1”], verbose = True )
- neuron_morphology_tools.neuron_nx_utils.nodes_between_soma_and_nodes(G, nodes, verbose=False)[source]
Purpose: to find the nodes in between a set of nodes and the soma node
Ex: nxu.nodes_between_soma_and_nodes(
G_presyn, nodes=[“L0_5”,”L0_7”], verbose = True
)
- neuron_morphology_tools.neuron_nx_utils.nodes_distance_query_from_soma(G, distance_threshold, within_distance=True, distance_type='upstream', nodes=None, return_subgraph=False, return_soma_with_sugraph=True, verbose=False, maintain_skeleton_connectivity=True, from_attributes=False, **kwargs)[source]
Purpose: Find all the nodes within a certain distance or farther away than a certain distance from soma
- neuron_morphology_tools.neuron_nx_utils.nodes_farther_than_distance_from_soma(G, distance_threshold, distance_type='upstream', nodes=None, return_subgraph=False, verbose=False, from_attributes=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.nodes_with_auto_proof_filter(G, return_filter_names=False, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.nodes_with_auto_proof_filter_type(G, filter_type, filter_feature='auto_proof_filter', verbose=False)[source]
Purpose: To get all nodes with a certain filter marking
Ex: nxu.nodes_with_auto_proof_filter_type(G,filter_type=”axon_on_dendrite”,verbose = True)
- neuron_morphology_tools.neuron_nx_utils.nodes_within_distance_from_soma(G, distance_threshold, distance_type='upstream', nodes=None, return_subgraph=False, verbose=False, from_attributes=False, **kwargs)[source]
Ex: distance_threshold = 1000 curr_nodes = nxu.nodes_within_distance_from_soma(G,distance_threshold = distance_threshold,verbose = True)
- neuron_morphology_tools.neuron_nx_utils.nodes_within_distance_upstream_from_soma(G, distance_threshold, nodes=None, return_subgraph=False, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.nodes_without_match(G_source, G_target, verbose=False)[source]
- neuron_morphology_tools.neuron_nx_utils.plot(G, verbose=False, xlim=None, ylim=None, zlim=None, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.plot_all_skeleton_compartments(G, mesh=None, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.plot_inter_attribute_intervals(inter_attribute_info, title=None, bins=50, attribute='attribute', verbose=False)[source]
Purpose: To plot the histograms of the closest attribute arrays
- neuron_morphology_tools.neuron_nx_utils.plot_inter_attribute_intervals_from_dicts(dicts, attribute='spine', bins=100, title=None, um=True, attributes_to_plot=None, verbose=True)[source]
Purpose: To plot a certain attributes from a list of datajoint dicts storing the distributions
Pseudocode:
- neuron_morphology_tools.neuron_nx_utils.remove_node(G, node, inplace=False, verbose=False, maintain_skeleton_connectivity=True, remove_all_downstream_nodes=False, **kwargs)[source]
Purpose: To remove a node from the graph and to reconnect the downstream children
Pseudocode: 1) Get any downstream nodes
(if none then just delete and return)
For each downstream node:
Attributes that need to be changed:
# if ask to alter skeleton endpoint_upstream –> parent endpoint_upstream skeleton_coordinates –> add parent endpoint_upstream
#the soma information ‘soma_start_vec’: array([-0.375219 , -0.91207943, -0.16529313]),
‘soma_start_angle’: 24.21}
Ez: new_G = nxu.remove_node( G, node=”L0_22”, inplace = False, verbose = True, maintain_skeleton_connectivity = True,
)
nxu.soma_connected_nodes(new_G) new_G.nodes[“L0_19”][“skeleton_data”],new_G.nodes[“L0_20”][“skeleton_data”]
Ex 2: Deleting all downstream nodes nodes = [“L1_10”,”L1_2”,”L1_8”,”L0_20”] G_del = nxu.remove_node(
G, node=nodes, inplace=False, verbose = True, remove_all_downstream_nodes = True
)
- neuron_morphology_tools.neuron_nx_utils.remove_small_endnode_branches(G, skeletal_length_min=None, inplace=False, loop_until_fail=True, verbose=False, **kwargs)[source]
Purpose: To iteratively remove small endnode branches from a graph
Application: When split into separate path graphs, don’t want more paths created just because have small endnodes on them
- neuron_morphology_tools.neuron_nx_utils.remove_small_starter_branches(G, skeletal_length_min=None, inplace=False, verbose=False, maintain_skeleton_connectivity=True, loop_until_fail=True, **kwargs)[source]
Purpose: To remove small starter branches from the graph
Ex: nxu.remove_small_starter_branches(G,verbose = True)
Ex 2: new_G = nxu.remove_small_starter_branches(
G, skeletal_length_min = 100000000000,
)
- neuron_morphology_tools.neuron_nx_utils.save_G(G, filepath=None, filename_append=None, delete_dynamic_attributes=True, verbose=False)[source]
Purpose: To save the graph nxu.save_G(G_ax,filename_append=”axon_high_fid”)
- neuron_morphology_tools.neuron_nx_utils.scholl_coordinates(G, soma_coordinate, axes=None, interval=None, max_distance=None, verbose=False, return_dict=True, adjusted=True, plot=False)[source]
Purpose: to calculate the coordinates of the skeleton that are interval distances away from the soma center
Pseudocode: 1) Calculate the intervals will measure at based on max_distance or max of the G skeleton
- neuron_morphology_tools.neuron_nx_utils.set_auto_proof_filter_attribute(G, split_df=None, split_locations=None, inplace=True, filter_attribute_name=None, default_value=None, verbose=False, error_on_non_unique_node_names=True, filter_axon_on_dendrite_splits=True, **kwargs)[source]
Purpose: To take the split locations df and to label the nodes with the right error
- neuron_morphology_tools.neuron_nx_utils.shortest_path_from_most_upstream(G, node, nodes_to_exclude=('S0',), **kwargs)[source]
Ex: nxu.shortest_path_from_most_upstream(
G, node=”L0_1”,
)
- neuron_morphology_tools.neuron_nx_utils.shuffle_upstream_dist_on_data_attribute(G, attribute=None, attribute_sk_nullification=None, exclude_presyn=True, discretization_length=100, seed=None, plot_G=False, verbose=False)[source]
Purpose: to randomly shuffle the upstream dists of data attributes in a neuron object (for null testing)
Ex: from neuron_morphology_tools from neurd import neuron_nx_utils as nxu
segment_id = 864691134885060346 split_index = 0
plot = False plot_proofread_neuron = False
- G_obj = hdju.graph_obj_from_auto_proof_stage(
segment_id=segment_id, split_index=split_index,
)
- if plot:
nxu.plot(G_obj)
- if plot_proofread_neuron:
- hdju.plot_proofread_neuron(
segment_id,split_index,
)
- G = nxu.inter_attribute_G_preprocessing(
G, dendrite_only = dendrite_only, remove_starter_branches = dendrite_only,
)
limb_graphs,limb_idxs = nxu.all_limb_graphs(G,return_idxs=True)
- nxu.shuffle_upstream_dist_on_data_attribute(
limb_graphs[0], verbose = True
)
- neuron_morphology_tools.neuron_nx_utils.skeletal_length(G)[source]
Purpose
Compute the summed total skeletal length over all the nodes of a graph
- neuron_morphology_tools.neuron_nx_utils.skeleton(G, include_soma=True, plot=False, verbose=False, mesh=None, return_verts_edges=True)[source]
- neuron_morphology_tools.neuron_nx_utils.skeleton_bbox(G, return_dict=True, verbose=False, suffix='_nm')[source]
Purpose: To find the skeleton’s bounding box
Generate the skeleton
Send the vertices to the bounding box
Return dict
- neuron_morphology_tools.neuron_nx_utils.skeleton_coordinates_from_G(G, include_upstream_node=False, verbose=False, return_node_names=False)[source]
Purpose: To output the skeleton points of a graph and the node names those skeleton points came from
Ex: sk_pts,sk_names = nxu.skeleton_coordinates_from_G(
G_ax,
return_node_names=True, verbose = True)
- neuron_morphology_tools.neuron_nx_utils.skeleton_downstream_of_node(G, node, include_self=True, return_verts_edges=True)[source]
- neuron_morphology_tools.neuron_nx_utils.skeleton_edge_df_with_edge_graph_with_compartments(G, verbose=True, plot=False, return_edge_G=True, remove_starter_branches=False)[source]
Purpose: To get all the edge data for all compartments and to have a graph representation of those edges so can walk along:
Pseudocode: 1) Reduce the vertices down to unique vertices and edges (and pass back the index) 2) Turn the vertices into a graph (and each node should have a compartment) 3) Trun graph into an edge graph –> use the new node names to index into compartment and get the mode –> use node names to index into coordinates and compute: skeletal length and midpoint
store all in dataframe for the edges
- neuron_morphology_tools.neuron_nx_utils.skeleton_from_node(G, n)[source]
Ex: nxu.skeleton_from_node(G_obj,n = “L0_16”)
- neuron_morphology_tools.neuron_nx_utils.skeleton_nodes(G, verbose=False, include_soma=False, **kwargs)[source]
- neuron_morphology_tools.neuron_nx_utils.skeleton_vector_upstream_and_width_from_node(G, n, upstream_dist_max=None, verbose=False, return_width=True)[source]
Purpose: To get the skeleton vector of a node pointing in downstream (and may be restricted by certain downstream distance)
can return the associated width
Pseudocode: 1) Find the n_idx to restrict to for the downstream dist
Ex: nxu.skeleton_vector_upstream_and_width_from_node(
G = G_limbs[0], n = “L0_22”, upstream_dist_max = 3000,#np.inf verbose = True, return_width = True,
)
- neuron_morphology_tools.neuron_nx_utils.skeleton_width_compartment_arrays_from_G(G, compartments=None, replace_underscore_in_compartments=False, plot=False, mesh=None, **kwargs)[source]
Purpose: To extract the skeleton,width,compartment arrays from a neuron object
segment_id = 864691136422863407 split_index = 0 G = hdju.graph_obj_from_proof_stage(segment_id,split_index) mesh = hdju.fetch_proofread_mesh(segment_id)
- nxu.skeleton_width_compartment_arrays_from_G(
G, plot = True, mesh = mesh)
- neuron_morphology_tools.neuron_nx_utils.skeleton_width_data_from_node(G, n, skeleton_midpoints=False, width_to_repeat='last')[source]
Purpose: To get the skeleton data and the width associated with each skeleton point
- neuron_morphology_tools.neuron_nx_utils.small_endnode_branches(G, dendrite_only=True, skeletal_length_min=None, exclude_soma_connected_nodes=True, verbose=False)[source]
Purpose: To detect any end nodes that are below a certain skeletal length
Pseudocode: 1) Find all of the leaf nodes 2) Find the skeletal length of all the leaf nodes 3) Identify any that are subthreshold
- neuron_morphology_tools.neuron_nx_utils.small_starter_branches(G, skeletal_length_min=None, soma_node_name=None, verbose=False)[source]
Purpose: To identify starting nodes may want to remove
Pseuodocde: 1) Look for those with small lengths 2) Look for those that neighbor the soma
- neuron_morphology_tools.neuron_nx_utils.soma_filter_by_complete_graph(G, inplace=False, verbose=False, connect_previous_touching_soma_nodes=False, plot=False)[source]
Problem: Want to resolve the soma so it does not affect…
Solution 1: Delete the soma network and then connect all the
Pseudocode: 1) Connect all the soma connecting nodes 2) Get the subgraph of only the limb branches
Ex: G_no_soma = nxu.soma_filter_by_complete_graph(G_filt,plot=True) nxu.draw_tree(G_no_soma)
- neuron_morphology_tools.neuron_nx_utils.soma_only_graph(G, soma_node_name='S0')[source]
Purpose: To check if only a soma node is in the nodes
- neuron_morphology_tools.neuron_nx_utils.soma_radius(G, stat='mean', verbose=False)[source]
Purpose: To find the [stat] distance of the soma from the neighbors
- neuron_morphology_tools.neuron_nx_utils.soma_start_angle_max(G)[source]
Purpose
calculates the maximum value of the soma starting angle over all the nodes in the graph (application: use on limb graphs to compute their soma starting angle)
- neuron_morphology_tools.neuron_nx_utils.soma_vector_from_node(G, n, soma_coordinate=None, normalize=True, verbose=False)[source]
Purpose: To get the angle between a node and the soma a node
Ex: nxu.soma_vector_from_node(
G = G, soma_coordinate = None, normalize = True, n = “L0_0”,
)
- neuron_morphology_tools.neuron_nx_utils.spine_shaft_coordinates(G, verbose=False, plot=False, mesh=None)[source]
Purpose: Get all of the spine coordinates (located on the shaft)
- neuron_morphology_tools.neuron_nx_utils.split_location_node_map_df(G, split_locations, G_target=None, nodelist=None, distance_max=5000, error_if_no_one_match=True, error_on_non_unique_node_names=True, verbose=False, verbose_loop=False)[source]
Purpose: Want to map split locaitons to the nodes that were cut off due to proofreading with what rule was used to cut off
- Things can leverage:
The limb name Nodes that shouldn’t be mapped
Pseudocode: Iterate through all filters and limbs to work with the split locations and possible nodes to match with
- neuron_morphology_tools.neuron_nx_utils.starting_coordinates_all_limbs(G, verbose=False)[source]
Purpose: To get all of the limb starting coordinates
Pseudocode: 2) Get all those bordering the soma 3) Assemble the starting coordinates
- neuron_morphology_tools.neuron_nx_utils.subgraph_df_and_endnodes_df(G, remove_small_endnodes=True, include_scholl_coordinates=True, include_scholl_coordinates_adjusted=True, include_n_scholl=True, verbose=False, endnode_name='leaf_node', ignore_axon=True)[source]
Purpose: To compute both the subgraph vector dataframe and the offshoot vector dataframes
Pseudocode: 1) Calculate the subgraph df. WILL RETURN 2) For each compartment subgraph (each entry in the subgraph df):
For All end-nodes a. Run the stats b. Add a leaf node column c. Add on the endpoint coordinate d. Attributes to add on: - subgraph_idx - endnode_idx
Compile into endnode dataframe
- neuron_morphology_tools.neuron_nx_utils.vector_stats_from_G(G, soma_coordinate=None, upstream_dist_max=None, include_scholl_coordinates=False, include_scholl_coordinates_adjusted=False, include_bbox=True, include_internal_branching=True, include_n_scholl=True, plot_scholl=False, verbose=False)[source]
Purpose: To compute the following statistics for a subgraph of a neuron object
starting width
starting y above the soma
soma angle
skeletal angle
skeletal length
starting endpoint
g. intersection points of skeleton (for as far as can go or max distance)
neuron_morphology_tools.neuron_skeleton_utils module
- neuron_morphology_tools.neuron_skeleton_utils.cirle_intersections(skeleton, center, radius, axes=None, verbose=False, plot=False)[source]
Purpose: To find every coordinate where a skeleton would intersect a circle of a certain radius
Ex: import ipyvolume as ipv from neuron_morphology_tools from neurd import neuron_skeleton_utils as nsku
segment_id = 864691134884743930 split_index = 0
- G = hdju.graph_obj_from_auto_proof_stage(
segment_id, split_index
)
soma_center = nxu.soma_center(G)
- skeleton = nxu.skeleton(
G, include_soma=False, return_verts_edges=False, plot=True,
)