forked from oncokb/oncokb-annotator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MafAnnotator.py
81 lines (69 loc) · 2.86 KB
/
MafAnnotator.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/python
import sys
import getopt
from AnnotatorCore import *
def main(argv):
inputmaffile = ''
inputclinicalfile = ''
outputmaffile = ''
previousresultfile = ''
defaultcancertype = 'cancer'
try:
opts, args = getopt.getopt(argv, "hi:o:p:c:s:t:u:v:")
except getopt.GetoptError:
print 'for help: python MafAnnotator.py -h'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'MafAnnotator.py -i <input MAF file> -o <output MAF file> [-p previous results] [-c <input clinical file>] [-s sample list filter] [-t <default tumor type>] [-u oncokb-base-url] [-v cancerhotspots-base-url]'
print ' Essential MAF columns (case insensitive):'
print ' HUGO_SYMBOL: Hugo gene symbol'
print ' VARIANT_CLASSIFICATION: Translational effect of variant allele'
print ' TUMOR_SAMPLE_BARCODE: sample ID'
print ' AMINO_ACID_CHANGE: amino acid change'
print ' PROTEIN_START: protein start'
print ' PROTEIN_END: protein end'
print ' PROTEIN_POSITION: can be used instead of PROTEIN_START and PROTEIN_END (in the output of vcf2map)'
print ' Essential clinical columns:'
print ' SAMPLE_ID: sample ID'
print ' ONCOTREE_CODE: tumor type code from oncotree (oncotree.mskcc.org)'
print ' Cancer type will be assigned based on the following priority:'
print ' 1) ONCOTREE_CODE in clinical data file'
print ' 2) ONCOTREE_CODE exist in MAF'
print ' 3) default tumor type (-t)'
print ' Default OncoKB base url is http://oncokb.org'
sys.exit()
elif opt in ("-i"):
inputmaffile = arg
elif opt in ("-o"):
outputmaffile = arg
elif opt in ("-p"):
previousresultfile = arg
elif opt in ("-c"):
inputclinicalfile = arg
elif opt in ("-s"):
setsampleidsfileterfile(arg)
elif opt in ("-t"):
defaultcancertype = arg
elif opt in ("-u"):
setoncokbbaseurl(arg)
elif opt in ("-v"):
setcancerhotspotsbaseurl(arg)
if inputmaffile == '' or outputmaffile=='':
print 'for help: python MafAnnotator.py -h'
sys.exit(2)
cancertypemap = {}
if inputclinicalfile != '':
readCancerTypes(inputclinicalfile, cancertypemap)
print 'annotating '+inputmaffile+"..."
processalterationevents(inputmaffile, outputmaffile, previousresultfile, defaultcancertype, cancertypemap, False)
print 'done!'
if __name__ == "__main__":
# argv = [
# '-i', 'data/example_maf.txt',
# '-o', 'data/example_maf.oncokb.txt',
# '-c', 'data/example_clinical.txt',
# ]
# main(argv)
# print sys.argv[1:]
main(sys.argv[1:])