Synthesis methodology¶
This page presents the scientific procedure used to synthesize the cells.
Overview¶
Production workflow¶
Basically, the workflow used in BBP to generate the cell morphologies is the following:
collect biological data,
calibrate the models on these data,
synthesized the cells according to the calibration parameters.
This package aims at running the calibration process, then calling each part of the production workflow on a small use case and computing some validation metrics. Once the calibration parameters are correct, the actual production workflow can be run using them.
Internal workflow¶
The main workflow that should be used is: tasks.workflows.ValidateSynthesis.
This workflow runs all the required tasks to calibrate and validate the synthesis models.
It is divided in several subtasks (more details on these tasks are given in
tasks):
![strict digraph {
graph [bb="0,0,831,612",
bgcolor=transparent,
dpi=300,
fontsize=9,
layout=dot,
rankdir=TB,
size="7.0, 15.0"
];
node [fillcolor=white,
fontname="\"Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans\"",
fontsize=9,
height=0.25,
label="\N",
shape=box,
style="setlinewidth(0.5),filled"
];
edge [arrowsize=0.5,
style="setlinewidth(0.5)"
];
ValidateSynthesis [color=red,
penwidth=1.5,
pos="252,603",
width=1.3194];
GetSynthesisInputs [URL="../../tasks/config/index.html#tasks.config.GetSynthesisInputs",
pos="496,9",
width=1.4583];
ValidateSynthesis -> GetSynthesisInputs [pos="e,443.39,10.219 204.35,597.87 146.62,592 53.767,579.5 27,558 3.5658,539.18 0,526.06 0,496 0,496 0,496 0,116 0,27.303 307.16,12.561 \
438.05,10.306"];
PlotCollage [URL="../../tasks/validation/index.html#tasks.validation.PlotCollage",
pos="457,549",
width=0.90278];
ValidateSynthesis -> PlotCollage [pos="e,425.38,558.02 283.58,593.99 320.45,584.64 381.33,569.19 420.27,559.32"];
PlotPathDistanceFits [URL="../../tasks/validation/index.html#tasks.validation.PlotPathDistanceFits",
pos="158,441",
width=1.4861];
ValidateSynthesis -> PlotPathDistanceFits [pos="e,156.34,450.17 221.69,593.93 203.31,587.38 181.14,576.17 169,558 147.78,526.23 151.88,478.2 155.49,455.2"];
PlotScales [URL="../../tasks/validation/index.html#tasks.validation.PlotScales",
pos="375,549",
width=0.86111];
ValidateSynthesis -> PlotScales [pos="e,355.83,558.11 270.95,593.99 292.47,584.89 327.61,570.03 351.02,560.14"];
MorphologyValidationReports [URL="../../tasks/validation/index.html#tasks.validation.MorphologyValidationReports",
pos="252,549",
width=2.0417];
ValidateSynthesis -> MorphologyValidationReports [pos="e,252,558.24 252,593.88 252,585.76 252,573.13 252,563.5"];
PlotScoreMatrix [URL="../../tasks/validation/index.html#tasks.validation.PlotScoreMatrix",
pos="79,549",
width=1.1944];
ValidateSynthesis -> PlotScoreMatrix [pos="e,105.68,558.02 225.35,593.99 194.49,584.71 143.7,569.45 110.8,559.56"];
CreateCircuitConfig [URL="../../tasks/workflows/index.html#tasks.workflows.CreateCircuitConfig",
pos="610,495",
width=1.4444];
ValidateSynthesis -> CreateCircuitConfig [pos="e,598.63,504.06 299.63,598.25 350.28,593.18 432.13,581.87 499,558 535.29,545.05 573.71,520.93 594.47,506.89"];
ConvertCircuit [URL="../../tasks/validation/index.html#tasks.validation.ConvertCircuit",
pos="375,495",
width=1.125];
PlotCollage -> ConvertCircuit [pos="e,387.72,504.07 444.19,539.88 430.23,531.02 407.81,516.81 392.3,506.97"];
Synthesize [URL="../../tasks/synthesis/index.html#tasks.synthesis.Synthesize",
pos="433,441",
width=0.90278];
ConvertCircuit -> Synthesize [pos="e,423.81,450.24 384.06,485.88 393.71,477.23 409.06,463.46 420,453.66"];
Synthesize -> GetSynthesisInputs [pos="e,548.76,17.738 465.58,437.42 554.2,429.52 793,401.92 793,334 793,334 793,334 793,116 793,65.743 640.25,33.053 553.84,18.581"];
ApplySubstitutionRules [URL="../../tasks/synthesis/index.html#tasks.synthesis.ApplySubstitutionRules",
pos="267,117",
width=1.6944];
Synthesize -> ApplySubstitutionRules [pos="e,268.22,126.28 430.9,431.89 425.37,411.79 408.83,358.77 380,324 362.29,302.64 345.86,310.04 329,288 290.73,237.96 274.37,162.01 \
269.08,131.44"];
BuildSynthesisParameters [URL="../../tasks/synthesis/index.html#tasks.synthesis.BuildSynthesisParameters",
pos="250,387",
width=1.8611];
Synthesize -> BuildSynthesisParameters [pos="e,278.22,396.02 404.81,431.99 372.03,422.68 317.99,407.32 283.21,397.44"];
BuildSynthesisDistributions [URL="../../tasks/synthesis/index.html#tasks.synthesis.BuildSynthesisDistributions",
pos="212,279",
width=1.9444];
Synthesize -> BuildSynthesisDistributions [pos="e,212.3,288.37 420.52,431.87 400.91,419.3 361.49,394.87 326,378 285.22,358.62 261.88,374.95 231,342 218.5,328.66 214.21,307.28 212.75,\
293.44"];
SliceCircuit [URL="../../tasks/circuit/index.html#tasks.circuit.SliceCircuit",
pos="554,387",
width=0.93056];
Synthesize -> SliceCircuit [pos="e,535.14,396.11 451.64,431.99 472.81,422.89 507.38,408.03 530.41,398.14"];
GetCellComposition [URL="../../tasks/config/index.html#tasks.config.GetCellComposition",
pos="554,279",
width=1.4444];
Synthesize -> GetCellComposition [pos="e,545.28,288.01 437.82,431.77 449.38,412.27 480.06,362.03 511,324 520.38,312.47 532.28,300.46 541.18,291.91"];
ApplySubstitutionRules -> GetSynthesisInputs [pos="e,478.66,18.024 284.59,107.86 325.82,88.774 428.62,41.188 473.95,20.209"];
BuildMorphsDF [URL="../../tasks/synthesis/index.html#tasks.synthesis.BuildMorphsDF",
pos="271,63",
width=1.1667];
ApplySubstitutionRules -> BuildMorphsDF [pos="e,270.37,72.24 267.62,107.88 268.26,99.681 269.24,86.895 269.98,77.235"];
BuildMorphsDF -> GetSynthesisInputs [pos="e,461.3,18.02 305.66,53.989 346.29,44.599 413.49,29.069 456.21,19.195"];
AddTrunkFitToParameters [URL="../../tasks/synthesis/index.html#tasks.synthesis.AddTrunkFitToParameters",
pos="306,333",
width=1.8194];
BuildSynthesisParameters -> AddTrunkFitToParameters [pos="e,297.13,342.24 258.75,377.88 268.07,369.23 282.89,355.46 293.45,345.66"];
OverwriteCustomParameters [URL="../../tasks/synthesis/index.html#tasks.synthesis.OverwriteCustomParameters",
pos="411,279",
width=2.0278];
AddTrunkFitToParameters -> OverwriteCustomParameters [pos="e,394.71,288.07 322.41,323.88 340.67,314.83 370.22,300.19 390.12,290.34"];
AddTrunkFitToParameters -> BuildSynthesisDistributions [pos="e,226.58,288.07 291.31,323.88 275.17,314.95 249.17,300.56 231.37,290.72"];
OverwriteCustomParameters -> GetSynthesisInputs [pos="e,498.48,18.157 431.75,269.93 448.24,262.64 470.95,250.52 486,234 506.49,211.51 515,202.42 515,172 515,172 515,172 515,116 515,82.018 \
505.42,42.857 499.87,23"];
AddScalingRulesToParameters [URL="../../tasks/synthesis/index.html#tasks.synthesis.AddScalingRulesToParameters",
pos="401,225",
width=2.1111];
OverwriteCustomParameters -> AddScalingRulesToParameters [pos="e,402.58,234.24 409.44,269.88 407.86,261.68 405.4,248.89 403.55,239.24"];
AddScalingRulesToParameters -> GetSynthesisInputs [pos="e,496.07,18.178 416.79,215.9 429.86,208.37 447.87,195.93 458,180 490.55,128.84 495.42,53.524 496.01,23.284"];
AddScalingRulesToParameters -> ApplySubstitutionRules [pos="e,273.32,126.39 383.53,215.96 367.26,208.04 342.78,194.98 324,180 305.31,165.09 287.24,143.93 276.62,130.59"];
GetDefaultParameters [URL="../../tasks/synthesis/index.html#tasks.synthesis.GetDefaultParameters",
pos="391,171",
width=1.6111];
AddScalingRulesToParameters -> GetDefaultParameters [pos="e,392.58,180.24 399.44,215.88 397.86,207.68 395.4,194.89 393.55,185.24"];
GetDefaultParameters -> GetSynthesisInputs [pos="e,489.45,18.275 395.65,161.97 406.77,142.9 435.98,93.53 463,54 470.5,43.025 479.6,30.974 486.35,22.263"];
GetDefaultParameters -> ApplySubstitutionRules [pos="e,286.33,126.11 371.9,161.99 350.21,152.89 314.77,138.03 291.18,128.14"];
BuildSynthesisDistributions -> GetSynthesisInputs [pos="e,443.25,9.5686 203.4,269.84 186.81,253.15 152,213.24 152,172 152,172 152,172 152,116 152,75.101 183.15,71.741 220,54 289.92,20.34 \
380.19,11.564 438.1,9.7173"];
BuildSynthesisDistributions -> ApplySubstitutionRules [pos="e,264.14,126.33 214.8,269.85 223.7,243.96 251.37,163.47 262.4,131.39"];
CreateAtlasPlanes [URL="../../tasks/circuit/index.html#tasks.circuit.CreateAtlasPlanes",
pos="654,333",
width=1.3333];
SliceCircuit -> CreateAtlasPlanes [pos="e,638.48,342.07 569.62,377.88 586.94,368.87 614.93,354.32 633.87,344.47"];
BuildCircuit [URL="../../tasks/circuit/index.html#tasks.circuit.BuildCircuit",
pos="554,333",
width=0.94444];
SliceCircuit -> BuildCircuit [pos="e,554,342.24 554,377.88 554,369.76 554,357.13 554,347.5"];
CreateAtlasLayerAnnotations [URL="../../tasks/circuit/index.html#tasks.circuit.CreateAtlasLayerAnnotations",
pos="692,225",
width=2.0278];
CreateAtlasPlanes -> CreateAtlasLayerAnnotations [pos="e,689.03,234.28 656.98,323.68 663.56,305.34 679.35,261.28 687.28,239.15"];
CreateAtlasLayerAnnotations -> GetSynthesisInputs [pos="e,533.44,18.027 689.97,215.64 682.98,188.5 657.36,101.88 605,54 586.38,36.972 560.32,26.128 538.35,19.467"];
BuildCircuit -> GetSynthesisInputs [pos="e,511.69,18.141 573.6,323.86 587.95,316.73 606.38,304.86 615,288 618.64,280.88 615.96,277.94 615,270 609.63,225.48 591,216.84 591,\
172 591,172 591,172 591,116 591,71.615 544.24,37.333 516.33,20.826"];
BuildCircuit -> GetCellComposition [pos="e,554,288.24 554,323.88 554,315.76 554,303.13 554,293.5"];
GetCellComposition -> GetSynthesisInputs [pos="e,504.17,18.247 553.87,269.75 553.6,251.92 553,208.44 553,172 553,172 553,172 553,116 553,78.12 524.42,40.732 507.73,22.136"];
PlotPathDistanceFits -> ApplySubstitutionRules [pos="e,249.15,126.14 152.07,431.96 140.06,414.86 114,373.25 114,334 114,334 114,334 114,278 114,203.43 201.89,149.99 244.44,128.48"];
PlotPathDistanceFits -> BuildSynthesisParameters [pos="e,235.73,396.07 172.38,431.88 188.17,422.95 213.62,408.56 231.04,398.72"];
PlotPathDistanceFits -> BuildSynthesisDistributions [pos="e,208.52,288.02 159.77,431.89 162.45,419.96 167.87,397.05 174,378 184.01,346.88 198.62,311.32 206.49,292.78"];
PlotScales -> ConvertCircuit [pos="e,375,504.24 375,539.88 375,531.76 375,519.13 375,509.5"];
MorphologyValidationReports -> ConvertCircuit [pos="e,355.83,504.11 270.95,539.99 292.47,530.89 327.61,516.03 351.02,506.14"];
MorphologyValidationReports -> ApplySubstitutionRules [pos="e,206.04,126.05 202.51,539.97 150.45,528.37 76,501.39 76,442 76,442 76,442 76,224 76,165.28 145.86,138.82 201.08,127.07"];
PlotScoreMatrix -> ConvertCircuit [pos="e,334.29,503.15 122.04,540.44 177.29,530.73 272.76,513.96 329.28,504.03"];
PlotScoreMatrix -> ApplySubstitutionRules [pos="e,205.93,120.72 73.471,539.9 62.279,522.69 38,480.87 38,442 38,442 38,442 38,224 38,151.73 133.08,128.59 200.71,121.26"];
CreateCircuitConfig -> GetSynthesisInputs [pos="e,548.95,12.501 662.09,491.27 727.43,484.72 831,462.57 831,388 831,388 831,388 831,116 831,68.881 788.4,72.339 745,54 683.03,27.818 \
606.03,17.215 554.2,12.921"];
CreateCircuitConfig -> Synthesize [pos="e,460.3,450.02 582.73,485.99 551.03,476.68 498.77,461.32 465.12,451.44"];
CreateCircuitConfig -> CreateAtlasPlanes [pos="e,651.71,342.33 612.24,485.85 619.36,459.96 641.5,379.47 650.32,347.39"];
}](_images/graphviz-688b2e4beeb1cef49865788410eb4f9ef1bb15e6.png)
Calibration parameters¶
The calibration step should create the two parameter files used by
placement_algorithm.app.synthesize_morphologies.Master:
tmd_parameters.jsonwhich contains the model parameters for eachmtype.tmd_distributions.jsonwhich contains the distribution properties of eachmtype.
Details on the content of these files can be found here: <URL> (does not exist yet)
Synthesis in atlas¶
When cells are synthesized inside an atlas, their shapes must be adapted according to their
positions in order to fit in this atlas. Currently, the shapes are just rescaled in order
to fit in a defined interval. This interval depends on the mtype and on the cell position
because the depths of the atlas layers also depend on this position. The information on
how each mtype can be rescaled are inserted in the tmd_parameters.json file by the task
tasks.synthesis.AddScalingRulesToParameters.
For a given mtype, the parameters specific to the scaling process are contained in a
context_constraints key. The keys in this object should be neurity types (one of
[apical, basal, axon]) and should contain the interval in which it must fit. This interval
is defined relatively to the atlas layers, so its two boundaries should contain a layer
entry, which should be an integer in [1, 6], and an optional fraction entry, which
should be a float in [0, 1] (0 for the bottom boundary of the layer and 1 for the top
boundary).
For apical rescaling, another optional extent_to_target entry should be added. This
entry contains a target layer entry and an optional fraction entry as described
before. But it also contains the fit parameters of the path distance of the cell as a
function of its extent along its principal direction. This is needed because the stopping
criterion used in the TNS model only takes the path distance into account. This fit is
linear and is thus described by a slope and a intercept entries.
Here is an example of such context_constraints entry:
{
"<mtype>": {
"context_constraints": {
"apical": {
"extent_to_target": {
"fraction": 0.8,
"intercept": 0,
"layer": 1,
"slope": 1.5
},
"hard_limit_max": {
"fraction": 1,
"layer": 1
},
"hard_limit_min": {
"fraction": 0.1,
"layer": 1
}
},
"basal": {
"hard_limit_max": {
"fraction": 0.5,
"layer": 1
}
}
}
}
}
More details on the models can be found here: