tasks.synthesis

Luigi tasks for morphology synthesis.

Classes

BuildMorphsDF

Generate the list of morphologies with their mtypes and paths.

ApplySubstitutionRules

Apply substitution rules to the morphology dataframe.

GetDefaultParameters

Build the tmd_parameter.json for synthesis.

BuildSynthesisParameters

Build the tmd_parameters.json for synthesis.

BuildSynthesisDistributions

Build the tmd_distribution.json for synthesis.

BuildAxonMorphsDF

Generate the list of axon morphologies with their mtypes and paths.

CreateAnnotationsFile

Task to compact annotations into a single JSON file.

BuildAxonMorphologies

Run choose-morphologies to synthesize axon morphologies.

Synthesize

Run placement-algorithm to synthesize morphologies.

AddScalingRulesToParameters

Add scaling rules to tmd_parameter.json.

AddTrunkFitToParameters

Add fits to trunk angles to tmd_parameter.json.

OverwriteCustomParameters

Overwrite parameters with custom parameters.

RescaleMorphologies

Rescale morphologies.

Module Contents

class BuildMorphsDF(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Generate the list of morphologies with their mtypes and paths.

neurondb_path

Path to the neuronDB file (XML).

Type:

str

morphology_dirs

mapping between column names and paths to each morphology file.

Type:

dict

apical_points_path

(Optional) Path to the apical points file (JSON).

Type:

str

class ApplySubstitutionRules(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Apply substitution rules to the morphology dataframe.

substitution_rules_path

Path to the file containing the rules to assign duplicated mtypes to morphologies.

Type:

str

Default value:

substitution_rules.yaml

class GetDefaultParameters(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Build the tmd_parameter.json for synthesis.

default_tmd_parameters_path

Path to default tmd_parameters.json.

Type:

str

Default value:

neurots_input/tmd_parameters_default.json

class BuildSynthesisParameters(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Build the tmd_parameters.json for synthesis.

tmd_parameters_path

The path to the TMD parameters.

Type:

str

class BuildSynthesisDistributions(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Build the tmd_distribution.json for synthesis.

morphology_path

Column name in the morphology dataframe to access morphology paths.

Type:

str

nb_jobs

Number of workers.

Type:

int

class BuildAxonMorphsDF(*args, **kwargs)

Bases: BuildMorphsDF

Generate the list of axon morphologies with their mtypes and paths.

axon_morphs_df_path

Path to the CSV file containing axon morphologies.

Type:

str

Default value:

axon_morphs_df.csv

class CreateAnnotationsFile(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Task to compact annotations into a single JSON file.

annotation_dir

Path to annotations folder.

Type:

str

morph_db

(Optional) Path to MorphDB file.

Type:

str

destination

Path to output JSON file.

Type:

str

class BuildAxonMorphologies(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Run choose-morphologies to synthesize axon morphologies.

If no annotation file is given, axons will be randomly chosen from input cells.

axon_morphs_path

Path to save .tsv file with list of morphologies for axon grafting.

Type:

str

Default value:

axon_morphs.tsv

annotations_path

(Optional) Path to annotations file used by placementAlgorithm.app.choose_morphologies. If None, random axons will be chosen.

Type:

str

neurondb_basename

Base name of the neurondb file (without file extension).

Type:

str

Default value:

neuronDB

axon_cells_path

Path to the directory where cells with axons are located.

Type:

str

placement_rules_path

(Optional) See placementAlgorithm.app.choose_morphologies.

Type:

str

placement_alpha

See placementAlgorithm.app.choose_morphologies.

Type:

float

Default value:

1.0

placement_scales

See placementAlgorithm.app.choose_morphologies.

Type:

list

placement_seed

See placementAlgorithm.app.choose_morphologies.

Type:

int

Default value:

0

with_scores

Export morphology scores.

Type:

bool

Default value:

False

filter_axons

Read the neuronDB.xml file, filter cell with use_axon=True and generate a new neurondb.dat that is then read by placementAlgorithm.app.choose_morphologies.

Type:

bool

Default value:

False

bias_kind

Kind of bias used to penalize scores of rescaled morphologies.

Type:

str

Choices:

{linear, gaussian, uniform}

Default value:

linear

with_optional_scores

Use or ignore optional rules for morphology choice.

Type:

bool

Default value:

True

nb_jobs

Number of workers.

Type:

int

Default value:

20

get_neuron_db_path(ext)

Helper function to fix neuronDB vs neurondb in file names.

class Synthesize(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Run placement-algorithm to synthesize morphologies.

ext

Extension for morphology files

Type:

str

morphology_path

Column name to use in the DF to compute axon_morphs_base_dir if it is not provided

Type:

str

nb_jobs

Number of threads used for synthesis

Type:

int

out_circuit_path

Path to circuit with morphology data.

Type:

str

Default value:

circuit.h5

axon_morphs_base_dir

(Optional) Base dir for morphology used for axon (.h5 files).

Type:

str

apical_points_path

Path to the apical points file (YAML).

Type:

str

Default value:

apical_points.yaml

debug_region_grower_scales

Trigger the recording of scaling factors computed by region-grower.

Type:

bool

Default value:

False

max_drop_ratio

The maximum drop ratio.

Type:

float

Permitted values:

float in [0, 1]

Default value:

0.1

apply_jitter

Apply jitter to all sections of axons.

Type:

bool

Default value:

False

scaling_jitter_std

The std value of the scaling jitter to apply.

Type:

float

Permitted values:

float in (0, inf)

Default value:

0.2

rotational_jitter_std

The std value of the scaling jitter to apply (in degrees).

Type:

float

Permitted values:

float in (0, 180]

Default value:

10

seed

Pseudo-random generator seed.

Type:

int

Default value:

0

class AddScalingRulesToParameters(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Add scaling rules to tmd_parameter.json.

morphology_path

Column name to use in the DF to compute axon_morphs_base_dir if it is not provided.

Type:

str

nb_jobs

Number of threads used for synthesis.

Type:

int

scaling_tmd_parameters_path

Path to tmd_parameters.json with scaling rules added.

Type:

str

Default value:

neurots_input/tmd_parameters_scaling.json

scaling_rules_path

Path to the file containing the scaling rules.

Type:

str

Default value:

scaling_rules.yaml

class AddTrunkFitToParameters(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Add fits to trunk angles to tmd_parameter.json.

morphology_path

Column name to use in the DF to compute axon_morphs_base_dir if it is not provided.

Type:

str

nb_jobs

Number of threads used for synthesis.

Type:

int

trunk_tmd_parameters_path

Path to tmd_parameters.json with trunk fit added.

Type:

str

Default value:

neurots_input/tmd_parameters_trunk.json

scaling_rules_path

Path to the file containing the scaling rules.

Type:

str

Default value:

scaling_rules.yaml

class OverwriteCustomParameters(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Overwrite parameters with custom parameters.

custom_tmd_parameters_path

Path to tmd_parameters.json with custom parameters overwritten.

Type:

str

Default value:

neurots_input/tmd_parameters_overwriten.json

custom_parameters_path

Path to the file containing the custom parameters.

Type:

str

Default value:

custom_parameters.csv

class RescaleMorphologies(*args, **kwargs)

Bases: luigi_tools.task.WorkflowTask

Rescale morphologies.

morphology_path

Column name to use in the DF to compute axon_morphs_base_dir if it is not provided.

Type:

str

nb_jobs

Number of threads used for synthesis.

Type:

int

rescaled_morphology_path

Column name with rescaled morphology paths in the morphology DataFrame.

Type:

str

Default value:

rescaled_morphology_path

rescaled_morphology_base_path

Base path to rescaled morphologies.

Type:

str

Default value:

rescaled_morphologies

scaling_rules_path

Path to the file containing the scaling rules.

Type:

str

Default value:

scaling_rules.yaml

rescaled_morphs_df_path

Path to the CSV morphology file.

Type:

str

Default value:

rescaled_morphs_df.csv

scaling_mode

Scaling mode used: cells are either rescaled only according the Y axis or all axes.

Type:

str

Choices:

{radial, y}

Default value:

y

skip_rescale

Just copy input cells to the output directory.

Type:

bool

Default value:

False