pymaid.cn_table_from_connectors¶
- pymaid.cn_table_from_connectors(x, remote_instance=None)[source]¶
Generate connectivity table from neurons’ connectors.
This function creates the connectivity table from scratch using just the neurons’ connectors. This function is able to deal with non-unique skeleton IDs (most other functions won’t). Use it e.g. when you split neurons into multiple fragments. The order of the input CatmaidNeuronList is preserved!
- Parameters:
x (CatmaidNeuron | CatmaidNeuronList) – Neuron(s) for which to generate connectivity table.
remote_instance (CatmaidInstance, optional) – If not passed, will try using globally defined.
- Returns:
DataFrame in which each row represents a neuron and the number of synapses with the query neurons:
neuron_name skeleton_id relation total skid1 skid2 ... 0 name1 skid1 upstream n_syn n_syn ... 1 name2 skid2 downstream n_syn n_syn .. 2 name3 skid3 usptream n_syn n_syn . ... ...
relation
can be'upstream'
(incoming),'downstream'
(outgoing),'attachment'
or'gapjunction'
(gap junction).- Return type:
pandas.DataFrame
See also
get_partners()
If you are working with “intact” neurons. Much faster!
filter_connectivity()
Use this function if you have only a single fragment per neuron (e.g. just the axon). Also way faster.
Examples
>>> # Fetch some neurons >>> x = pymaid.get_neuron('annotation:PD2a1/b1') >>> # Split into axon / dendrites >>> x.reroot(x.soma) >>> split = pymaid.split_axon_dendrite(x) >>> # Regenerate cn_table >>> cn_table = pymaid.cn_table_from_connectors(split) >>> # Skeleton IDs are non-unique but column order = input order: >>> # in this example the first occurrence is axon, the second dendrites >>> cn_table.head()