-
Notifications
You must be signed in to change notification settings - Fork 1
/
synapse_pipeline.nf
executable file
·132 lines (121 loc) · 4.15 KB
/
synapse_pipeline.nf
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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
include {
default_em_params;
get_value_or_default;
exm_synapse_container_param;
exm_synapse_dask_container_param;
} from './param_utils'
// app parameters
def final_params = default_em_params(params)
include {
n5_tools_spark_params;
} from './params/n5_tools_params'
include {
vvd_spark_params;
} from './params/vvd_params'
def pyramid_params = n5_tools_spark_params(final_params)
def vvd_params = vvd_spark_params(final_params)
def synapse_params = final_params + [
working_container: get_value_or_default(final_params, 'working_container', "${final_params.pipeline}.n5"),
exm_synapse_container: exm_synapse_container_param(final_params),
exm_synapse_dask_container: exm_synapse_dask_container_param(final_params),
pyramid_params: pyramid_params,
vvd_params: vvd_params,
]
include {
classify_synapses;
collocate_synapses;
presynaptic_in_volume;
presynaptic_n1_to_n2;
presynaptic_n1_to_postsynaptic_n2;
} from './workflows/synapse_detection' addParams(synapse_params)
pipeline_output_dir = synapse_params.output_dir
workflow {
def synapses_res;
switch(synapse_params.pipeline) {
case 'classify_synapses':
if (!synapse_params.presynapse) {
log.error "'--presynapse' must be defined"
exit(1)
}
synapses_res = classify_synapses(
[
synapse_params.presynapse,
synapse_params.presynapse_in_dataset,
],
pipeline_output_dir,
)
break
case 'collocate_synapses':
if (!synapse_params.presynapse ||
!synapse_params.n1) {
log.error "'--presynapse', '--n1' must be defined"
exit(1)
}
synapses_res = collocate_synapses(
[
synapse_params.presynapse,
synapse_params.presynapse_in_dataset,
synapse_params.n1,
synapse_params.n1_in_dataset,
],
pipeline_output_dir,
)
break
case 'presynaptic_n1_to_n2':
if (!synapse_params.presynapse ||
!synapse_params.n1) {
log.error "'--presynapse', '--n1' must be defined; '--n2' is optional"
exit(1)
}
synapses_res = presynaptic_n1_to_n2(
[
synapse_params.presynapse,
synapse_params.presynapse_in_dataset,
synapse_params.n1,
synapse_params.n1_in_dataset,
synapse_params.n2,
synapse_params.n2_in_dataset,
],
pipeline_output_dir,
)
break
case 'presynaptic_n1_to_postsynaptic_n2':
if (!synapse_params.presynapse ||
!synapse_params.n1 ||
!synapse_params.postsynapse) {
log.error "'--presynapse', '--n1','--postsynapse' must be defined"
exit(1)
}
synapses_res = presynaptic_n1_to_postsynaptic_n2(
[
synapse_params.presynapse,
synapse_params.presynapse_in_dataset,
synapse_params.n1,
synapse_params.n1_in_dataset,
synapse_params.postsynapse,
synapse_params.postsynapse_in_dataset,
],
pipeline_output_dir,
)
break
case 'presynaptic_in_volume':
default:
if (!synapse_params.presynapse) {
log.error "'--presynapse' must be defined"
exit(1)
}
synapses_res = presynaptic_in_volume(
[
synapse_params.presynapse,
synapse_params.presynapse_in_dataset,
synapse_params.n1,
synapse_params.n1_in_dataset,
],
pipeline_output_dir,
)
break
}
synapses_res | view
}