connectome_manipulator.connectome_manipulation.manipulation.conn_rewiring.ConnectomeRewiring

Connectome manipulation class for (re)wiring a connectome:

Rewires an existing connectome, or wires an empty connectome fom scratch, based on a given model of connection probability. Different aspects of connectivity can be preserved during rewiring. The manipulation can be applied through the apply() method.

connectome_manipulator.connectome_manipulation.manipulation.conn_rewiring.ConnectomeRewiring.apply(self, split_ids, syn_class, prob_model_spec, delay_model_spec, sel_src=None, sel_dest=None, pos_map_file=None, keep_indegree=True, reuse_conns=True, gen_method=None, amount_pct=100.0, props_model_spec=None, nsynconn_model_spec=None, estimation_run=False, p_scale=1.0, opt_nconn=False, pathway_specs=None, keep_conns=False, rewire_mode=None, syn_pos_mode='reuse', syn_pos_model_spec=None, morph_ext='swc')

Applies a (re)wiring of connections between pairs of neurons based on a given connectivity model.

Parameters:
  • split_ids (list-like) – List of neuron IDs that are part of the current data split; will be automatically provided by the manipulator framework

  • syn_class (str) – Selection of synapse class (“EXC” or “INH”), i.e., outgoing connections from either excitatory or inhibitory neuron types will be rewired at a time

  • prob_model_spec (dict) – Connection probability model specification; a file can be specified by {"file": "path/file.json"}

  • delay_model_spec (dict) – Delay model specification; a file can be specified by {"file": "path/file.json"}

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

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

  • pos_map_file (str/list-like) – Optional position mapping file pointing to a position mapping model (.json) or voxel data map (.nrrd); one or two files for source/target node populations may be provided

  • keep_indegree (bool) – If selected, the in-degree (number of incoming connections) of each rewired post-synaptic neuron is preserved

  • reuse_conns (bool) – If selected, existing (incoming) connections may be reused to form new connections during rewiring; specifically, synapses per connection, synapse positions, as well as synapse physiology are preserved, and only new pre-synaptic neurons are assigned to such connections

  • gen_method (str) – Method used for generating new synapses; can be “sample” (samples physiological property values independently from existing synapses) or “randomize” (draws physiological property values from model distributions; requires props_model_spec); no gen_method required in case both keep_indegree and reuse_conns are selected

  • amount_pct (float) – Percentage of randomly sampled target (post-synaptic) neurons that will be wired

  • props_model_spec (dict) – Physiological properties model specification; must be provided for gen_method “randomize”; a file can be specified by {"file": "path/file.json"}

  • nsynconn_model_spec (dict) – Model specifications for #synapses/connection; not required if #synapses/connection are part of props_model_spec, but will override if still provided; a file can be specified by {"file": "path/file.json"}

  • estimation_run (bool) – If selected, runs rewiring with early stopping, i.e., w/o generating an output connectome; an estimate of the average number of incoming connections for each post-synaptic neuron will be written to a data log file

  • p_scale (float) – Optional global probability scaling factor

  • opt_nconn (bool) – If selected, the number of ingoing connections for each post-neuron will be optimized to match its expected number of connections on average. This is done by repeating the random generation process up to OPT_NCONN_MAX_ITER=1000 times and keeping the instance which has the exact or closest match

  • pathway_specs (dict) – Optional model specifications for efficiently setting model coefficients by pathway; will be automatically provided by the manipulator framework in case a .parquet file (containing a coefficient table for all pathways) is specified under “model_pathways” in the manipulation configuration file; only works with specific types of models

  • keep_conns (bool) – If selected, an existing connection is kept exactly as it is in case the same connection should be established during rewiring; otherwise, such a connection would be established by reusing another existing one (if reuse_conns selected) or by generating new synapses forming that connection

  • rewire_mode (str) – Optional selection of specific rewiring modes, such as “add_only” (only new connections can be added, all existing ones will be kept) or “delete_only” (only existing connections can be deleted, no new ones will be added); otherwise, there are no restrictions on rewiring, i.e., new connections may be added and existing ones deleted

  • syn_pos_mode (str) – Selection of synapse position mode for generating new synapses, such as “reuse” (reuses all existing synapse positions on the post-synaptic dendrites), “reuse_strict” (reuses only synapse positions on the post-synaptic dendrites that are incoming from the selected source neurons), “random” (randomly places new synapses on the actual dendritic morphologies; slower since access to morphologies is required), or “external” (synapse positions provided externally through syn_pos_model_spec)

  • syn_pos_model_spec (dict) – External synapse position model specification of type PropsTableModel; only required if syn_pos_mode “external” is selected; a file can be specified by {"file": "path/file.json"}

  • morph_ext (str) – Morphology file extension, e.g., “swc”, “asc”, “h5”; only used if syn_pos_mode “random” is selected

Note

Input/output edges (synapse) tables are accessed through the writer object:

  • Loading input edges: edges_table = self.writer.to_pandas()

  • Writing output edges: self.writer.from_pandas(edges_table_manip)

The input edges table is assumed to be sorted by “”@target_node”, and the output edges table will again be sorted by “@target_node”.