tasks.clone

Optional phase 4: Clones.

Attributes

logger

Category

NEURONDB_XML

Classes

CollectRepaired

Collect annotated dataset to work with on this phase.

CollectAnnotations

Collect annotations to work with on this phase.

CloneMorphologies

Create clones of morphologies.

MakeCloneRelease

Make a morpology release of clones.

Functions

get_candidates_from_neurondb(neurondb)

Returns a dict of 'Category' -> list of names.

Module Contents

tasks.clone.logger
tasks.clone.Category
tasks.clone.NEURONDB_XML
class tasks.clone.CollectRepaired(*args, **kwargs)

Bases: data_validation_framework.task.ElementValidationTask

Collect annotated dataset to work with on this phase.

morph_path_col
class tasks.clone.CollectAnnotations(*args, **kwargs)

Bases: data_validation_framework.task.ElementValidationTask

Collect annotations to work with on this phase.

annotation_path

(Optional) Path to the directory containing the annotations.

Type:

str

tasks.clone.get_candidates_from_neurondb(neurondb)

Returns a dict of ‘Category’ -> list of names.

class tasks.clone.CloneMorphologies(*args, **kwargs)

Bases: data_validation_framework.task.SetValidationTask

Create clones of morphologies.

This task is divided in 4 steps:

  1. Graft axons

    Graft the axons from some morphologies to other morphologies based on the neurondb and the cross_mtypes parameter.

    At the end of the phase, discard morphologies who have the <use_axon> or <use_dendrites> flags set to False.

  2. Scale the morphologies

    This phase produces new version of each morphology by scaling them along the Y axis with the scaling factors given in the y_scales parameter.

  3. Transform neuronDB according to the exclusion and substitution rules

    The rules are applied with the following logic:

    • First the ‘exclusions’ are applied

    • Then the ‘substitutions’

    • Finally the ‘mtype_copy_to_layer’, so that the later applies to the former.

  4. Create jittered versions of each morphologies and their corresponding annotations.

    Two kinds of jitter are applied:

    • rotational jitter: the section bifurcation angles are jittered with an std of 10 degrees

    • section length jitter: each section is scaled individually with an an std of 20% (ie. each section is stretched or compressed by around 20%)

    Procedure:

    1. For each Category[mtype, layer], determine the number of clones to be generated for this category. It depends on the total number of morphs in the circuit and the proportion of the category comparatively to other categories present in the circuit. This information is stored in builder_recipe.

    2. Each morphology file can be used by multiple category[mtype, layer]. The number of clones to be generated for a given morphology file is the sum of the number of required clones for each category it belongs to.

    3. Produce the clones and adds an entry in self.output_db for each of them.

    4. If a placement_rules file is provided, also create an annotation file for each clones, else this step is skipped.

    Note

    • when a category[mtype, layer] appears in neurondb but not in builder_recipe, we can not compute the number of clones required by this category, so its number is set to 0.

    • when a category[mtype, layer] appears in the builder_recipe but not in neurondb, it means there is no morphologies available for this category. So the category is skipped, but that can lead to problems later on in the pipeline.

    • different sub-mtypes are considered as different mtypes: they will have distinct clones.

This task produces one directory for each step with:

  • the morphology files.

  • the neuronDB.xml and neuronDB.dat files.

  • an annotations folder with one annotation for each new morphology.

cross_mtypes

The list of mtypes to be grafted.

Type:

list

Default value:

[‘L2_IPC’, ‘L4_UPC’, ‘L4_SSC’, ‘L5_UPC’, ‘L6_UPC’, ‘L6_BPC’, ‘L6_HPC’, ‘L3_TPC:B’, ‘L5_TPC:A’, ‘L5_TPC:B’, ‘L5_TPC:C’, ‘L6_TPC:A’, ‘L6_TPC:C’]

placement_rules_path

Path to the XML file describing the placement rules.

Type:

str

Default value:

placement_rules.xml

axon_limit_name

Name used from axon limit.

Type:

str

Default value:

L1_axon_hard_limit

dendrite_limit_name

Name used for dendrite limit.

Type:

str

Default value:

L1_hard_limit

y_scales

Y scales to apply.

Type:

list

Default value:

[0.95, 0.975, 1.025, 1.05]

transform_rules_path

Path to the XML file containing the transform rules.

Type:

str

Default value:

transform_rules.xml

builder_recipe_path

Path to the recipe file.

Type:

str

Default value:

builder_recipe.xml

clone_multiplier

The multiplication factor to the number of generated clones.

Type:

float

Permitted values:

float in (0, inf)

Default value:

1

std_angle

The std of the angles used to generate the clones.

Type:

float

Permitted values:

float in (0, inf)

Default value:

10.0

std_scale

The std of the scales used to generate the clones.

Type:

float

Permitted values:

float in (0, inf)

Default value:

0.2

parallel_factory_type

The type of parallel factory used for computation.

Type:

str

Choices:

{serial, multiprocessing, dask, ipyparallel, dask_dataframe}

Default value:

multiprocessing

morph_path_col
class tasks.clone.MakeCloneRelease(*args, **kwargs)

Bases: data_validation_framework.task.SetValidationTask

Make a morpology release of clones.

clone_path

(Optional) Path to clone morphologies (not created if None)

Type:

str

Default value:

clone_release

extensions = ['.asc', '.h5', '.swc']
ext