Synapse Filters

The following filters are accepted by functionalizer’s --filters command line option. To use any of the filters, remove the Filter suffix if present, e.g., BoutonDistanceFilter becomes BoutonDistance.

Parametrized Synapse Reduction

class BoutonDistanceFilter(recipe, source, target)[source]

Bases: DatasetOperation

Filter synapses based on the distance from the soma.

This filter reads distances for inhibitory and excitatory synapses from the recipe definition and filters out all synapses closer to the soma.

apply(circuit)[source]

Apply filter.

class SomaDistanceFilter(recipe, source, target)[source]

Bases: DatasetOperation

Filter touches based on distance from soma.

Removes all touches that are located within the soma.

apply(circuit)[source]

Remove touches within the soma.

class TouchReductionFilter(recipe, source, target)[source]

Bases: DatasetOperation

Filter touches based on a simple probability.

Defined in the recipe as TouchReduction, restrict connections according to the survival_rate defined.

apply(circuit)[source]

Actually reduce the touches of the circuit.

class TouchRulesFilter(recipe, source, target)[source]

Bases: DatasetOperation

Filter touches based on recipe rules.

Defined in the recipe as TouchRules, restrict connections between mtypes and types (dendrite/soma). Any touches not allowed are removed.

This filter is deterministic.

apply(circuit)[source]

Filter the circuit edges according to the touch rules.

Synapse Identification

class AddIDFilter(recipe, source, target)[source]

Bases: DatasetOperation

Adds a column synapse_id to a circuit.

Note

The synapse id added by this filter will yield reproducible synapse properties, but should not be used for any processing involving probabilities, i.e., reduce and cut.

apply(circuit)[source]

Add a synapse_id field to circuit.

class DenseIDFilter(recipe, source, target)[source]

Bases: DatasetOperation

Makes the synapse_id column continuous.

This filter should be used if the range of the synapse id field exceeds numerical limitiations when generating output files.

In particular, this filter should be included before GapJunctionFilter to make the gap junction ids fit into the numerical range accepted by neuron.

apply(circuit)[source]

Condense the synapse id field used to match gap-junctions.

Generating Properties for Gap-Junctions

class GapJunctionFilter(recipe, source, target)[source]

Bases: DatasetOperation

Synchronize gap junctions.

Ensures that:

  • Dendro-dentro and dendro-soma touches are present as src-dst and the corresponding dst-src pair. The sections of the touches have to be aligned exactly, while the segment may deviate to neighboring ones.

  • Dendro-somatic touches: the structure of the neuron morphology is traversed and from all touches that are within a distance of 3 soma radii on the same branch only the “parent” ones are kept.

apply(circuit)[source]

Apply both the dendrite-soma and dendrite-dendrite filters.

class GapJunctionProperties(recipe, source, target)[source]

Bases: DatasetOperation

Assign gap-junction properties.

This “filter” augments touches with properties of gap-junctions by adding the field

  • conductance representing the conductance of the gap-junction with a default value of 0.2

as specified by the gap_junction_properties part of the recipe.

apply(circuit)[source]

Add properties to the circuit.

Sampled Reduction

class SpineLengthFilter(recipe, source, target)[source]

Bases: DatasetOperation

Filter synapses by spine length to match a desired distribution.

apply(circuit)[source]

Reduce edges until the real spine length distribution matches the desired one.

Determines the survival rate of edges by dividing the desired spine length distribution by the one found in the data, scaling to the value for each bin to [1.0, 0.0]. Then generates random numbers and selects the edges below the cut threshold.

class ReduceAndCut(recipe, source, target)[source]

Bases: DatasetOperation

Reduce and cut touch distributions.

Goes through the touches and matches up distributions present and expected by random sampling. Steps:

  1. Pathway statistics are determined and reduction factors are calculated

    Calulate pP_A, pMu_A, bouton reduction factor, and legacy active fraction based on the number of touches per pathway and pathway count.

  2. Reduction factors are applied to the touches

    Based on pP_A calculated previously, with random numbers drawn for sampling.

  3. Survival rates of the remaining touches are calculated

    Trim src-dst connections based on the survival of the previous step, and relying on pMu_A, calculates a survival rate and keeps “surviving” connections by sampling.

  4. Active connection fractions are deduced from survival rates and applied

    Using the bouton_reduction_factor from the ConnectionRules part of the recipe to determine the overall fraction of the touches that every mtype–mtype connection class is allowed to have active.

To calculate random numbers, a seed derived from the synapseSeed in the recipe is used.

The internal implementation uses Pandas UDFs calling into Cython/Highfive for the random number generation.

apply(circuit)[source]

Filter the circuit according to the logic described in the class.

apply_reduce(all_touches, params_df)[source]

Applying reduce as a sampling.

calc_cut_active_fraction(cut_touch_counts_connection, params_df)[source]

Cut according to the active_fractions.

Parameters:
  • params_df – the parameters DF (pA, uA, active_fraction_legacy)

  • cut_touch_counts_connection – the DF with the cut touch counts per connection (built previously in an optimized way)

Returns:

The final cut touches

calc_cut_survival_rate(reduced_touches, params_df)[source]

Apply cut filter.

Cut computes a survivalRate and activeFraction for each post neuron And filters out those not passing the random test

compute_reduce_cut_params(full_touches)[source]

Computes pathway parameters for reduce and cut.

Based on the number of touches per pathway and the total number of connections (unique pathways).

Parameters:

full_touches – touches with a pathway column

Returns:

a dataframe containing reduce and cut parameters

Generating Properties of Chemical Synapses

class SynapseReposition(recipe, source, target)[source]

Bases: DatasetOperation

Reposition synapses.

Shifts the post-section of synapses for ChC and SpAA cells to the soma according to the SynapsesReposition rules of the recipe.

apply(circuit)[source]

Actually reposition the synapses.

class SynapseProperties(recipe, source, target)[source]

Bases: DatasetOperation

Assign synapse properties.

This “filter” augments touches with properties of synapses by adding the fields

  • conductance following a Gamma-distribution

  • depression_time following a Gamma-distribution

  • facilitation_time following a Gamma-distribution

  • u_syn following a truncated Normal-distribution

  • decay_time following a truncated Normal-distribution

  • n_rrp_vesicles following a Poisson-distribution

  • conductance_scale_factor, taken verbatim from the recipe

  • u_hill_coefficient, also taken verbatim from the recipe

as specified by the synapse_properties.classes part of the recipe.

To draw from the distributions, a seed derived from the seed in the recipe is used.

The internal implementation uses Pandas UDFs calling into Cython/Highfive for the random number generation.

apply(circuit)[source]

Add properties to the circuit.