-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·65 lines (54 loc) · 1.6 KB
/
run
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
#!/usr/bin/env python
import os
import os.path as op
import json
from glob import glob
##
FLYWHEEL_BASE = '/flywheel/v0'
MANIFEST_FILE = op.join(FLYWHEEL_BASE, 'manifest.json')
CONFIG_FILE = op.join(FLYWHEEL_BASE, 'config.json')
INPUT_DIR = op.join(FLYWHEEL_BASE, 'input')
OUTPUT_DIR = op.join(FLYWHEEL_BASE, 'output')
CONTAINER = '[flywheel|afq-browser]'
## Parse config:
# If the config file doesn't exist, we create the config from
# the manifest defaults instead:
if not op.exists(CONFIG_FILE):
manifest = json.loads(open(MANIFEST_FILE, 'r').read())
config = manifest['config']
print("Creating config from the manifest")
else:
config = json.loads(open(CONFIG_FILE, 'r').read())['config']
print("Creating config from file: ", CONFIG_FILE)
print("CONFIG: ", config)
title = config['title']
## Validate input data
print("INPUT_DIR: ", INPUT_DIR)
ll = os.listdir(INPUT_DIR)
print(ll)
if len(ll) > 0:
print("%s starting"%CONTAINER)
else:
print("Input directory is empty: %s"%INPUT_DIR)
try:
input_file = glob(op.join(INPUT_DIR, 'afq*.mat'))[0]
except:
input_file = glob(op.join(INPUT_DIR, 'AFQ_file', 'afq*.mat'))[0]
## Call the algorithm
from afqbrowser.browser import assemble
assemble(input_file,
target=OUTPUT_DIR,
metadata=None,
title=title,
subtitle=False,
link=False,
sublink=False,
zip=True)
print("Before moving")
print(glob('./*'))
print(glob('./*/*',))
import shutil
shutil.move('AFQ-Browser.zip', op.join(OUTPUT_DIR, 'AFQ-Browser.html.zip'))
print("After moving")
print(glob('./*'))
print(glob('./*/*',))