Skip to content

features

Helper functions for adding features from the L2cache to skeletons

add_is_axon_annotation(nrn, pre_anno, post_anno, annotation_name='is_axon', threshold_quality=0.5, extend_to_segment=True, n_times=1, return_quality=False)

Add an annotation property table specifying which vertices belong to the axon, based on synaptic input and output locations For the synapse flow centrality algorithm, see "Quantitative neuroanatomy for connectomics in Drosophila", Schneider-Mizell et al. eLife 2016.

Parameters:

  • nrn (Meshwork) –

    Meshwork object

  • pre_anno (str) –

    Annotation property table name for presynaptic sites (outputs).

  • post_anno (str) –

    Annotation property table name for postsyanptic sites (inputs).

  • annotation_name (str, default: 'is_axon' ) –

    Name of the new table specifying axon indices, by default "is_axon"

  • threshold_quality (float, default: 0.5 ) –

    Value between 0 and 1 setting the lower limit on input/output segregation quality, by default 0.5. If the segregatation quality is lower than this, a table is added but no vertices will be in the table.

  • extend_to_segment (bool, default: True ) –

    If True, the axon split point will be moved to the most root-ward point on the segment containing the highest synapse flow centrality, by default True

  • n_times (int, default: 1 ) –

    The number of times to run axon/dendrite detection in a row, by default 1. This should be set to the number of distinct axon branches on a cell, which surprisingly can be more than one even for mouse neurons.

  • return_quality (bool, default: False ) –

    If True, returns the split quality score (a float between 0-1). Default is False.

Returns:

  • split_quality

    Float between 0-1, with higher numbers indicating a better axon/dendrite segregation.

add_lvl2_ids(nrn, l2dict_mesh, property_name='lvl2_ids')

Add meshwork annotation table associating level 2 ids with vertex ids.

Parameters:

  • nrn (Meshwork) –

    Meshwork object

  • l2dict_mesh (dict) –

    Dictionary mapping L2 ids to mesh graph indices.

  • property_name (str, default: 'lvl2_ids' ) –

    Name of the annotation table, by default "lvl2_ids"

add_segment_properties(nrn, segment_property_name='segment_properties', effective_radius=True, area_factor=True, strahler=True, strahler_by_compartment=False, volume_property_name='vol_prop', volume_col_name='size_nm3', area_col_name='area_nm2', root_as_sphere=True, comp_mask='is_axon')

Use volumetric and topological properties to add descriptive properties for each skeleton vertex. Note that properties are estimated per segment, the unbranched region between branch points and/or endpoints.

This function assumes that the volume properties have already been added to the meshwork, which can be done using add_volumetric_properties.

Parameters:

  • nrn (Meshwork) –

    Meshwork object

  • segment_property_name (str, default: 'segment_properties' ) –

    Name of the new annotation property table, by default "segment_properties"

  • effective_radius (bool, default: True ) –

    If True, add a column for a radius estimate found by computing the radius of an equivalent cylindar with the same length and volume as each segment, by default True

  • area_factor (bool, default: True ) –

    If True, add a column with the ratio of the surface area of the segment and the surface area of an equivalent cylinder (without endcaps), by default True

  • strahler (bool, default: True ) –

    If True, add a column with the strahler number of the segment, by default True

  • strahler_by_compartment (bool, default: False ) –

    If True, computer strahler number for axon and dendrite separately, using the annotation property table specified in comp_mask, by default False

  • volume_property_name (str, default: 'vol_prop' ) –

    Name of the volume properties table as generated by the function add_volumetric_properties, by default "vol_prop"

  • volume_col_name (str, default: 'size_nm3' ) –

    Name of the column holding volume, by default "size_nm3"

  • area_col_name (str, default: 'area_nm2' ) –

    Name of the column holding surface area, by default "area_nm2"

  • root_as_sphere (bool, default: True ) –

    Treats the root location as a sphere for setting the effective radius, by default True

  • comp_mask (str, default: 'is_axon' ) –

    Sets the annotation table to mask off for strahler number computation, by default "is_axon".

add_synapses(nrn, synapse_table, l2dict_mesh, client, root_id=None, pre=False, post=False, remove_self_synapse=True, timestamp=None, live_query=False, metadata=False, synapse_partners=False, synapse_point_resolution=None, synapse_representative_point_pre='ctr_pt_position', synapse_representative_point_post='ctr_pt_position')

Add synapses to a meshwork object based on l2ids

Parameters:

  • nrn (Meshwork) –

    Meshwork object

  • synapse_table (str) –

    Annotation table to use for synapses

  • l2dict_mesh (dict) –

    Dictionary mapping l2ids to vertex ids

  • client (CAVEclient) –

    Caveclient to use to get annotations

  • root_id (int, default: None ) –

    Root id of the cell, by default None. If none, uses the root id set in nrn.seg_id.

  • pre (bool, default: False ) –

    If True, add presynaptic synpases (i.e. outputs), by default False

  • post (bool, default: False ) –

    If True, add postsynaptic synapses (i.e. inputs), by default False

  • remove_self_synapse (bool, default: True ) –

    If True, omit synapses where the pre and post root ids are the same, by default True

  • timestamp (datetime, default: None ) –

    Datetime to use for root id lookups if not using a materialized version, by default None

  • live_query (bool, default: False ) –

    If True, use a timestamp to look up root ids, by default False

  • synapse_partners (bool, default: False ) –

    If True, returns the root id of synapses partners in the dataframe. By default, this is False because partner root ids change with editing and are not specified by this cell's data alone.

add_volumetric_properties(nrn, client, attributes=VOL_PROPERTIES, l2id_anno_name='lvl2_ids', l2id_col_name='lvl2_id', property_name='vol_prop')

Add L2 Cache properties as an annotation property table.

Parameters:

  • nrn (Meshwork) –

    Meshwork object

  • client (CAVEclient) –

    Initialized caveclient

  • attributes (list, default: VOL_PROPERTIES ) –

    List of attributes to download, by default: ["area_nm2", "size_nm3", "mean_dt_nm", "max_dt_nm"].

  • l2id_anno_name (str, default: 'lvl2_ids' ) –

    Name of the annotation property table holding L2 ids, by default "lvl2_ids"

  • l2id_col_name (str, default: 'lvl2_id' ) –

    Name of the column in the property table holding L2 ids, by default "lvl2_id"

  • property_name (str, default: 'vol_prop' ) –

    Name of the new volume property table, by default "vol_prop"