connectome_manipulator.connectome_comparison.connectivity¶
Module for comparing connectomes based on connectivity features:
Structural comparison of two connectomes in terms of connection probability matrices for selected
pathways (including #synapses per connection), as specified by the config. For each connectome,
the underlying connectivity matrices are computed by the compute() function and will be saved
to a data file first. The individual connectivity matrices, together with a difference map
between the two connectomes, are then plotted by means of the plot() function.
- connectome_manipulator.connectome_comparison.connectivity.compute(circuit, group_by=None, sel_src=None, sel_dest=None, skip_empty_groups=False, edges_popul_name=None, max_distance=None, props_for_distance=None, **_)[source]¶
Computes the average connection probabilities and #synapses/connection between groups of neurons of a given circuit’s connectome.
- Parameters:
circuit (bluepysnap.Circuit) – Input circuit
group_by (str) – Neuron property name based on which to group connections, e.g., “synapse_class”, “layer”, or “mtype”; if omitted, the overall average is computed
sel_src (str/list-like/dict) – Source (pre-synaptic) neuron selection
sel_dest (str/list-like/dict) – Target (post-synaptic) neuron selection
skip_empty_groups (bool) – If selected, only group property values that exist within the given source/target selection are kept; otherwise, all group property values, even if not present in the given source/target selection, will be included
edges_popul_name (str) – Name of SONATA egdes population to extract data from
max_distance (float) – Optional. Maximum distance of pairs of neurons considered. If used, must also provide
props_for_distance.props_for_distance (list) – Optional. To be provided with
max_distance. Numerical node properties that are used to calculate the pairwise distances.
- Returns:
Dictionary containing the computed data elements; see Notes
- Return type:
dict
Note
The returned dictionary contains the following data elements that can be selected for plotting through the structural comparison configuration file, together with a common dictionary containing additional information. Each data element is a dictionary with “data” (numpy.ndarray of size <source-group-size x target-group-size>), “name” (str), and “unit” (str) items.
“nsyn_conn”: Mean number of synapses per connection
“nsyn_conn_std”: Standard deviation of the number of synapses per connection
“nsyn_conn_sem”: Standard error of the mean of the number of synapses per connection
“nsyn_conn_min”: Minimum number of synapses per connection
“nsyn_conn_max”: Maximum number of synapses per connection
“conn_prob”: Average connection probability
- connectome_manipulator.connectome_comparison.connectivity.plot(res_dict, common_dict, fig_title=None, vmin=None, vmax=None, isdiff=False, group_by=None, **_)[source]¶
Plots a connectivity matrix or a difference matrix.
- Parameters:
res_dict (dict) – Results dictionary, containing selected data for plotting; must contain a “data” item with a connectivity matrix of type numpy.ndarray of size <#source-group-values x #target-group-values>, as well as “name” and “unit” items containing strings.
common_dict (dict) – Common dictionary, containing additional information; must contain “src_group_values” and “tgt_group_values” items containing lists of source/target values of the grouped property, matching the size of the connectivity matrix in
res_dictfig_title (str) – Optional figure title
vmin (float) – Minimum plot range
vmax (float) – Maximum plot range
isdiff (bool) – Flag indicating that
res_dictcontains a difference matrix; in this case, a symmetric plot range is required and a divergent colormap will be usedgroup_by (str) – Neuron property name based on which to group connections, e.g., “synapse_class”, “layer”, or “mtype”; if omitted, the overall average is computed