-
Notifications
You must be signed in to change notification settings - Fork 8
/
02_bioexplorer_neurons_schema.sql
491 lines (423 loc) · 15.5 KB
/
02_bioexplorer_neurons_schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
-- The Blue Brain BioExplorer is a tool for scientists to extract and analyse
-- scientific data from visualization
--
-- Copyright 2020-2023 Blue BrainProject / EPFL
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU General Public License as published by the Free Software
-- Foundation, either version 3 of the License, or (at your option) any later
-- version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details.
--
-- You should have received a copy of the GNU General Public License along with
-- this program. If not, see <https://www.gnu.org/licenses/>.
create table if not exists neurons.configuration
(
guid varchar not null
constraint configuration_pk
primary key,
value varchar not null
)
tablespace bioexplorer_ts;
create unique index if not exists configuration_guid_uindex
on neurons.configuration (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.electrical_type
(
guid integer not null
constraint electrical_type_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists electrical_type_code_uindex
on neurons.electrical_type (code)
tablespace bioexplorer_ts;
create unique index if not exists electrical_type_guid_uindex
on neurons.electrical_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.layer
(
guid integer not null
constraint layer_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists layer_code_uindex
on neurons.layer (code)
tablespace bioexplorer_ts;
create unique index if not exists layer_guid_uindex
on neurons.layer (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.model_template
(
guid integer not null
constraint model_template_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists model_template_guid_uindex
on neurons.model_template (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.model_type
(
guid integer not null
constraint model_type_pk
primary key,
code varchar not null,
description integer
)
tablespace bioexplorer_ts;
create unique index if not exists model_type_guid_uindex
on neurons.model_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.morphological_type
(
guid integer not null
constraint morphological_type_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists morphological_type_code_uindex
on neurons.morphological_type (code)
tablespace bioexplorer_ts;
create unique index if not exists morphological_type_guid_uindex
on neurons.morphological_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.morphology
(
guid integer not null
constraint morphology_pk
primary key,
basename varchar not null
)
tablespace bioexplorer_ts;
create unique index if not exists morphology_basename_uindex
on neurons.morphology (basename)
tablespace bioexplorer_ts;
create unique index if not exists morphology_guid_uindex
on neurons.morphology (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.morphology_class
(
guid integer not null
constraint morphology_class_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists morphology_class_guid_uindex
on neurons.morphology_class (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.morphology_type
(
guid integer not null
constraint morphology_type_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists morphology_type_code_uindex
on neurons.morphology_type (code)
tablespace bioexplorer_ts;
create unique index if not exists morphology_type_guid_uindex
on neurons.morphology_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.node
(
guid integer not null
constraint node_pk
primary key,
x double precision not null,
y double precision not null,
z double precision not null,
rotation_x double precision default 0 not null,
rotation_y double precision default 0 not null,
rotation_z double precision default 0 not null,
rotation_w double precision default 1 not null,
morphology_guid integer not null,
morphology_class_guid integer not null,
electrical_type_guid integer not null,
morphological_type_guid integer not null,
region_guid integer not null,
layer_guid integer not null,
synapse_class_guid integer not null
)
tablespace bioexplorer_ts;
create unique index if not exists node_guid_uindex
on neurons.node (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.node_type
(
guid integer not null
constraint node_type_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists node_type_guid_uindex
on neurons.node_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.population
(
guid integer not null
constraint population_pk
primary key,
name varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists population_guid_uindex
on neurons.population (guid)
tablespace bioexplorer_ts;
create unique index if not exists population_name_uindex
on neurons.population (name)
tablespace bioexplorer_ts;
create table if not exists neurons.region
(
guid integer not null
constraint region_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists region_code_uindex
on neurons.region (code)
tablespace bioexplorer_ts;
create unique index if not exists region_guid_uindex
on neurons.region (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.section_type
(
guid integer not null
constraint section_type_pk
primary key,
description varchar not null
)
tablespace bioexplorer_ts;
create table if not exists neurons.section
(
morphology_guid integer not null,
section_guid integer not null,
section_parent_guid integer not null,
section_type_guid integer not null
constraint section_section_type_guid_fk
references neurons.section_type,
points bytea not null,
x double precision default 0 not null,
y double precision default 0 not null,
z double precision default 0 not null,
constraint section_pk
primary key (morphology_guid, section_guid, section_parent_guid)
)
tablespace bioexplorer_ts;
create index if not exists section_morphology_guid_index
on neurons.section (morphology_guid)
tablespace bioexplorer_ts;
create unique index if not exists section_morphology_guid_section_guid_uindex
on neurons.section (morphology_guid, section_guid)
tablespace bioexplorer_ts;
create index if not exists section_guid_index
on neurons.section (morphology_guid)
tablespace bioexplorer_ts;
create unique index if not exists section_type_description_uindex
on neurons.section_type (description)
tablespace bioexplorer_ts;
create unique index if not exists section_type_guid_uindex
on neurons.section_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.synapse_class
(
guid integer not null
constraint synapse_class_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists synapse_class_guid_uindex
on neurons.synapse_class (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.synapse_connectivity
(
guid integer not null,
presynaptic_guid integer not null,
postsynaptic_guid integer not null
constraint synapse_connectivity_pk
primary key
)
tablespace bioexplorer_ts;
create unique index if not exists synapse_connectivity_guid_uindex
on neurons.synapse_connectivity (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.target
(
guid integer not null
constraint target_pk
primary key,
code varchar not null,
description varchar
)
tablespace bioexplorer_ts;
create unique index if not exists target_code_uindex
on neurons.target (code)
tablespace bioexplorer_ts;
create unique index if not exists target_guid_uindex
on neurons.target (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.target_node
(
target_guid integer not null,
node_guid integer not null
)
tablespace bioexplorer_ts;
create index if not exists target_node_node_guid_index
on neurons.target_node (node_guid)
tablespace bioexplorer_ts;
create index if not exists target_node_target_guid_index
on neurons.target_node (target_guid)
tablespace bioexplorer_ts;
create table if not exists neurons.report_type
(
guid integer not null
constraint report_type_pk
primary key,
description varchar not null
)
tablespace bioexplorer_ts;
create unique index if not exists report_type_guid_uindex
on neurons.report_type (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.report
(
guid integer not null
constraint report_pk
primary key,
type_guid integer not null
constraint report_report_type_guid_fk
references neurons.report_type
on update cascade on delete cascade,
description varchar not null,
start_time double precision default 0 not null,
end_time double precision default 0 not null,
time_step double precision default 0 not null,
data_units varchar,
time_units varchar,
notes varchar
)
tablespace bioexplorer_ts;
create unique index if not exists report_guid_uindex
on neurons.report (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.spike_report
(
guid integer not null
constraint spike_report_pk
primary key,
report_guid integer not null,
node_guid integer not null
constraint spike_report_node_guid_fk
references neurons.node
on update cascade on delete cascade,
timestamp double precision not null
)
tablespace bioexplorer_ts;
create unique index if not exists spike_report_guid_uindex
on neurons.spike_report (guid)
tablespace bioexplorer_ts;
create table if not exists neurons.compartment_report
(
report_guid integer not null,
node_guid integer not null
constraint compartment_report_node_guid_fk
references neurons.node
on update cascade on delete cascade,
section_guid integer not null,
compartment_guid integer not null,
values bytea not null,
constraint compartment_report_pk
primary key (report_guid, node_guid, section_guid, compartment_guid)
)
tablespace bioexplorer_ts;
create index if not exists compartment_report_node_guid_index
on neurons.compartment_report (node_guid)
tablespace bioexplorer_ts;
create index if not exists compartment_report_report_guid_index
on neurons.compartment_report (report_guid)
tablespace bioexplorer_ts;
create index if not exists compartment_report_section_guid_index
on neurons.compartment_report (section_guid)
tablespace bioexplorer_ts;
create index if not exists compartment_report_compartment_guid_index
on neurons.compartment_report (compartment_guid)
tablespace bioexplorer_ts;
create table if not exists neurons.synapse
(
guid bigint not null
constraint synapse_pk
primary key,
presynaptic_neuron_guid integer not null,
presynaptic_section_guid integer not null,
presynaptic_segment_guid integer not null,
postsynaptic_neuron_guid integer not null,
postsynaptic_section_guid integer not null,
postsynaptic_segment_guid integer not null,
presynaptic_segment_distance double precision default 0 not null,
postsynaptic_segment_distance double precision default 0 not null,
presynaptic_surface_x_position double precision default 0 not null,
presynaptic_surface_y_position double precision default 0 not null,
presynaptic_surface_z_position double precision default 0 not null,
presynaptic_center_x_position double precision default 0 not null,
presynaptic_center_y_position double precision default 0 not null,
presynaptic_center_z_position double precision default 0 not null,
postsynaptic_surface_x_position double precision default 0 not null,
postsynaptic_surface_y_position double precision default 0 not null,
postsynaptic_surface_z_position double precision default 0 not null,
postsynaptic_center_x_position double precision default 0 not null,
postsynaptic_center_y_position double precision default 0 not null,
postsynaptic_center_z_position double precision default 0 not null
)
tablespace bioexplorer_ts;
alter table neurons.synapse
owner to bioexplorer;
create index if not exists synapse_presynaptic_neuron_guid_index
on neurons.synapse (presynaptic_neuron_guid)
tablespace bioexplorer_ts;
create table if not exists neurons.soma_report
(
report_guid integer not null,
frame integer not null
constraint soma_report_frame_fk
references neurons.node
on update cascade on delete cascade,
values bytea not null,
constraint soma_report_pk
primary key (frame, report_guid)
)
tablespace bioexplorer_ts;
create table if not exists neurons.simulated_node
(
report_guid integer not null,
node_guid integer not null,
constraint simulated_node_pk
primary key (node_guid, report_guid)
)
tablespace bioexplorer_ts;
create index if not exists simulated_node_report_guid_index
on neurons.simulated_node (report_guid)
tablespace bioexplorer_ts;