-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain_local.nf
698 lines (571 loc) · 19.5 KB
/
main_local.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
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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
#!/usr/bin/env nextflow
nextflow.enable.dsl = 1
params.ecephys_path = DATA_PATH
println "DATA_PATH: ${DATA_PATH}"
println "RESULTS_PATH: ${RESULTS_PATH}"
println "PARAMS: ${params}"
params_keys = params.keySet()
// set global n_jobs
if ("n_jobs" in params_keys) {
n_jobs = params.n_jobs
}
else
{
n_jobs = -1
}
println "N JOBS: ${n_jobs}"
// set sorter
if ("sorter" in params_keys) {
sorter = params.sorter
}
else
{
sorter = "kilosort25"
}
println "Using SORTER: ${sorter}"
// set runmode
if ("runmode" in params_keys) {
runmode = params.runmode
}
else
{
runmode = "full"
}
println "Using RUNMODE: ${runmode}"
if (!params_keys.contains('job_dispatch_args')) {
job_dispatch_args = ""
}
else {
job_dispatch_args = params.job_dispatch_args
}
if (!params_keys.contains('preprocessing_args')) {
preprocessing_args = ""
}
else {
preprocessing_args = params.preprocessing_args
}
if (!params_keys.contains('spikesorting_args')) {
spikesorting_args = ""
}
else {
spikesorting_args = params.spikesorting_args
}
if (!params_keys.contains('postprocessing_args')) {
postprocessing_args = ""
}
else {
postprocessing_args = params.postprocessing_args
}
if (!params_keys.contains('unit_classifier_args')) {
unit_classifier_args = ""
}
else {
unit_classifier_args = params.unit_classifier_args
}
if (!params_keys.contains('nwb_subject_args')) {
nwb_subject_args = ""
}
else {
nwb_subject_args = params.nwb_subject_args
}
if (!params_keys.contains('nwb_ecephys_args')) {
nwb_ecephys_args = ""
}
else {
nwb_ecephys_args = params.nwb_ecephys_args
}
if (runmode == 'fast'){
preprocessing_args = "--motion skip"
postprocessing_args = "--skip-extensions spike_locations,principal_components"
unit_classifier_args = "--skip-metrics-recomputation"
nwb_ecephys_args = "--skip-lfp"
println "Running in fast mode. Setting parameters:"
println "preprocessing_args: ${preprocessing_args}"
println "postprocessing_args: ${postprocessing_args}"
println "unit_classifier_args: ${unit_classifier_args}"
println "nwb_ecephys_args: ${nwb_ecephys_args}"
}
job_dispatch_to_preprocessing = channel.create()
ecephys_to_preprocessing = channel.fromPath(params.ecephys_path + "/", type: 'any')
postprocessing_to_curation = channel.create()
ecephys_to_job_dispatch = channel.fromPath(params.ecephys_path + "/", type: 'any')
ecephys_to_postprocessing = channel.fromPath(params.ecephys_path + "/", type: 'any')
spikesort_kilosort25_to_postprocessing = channel.create()
spikesort_kilosort4_to_postprocessing = channel.create()
spikesort_spykingcircus2_to_postprocessing = channel.create()
preprocessing_to_postprocessing = channel.create()
job_dispatch_to_postprocessing = channel.create()
job_dispatch_to_visualization = channel.create()
unit_classifier_to_visualization = channel.create()
preprocessing_to_visualization = channel.create()
curation_to_visualization = channel.create()
spikesort_kilosort25_to_visualization = channel.create()
spikesort_kilosort4_to_visualization = channel.create()
spikesort_spykingcircus2_to_visualization = channel.create()
postprocessing_to_visualization = channel.create()
ecephys_to_visualization = channel.fromPath(params.ecephys_path + "/", type: 'any')
preprocessing_to_spikesort_kilosort25 = channel.create()
preprocessing_to_spikesort_kilosort4 = channel.create()
preprocessing_to_spikesort_spykingcircus2 = channel.create()
postprocessing_to_unit_classifier = channel.create()
job_dispatch_to_results_collector = channel.create()
preprocessing_to_results_collector = channel.create()
spikesort_kilosort25_to_results_collector = channel.create()
spikesort_kilosort4_to_results_collector = channel.create()
spikesort_spykingcircus2_to_results_collector = channel.create()
postprocessing_to_results_collector = channel.create()
curation_to_results_collector = channel.create()
unit_classifier_to_results_collector = channel.create()
visualization_to_results_collector = channel.create()
ecephys_to_collect_results = channel.fromPath(params.ecephys_path + "/", type: 'any')
ecephys_to_nwb_subject = channel.fromPath(params.ecephys_path + "/", type: 'any')
job_dispatch_to_nwb_units = channel.create()
nwb_ecephys_to_nwb_units = channel.create()
results_collector_to_nwb_units = channel.create()
ecephys_to_nwb_units = channel.fromPath(params.ecephys_path + "/", type: 'any')
job_dispatch_to_nwb_ecephys = channel.create()
ecephys_to_nwb_ecephys = channel.fromPath(params.ecephys_path + "/", type: 'any')
nwb_subject_to_nwb_ecephys = channel.create()
if (sorter == 'kilosort25') {
spikesort_to_postprocessing = spikesort_kilosort25_to_postprocessing
spikesort_to_visualization = spikesort_kilosort25_to_visualization
spikesort_to_results_collector = spikesort_kilosort25_to_results_collector
}
else if (sorter == 'kilosort4') {
spikesort_to_postprocessing = spikesort_kilosort4_to_postprocessing
spikesort_to_visualization = spikesort_kilosort4_to_visualization
spikesort_to_results_collector = spikesort_kilosort4_to_results_collector
}
else if (sorter == 'spykingcircus2') {
spikesort_to_postprocessing = spikesort_spykingcircus2_to_postprocessing
spikesort_to_visualization = spikesort_spykingcircus2_to_visualization
spikesort_to_results_collector = spikesort_spykingcircus2_to_results_collector
}
// capsule - Job Dispatch Ecephys
process job_dispatch {
tag 'job-dispatch'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-base:si-0.101.2'
input:
path 'capsule/data/ecephys_session' from ecephys_to_job_dispatch.collect()
output:
path 'capsule/results/*' into job_dispatch_to_preprocessing
path 'capsule/results/*' into job_dispatch_to_postprocessing
path 'capsule/results/*' into job_dispatch_to_visualization
path 'capsule/results/*' into job_dispatch_to_results_collector
path 'capsule/results/*' into job_dispatch_to_nwb_ecephys
path 'capsule/results/*' into job_dispatch_to_nwb_units
env max_duration_min
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
TASK_DIR=\$(pwd)
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-job-dispatch.git" capsule-repo
git -C capsule-repo checkout e86186dc31e33e5326648f2a28d5e780253e153a --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${job_dispatch_args}
max_duration_min=\$(python get_max_recording_duration_min.py)
echo "MAX DURATION: \$max_duration_min"
cd \$TASK_DIR
echo "[${task.tag}] completed!"
"""
}
// capsule - Preprocess Ecephys
process preprocessing {
tag 'preprocessing'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-base:si-0.101.2'
maxForks 1
input:
path 'capsule/data/' from job_dispatch_to_preprocessing.flatten()
path 'capsule/data/ecephys_session' from ecephys_to_preprocessing.collect()
output:
path 'capsule/results/*' into preprocessing_to_postprocessing
path 'capsule/results/*' into preprocessing_to_visualization
path 'capsule/results/*' into preprocessing_to_spikesort_kilosort25
path 'capsule/results/*' into preprocessing_to_spikesort_kilosort4
path 'capsule/results/*' into preprocessing_to_spikesort_spykingcircus2
path 'capsule/results/*' into preprocessing_to_results_collector
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-preprocessing.git" capsule-repo
git -C capsule-repo checkout 18ea0a8c22a3ea65af265d7912bf0ddcd88d61c5 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${preprocessing_args} --n-jobs ${n_jobs}
echo "[${task.tag}] completed!"
"""
}
// capsule - Spikesort Kilosort2.5 Ecephys
process spikesort_kilosort25 {
tag 'spikesort-kilosort25'
container 'ghcr.io/allenneuraldynamics/aind-ephys-spikesort-kilosort25:si-0.101.2'
containerOptions '--gpus all'
maxForks 1
input:
path 'capsule/data/' from preprocessing_to_spikesort_kilosort25
output:
path 'capsule/results/*' into spikesort_kilosort25_to_postprocessing
path 'capsule/results/*' into spikesort_kilosort25_to_visualization
path 'capsule/results/*' into spikesort_kilosort25_to_results_collector
when:
sorter == 'kilosort25'
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-spikesort-kilosort25.git" capsule-repo
git -C capsule-repo checkout 89de53271ed4fffcc5502fd07f9c6ad9d9d8f53a --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${spikesorting_args} --n-jobs ${n_jobs}
echo "[${task.tag}] completed!"
"""
}
// capsule - Spikesort Kilosort4 Ecephys
process spikesort_kilosort4 {
tag 'spikesort-kilosort4'
container 'ghcr.io/allenneuraldynamics/aind-ephys-spikesort-kilosort4:si-0.101.2'
containerOptions '--gpus all'
maxForks 1
input:
path 'capsule/data/' from preprocessing_to_spikesort_kilosort4
output:
path 'capsule/results/*' into spikesort_kilosort4_to_postprocessing
path 'capsule/results/*' into spikesort_kilosort4_to_visualization
path 'capsule/results/*' into spikesort_kilosort4_to_results_collector
when:
sorter == 'kilosort4'
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-spikesort-kilosort4.git" capsule-repo
git -C capsule-repo checkout 06c2da8f5ca00ba78bf6d9d841bf3d1bacf6fb03 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${spikesorting_args} --n-jobs ${n_jobs}
echo "[${task.tag}] completed!"
"""
}
// capsule - Spikesort SpykingCircus Ecephys
process spikesort_spykingcircus2 {
tag 'spikesort-spykingcircus2'
container 'ghcr.io/allenneuraldynamics/aind-ephys-spikesort-spykingcircus2:si-0.101.2'
maxForks 1
input:
path 'capsule/data/' from preprocessing_to_spikesort_spykingcircus2
output:
path 'capsule/results/*' into spikesort_spykingcircus2_to_postprocessing
path 'capsule/results/*' into spikesort_spykingcircus2_to_visualization
path 'capsule/results/*' into spikesort_spykingcircus2_to_results_collector
when:
sorter == 'spykingcircus2'
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-spikesort-spykingcircus2.git" capsule-repo
git -C capsule-repo checkout 2f561b46ab54f462af75833fe042ab6f62f673f4 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${spikesorting_args} --n-jobs ${n_jobs}
echo "[${task.tag}] completed!"
"""
}
// capsule - Postprocess Ecephys
process postprocessing {
tag 'postprocessing'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-base:si-0.101.2'
maxForks 1
input:
path 'capsule/data/ecephys_session' from ecephys_to_postprocessing.collect()
path 'capsule/data/' from spikesort_to_postprocessing.collect()
path 'capsule/data/' from preprocessing_to_postprocessing.collect()
path 'capsule/data/' from job_dispatch_to_postprocessing.flatten()
output:
path 'capsule/results/*' into postprocessing_to_curation
path 'capsule/results/*' into postprocessing_to_visualization
path 'capsule/results/*' into postprocessing_to_unit_classifier
path 'capsule/results/*' into postprocessing_to_results_collector
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-postprocessing.git" capsule-repo
git -C capsule-repo checkout 232c93ba405ab29e059fff4361c0e2535541e2a9 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${postprocessing_args} --n-jobs ${n_jobs}
echo "[${task.tag}] completed!"
"""
}
// capsule - Curate Ecephys
process curation {
tag 'curation'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-base:si-0.101.2'
input:
path 'capsule/data/' from postprocessing_to_curation
output:
path 'capsule/results/*' into curation_to_visualization
path 'capsule/results/*' into curation_to_results_collector
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-curation.git" capsule-repo
git -C capsule-repo checkout 23cc0bceadb86f1bacf1cbbd3c0533515a12018e --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run
echo "[${task.tag}] completed!"
"""
}
// capsule - Unit Classifier Ecephys
process unit_classifier {
tag 'unit-classifier'
container 'ghcr.io/allenneuraldynamics/aind-ephys-unit-classifier:si-0.101.2'
input:
path 'capsule/data/' from postprocessing_to_unit_classifier
output:
path 'capsule/results/*' into unit_classifier_to_visualization
path 'capsule/results/*' into unit_classifier_to_results_collector
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-unit-classifier.git" capsule-repo
git -C capsule-repo checkout f63d867b582d2ea199db50ac1c4867fe6f578dde --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${unit_classifier_args}
echo "[${task.tag}] completed!"
"""
}
// capsule - Visualize Ecephys
process visualization {
tag 'visualization'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-base:si-0.101.2'
input:
path 'capsule/data/' from job_dispatch_to_visualization.collect()
path 'capsule/data/' from unit_classifier_to_visualization.collect()
path 'capsule/data/' from preprocessing_to_visualization
path 'capsule/data/' from curation_to_visualization.collect()
path 'capsule/data/' from spikesort_to_visualization.collect()
path 'capsule/data/' from postprocessing_to_visualization.collect()
path 'capsule/data/ecephys_session' from ecephys_to_visualization.collect()
output:
path 'capsule/results/*' into visualization_to_results_collector
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-visualization.git" capsule-repo
git -C capsule-repo checkout d59e005fc75dbfbb9a3966a61aefde8b61f8f422 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run
echo "[${task.tag}] completed!"
"""
}
// capsule - Collect Results Ecephys
process results_collector {
tag 'result-collector'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-base:si-0.101.2'
publishDir "$RESULTS_PATH", saveAs: { filename -> new File(filename).getName() }
input:
path 'capsule/data/' from job_dispatch_to_results_collector.collect()
path 'capsule/data/' from preprocessing_to_results_collector.collect()
path 'capsule/data/' from spikesort_to_results_collector.collect()
path 'capsule/data/' from postprocessing_to_results_collector.collect()
path 'capsule/data/' from curation_to_results_collector.collect()
path 'capsule/data/' from unit_classifier_to_results_collector.collect()
path 'capsule/data/' from visualization_to_results_collector.collect()
path 'capsule/data/ecephys_session' from ecephys_to_collect_results.collect()
output:
path 'capsule/results/*'
path 'capsule/results/*' into results_collector_to_nwb_units
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ephys-results-collector.git" capsule-repo
git -C capsule-repo checkout aa4f29acefd7bf206af1c193ccf95afb883646fa --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run
echo "[${task.tag}] completed!"
"""
}
// capsule - aind-subject-nwb
process nwb_subject {
tag 'nwb-subject'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-nwb:si-0.101.2'
input:
path 'capsule/data/ecephys_session' from ecephys_to_nwb_subject.collect()
output:
path 'capsule/results/*' into nwb_subject_to_nwb_ecephys
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-subject-nwb" capsule-repo
git -C capsule-repo checkout e552ae1dadc901d09aa7b6211e2d21b53e43355d --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${nwb_subject_args}
echo "[${task.tag}] completed!"
"""
}
// capsule - aind-ecephys-nwb
process nwb_ecephys {
tag 'nwb-ecephys'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-nwb:si-0.101.2'
input:
path 'capsule/data/' from job_dispatch_to_nwb_ecephys.collect()
path 'capsule/data/ecephys_session' from ecephys_to_nwb_ecephys.collect()
path 'capsule/data/' from nwb_subject_to_nwb_ecephys.collect()
output:
path 'capsule/results/*' into nwb_ecephys_to_nwb_units
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-ecephys-nwb.git" capsule-repo
git -C capsule-repo checkout e1faeb6724d1b40293270304e7b6d60147180430 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run ${nwb_ecephys_args}
echo "[${task.tag}] completed!"
"""
}
// capsule - aind-units-nwb
process nwb_units {
tag 'nwb-units'
container 'ghcr.io/allenneuraldynamics/aind-ephys-pipeline-nwb:si-0.101.2'
publishDir "$RESULTS_PATH/nwb", saveAs: { filename -> new File(filename).getName() }
input:
path 'capsule/data/' from job_dispatch_to_nwb_units.collect()
path 'capsule/data/' from results_collector_to_nwb_units.collect()
path 'capsule/data/ecephys_session' from ecephys_to_nwb_units.collect()
path 'capsule/data/' from nwb_ecephys_to_nwb_units.collect()
output:
path 'capsule/results/*'
script:
"""
#!/usr/bin/env bash
set -e
mkdir -p capsule
mkdir -p capsule/data
mkdir -p capsule/results
mkdir -p capsule/scratch
echo "[${task.tag}] cloning git repo..."
git clone "https://github.com/AllenNeuralDynamics/aind-units-nwb.git" capsule-repo
git -C capsule-repo checkout d3c1bb7ea3279feda51fcf0c9f022bf714cf74e5 --quiet
mv capsule-repo/code capsule/code
rm -rf capsule-repo
echo "[${task.tag}] running capsule..."
cd capsule/code
chmod +x run
./run
echo "[${task.tag}] completed!"
"""
}