connectome_manipulator.connectome_comparison.adjacency

Module for comparing connectomes based on adjacency matrices:

Structural comparison of two connectomes in terms of adjacency matrices for selected pathways (including synapse counts per connection), as specified by the config. For each connectome, the underlying adjacency/count matrices are computed by the compute() function and will be saved to a data file first. The individual adjacency/count matrices, together with a difference map between the two connectomes, are then plotted by means of the plot() function.

connectome_manipulator.connectome_comparison.adjacency.compute(circuit, sel_src=None, sel_dest=None, edges_popul_name=None, **_)[source]

Extracts adjacency and count matrices from a given circuit’s connectome.

Parameters:
  • circuit (bluepysnap.Circuit) – Input circuit

  • sel_src (str/list-like/dict) – Source (pre-synaptic) neuron selection

  • sel_dest (str/list-like/dict) – Target (post-synaptic) neuron selection

  • edges_popul_name (str) – Name of SONATA egdes population to extract data from

Returns:

Dictionary containing the extracted 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” (scipy.sparse.csc_matrix), “name” (str), and “unit” (str) items.

  • “adj”: Adjacency matrix

  • “adj_cnt”: Synaptome matrix, containing the numbers of synapses per connection

connectome_manipulator.connectome_comparison.adjacency.plot(res_dict, _common_dict, fig_title=None, vmin=None, vmax=None, isdiff=False, **_)[source]

Plots an adjacency/count matrix or a difference matrix.

Parameters:
  • res_dict (dict) – Results dictionary, containing selected data for plotting; must contain a “data” item with a sparse matrix of type scipy.sparse.csc_matrix, as well as “name” and “unit” items containing strings.

  • _common_dict (dict) – Common dictionary, containing additional information - Not used

  • fig_title (str) – Optional figure title

  • vmin (float) – Minimum plot range

  • vmax (float) – Maximum plot range

  • isdiff (bool) – Flag indicating that res_dict contains a difference matrix; in this case, a symmetric plot range is required and a divergent colormap will be used