-
Notifications
You must be signed in to change notification settings - Fork 61
/
GenerateReadMe.py
39 lines (30 loc) · 1.19 KB
/
GenerateReadMe.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
#!/usr/bin/python
import sys
import argparse
import logging
from AnnotatorCore import setoncokbbaseurl
from AnnotatorCore import generateReadme
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('GenerateReadMe')
def main(argv):
if argv.help:
log.info('\nGenerateReadMe.py -o <output README file> [-u oncokb-base-url]\n'
' Default OncoKB base url is https://www.oncokb.org')
sys.exit()
if argv.output_file == '':
log.error('The parameter -o can not be empty')
log.info('for help: python GenerateReadMe.py -h')
sys.exit(2)
if argv.oncokb_api_url:
setoncokbbaseurl(argv.oncokb_api_url)
generateReadme(argv.output_file)
log.info('done!')
if __name__ == "__main__":
parser = argparse.ArgumentParser(add_help=False)
# ArgumentParser doesn't accept "store_true" and "type=" at the same time.
parser.add_argument('-h', dest='help', action="store_true", default=False)
parser.add_argument('-o', dest='output_file', default='', type=str)
parser.add_argument('-u', dest='oncokb_api_url', default='', type=str)
parser.set_defaults(func=main)
args = parser.parse_args()
args.func(args)