-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.py
59 lines (43 loc) · 1.49 KB
/
main.py
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
from .config import Config
from .utils import cmn, json2, logger
from . import validate_sample
from . import validate_experiment
from . import prevalidate
from . import sraparse
import os
def main(args):
if args.has('-prevalidate') or args.has('-gendoc'):
return prevalidate.main(args)
base = os.path.dirname(os.path.realpath(__file__))
if not args.has('-config'):
if not args.has('-dev'):
args.add_key('-config', "{0}/config.json".format(base))
else:
args.add_key('-config', "{0}/config-dev.json".format(base))
logger(str([args.keys, args.args()]) + '\n')
if not args.has('-out'):
logger('#__noOutFileGiven___\n')
return
if not args.has('-dbg') and (cmn.fexists(args['-out']) and not args.has('-overwrite-outfile')):
logger('#__outfile:{0} exists\n'.format(args['-out']))
return
#try:
if True:
if args.has('-extract'):
#import sraparse
return sraparse.SRAParseObjSet.extract_attributes_to_json(args.args(), args['-out'])
elif args.has("-test-sample"):
testargs = ["./examples/samples.xml", "-config:{0}".format(args['-config']), "-out:./examples/samples.versioned.xml"]
validate_sample.main(Config(testargs))
elif args.has("-sample"):
return validate_sample.main(args)
elif args.has("-experiment"):
return validate_experiment.main(args)
else:
raise NotImplementedError("#__unknownArguments__")
else:
#except Exception as err:
logger('#__unexpected__\n')
logger(str(err.message) + '\n')
if __name__ == '__main__':
main(Config.sys())