forked from oncokb/oncokb-annotator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClinicalDataAnnotator.py
53 lines (42 loc) · 1.55 KB
/
ClinicalDataAnnotator.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
#!/usr/bin/python
import sys
import getopt
from AnnotatorCore import *
def main(argv):
inputclinicalfile = ''
outputclinicalfile = ''
annotatedalterationfiles = []
try:
opts, args = getopt.getopt(argv, "hi:o:a:s:")
except getopt.GetoptError:
print 'for help: python ClinicalDataAnnotator.py -h'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'ClinicalDataAnnotator.py -i <input clinical file> -o <output clinical file> -a <annotated alteration files, separate by ,> [-s sample list filter]'
print ' Essential clinical columns:'
print ' SAMPLE_ID: sample ID'
sys.exit()
elif opt in ("-i"):
inputclinicalfile = arg
elif opt in ("-o"):
outputclinicalfile = arg
elif opt in ("-a"):
annotatedalterationfiles = arg.split(',')
elif opt in ("-s"):
setsampleidsfileterfile(arg)
if inputclinicalfile == '' or outputclinicalfile=='' or len(annotatedalterationfiles)==0:
print 'for help: python ClinicalDataAnnotator.py -h'
sys.exit(2)
print 'annotating '+inputclinicalfile+"..."
processclinicaldata(annotatedalterationfiles, inputclinicalfile, outputclinicalfile)
print 'done!'
if __name__ == "__main__":
# argv = [
# '-i', 'data/example_clinical.txt',
# '-o', 'data/example_clinical.oncokb.txt',
# '-a', 'data/example_maf.oncokb.txt,data/example_cna.oncokb.txt'
# ]
# main(argv)
# print sys.argv[1:]
main(sys.argv[1:])