Skip to content

Commit 6ea5d54

Browse files
committed
make hotspots optional
1 parent a1283b1 commit 6ea5d54

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

AnnotatorCore.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ def inithotspots():
125125
curatedgenes |= set(_3dhotspots.keys())
126126

127127

128-
def processalterationevents(eventfile, outfile, previousoutfile, defaultCancerType, cancerTypeMap, retainonlycuratedgenes):
129-
inithotspots()
128+
def processalterationevents(eventfile, outfile, previousoutfile, defaultCancerType, cancerTypeMap, retainonlycuratedgenes, annotatehotspots):
129+
if annotatehotspots:
130+
inithotspots()
130131
if os.path.isfile(previousoutfile):
131132
cacheannotated(previousoutfile, defaultCancerType, cancerTypeMap)
132133
outf = open(outfile, 'w+', 1000)
@@ -139,8 +140,9 @@ def processalterationevents(eventfile, outfile, previousoutfile, defaultCancerTy
139140

140141
outf.write(headers['^-$'])
141142

142-
outf.write("\tis-a-hotspot")
143-
outf.write("\tis-a-3d-hotspot")
143+
if annotatehotspots:
144+
outf.write("\tis-a-hotspot")
145+
outf.write("\tis-a-3d-hotspot")
144146

145147
outf.write("\tmutation_effect")
146148
outf.write("\toncogenic")
@@ -232,11 +234,12 @@ def processalterationevents(eventfile, outfile, previousoutfile, defaultCancerTy
232234
if start is not None and end is None:
233235
end = start
234236

235-
hotspot = pullsinglehotspots(hugo, hgvs, None, consequence, start, end, cancertype)
236-
row.append(hotspot)
237+
if annotatehotspots:
238+
hotspot = pullsinglehotspots(hugo, hgvs, None, consequence, start, end, cancertype)
239+
row.append(hotspot)
237240

238-
_3dhotspot = pull3dhotspots(hugo, hgvs, None, consequence, start, end, cancertype)
239-
row.append(_3dhotspot)
241+
_3dhotspot = pull3dhotspots(hugo, hgvs, None, consequence, start, end, cancertype)
242+
row.append(_3dhotspot)
240243

241244
oncokbinfo = pulloncokb(hugo, hgvs, None, consequence, start, end, cancertype)
242245
row.append(oncokbinfo)

MafAnnotator.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ def main(argv):
1111
outputmaffile = ''
1212
previousresultfile = ''
1313
defaultcancertype = 'cancer'
14+
annotatehotspots = False
1415

1516
try:
16-
opts, args = getopt.getopt(argv, "hi:o:p:c:s:t:u:v:")
17+
opts, args = getopt.getopt(argv, "hi:o:p:c:s:t:u:v:a")
1718
except getopt.GetoptError:
1819
print 'for help: python MafAnnotator.py -h'
1920
sys.exit(2)
2021

2122
for opt, arg in opts:
2223
if opt == '-h':
23-
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]'
24+
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] [-a]'
2425
print ' Essential MAF columns (case insensitive):'
2526
print ' HUGO_SYMBOL: Hugo gene symbol'
2627
print ' VARIANT_CLASSIFICATION: Translational effect of variant allele'
@@ -37,6 +38,7 @@ def main(argv):
3738
print ' 2) ONCOTREE_CODE exist in MAF'
3839
print ' 3) default tumor type (-t)'
3940
print ' Default OncoKB base url is http://oncokb.org'
41+
print ' use -a to annotate mutational hotspots'
4042
sys.exit()
4143
elif opt in ("-i"):
4244
inputmaffile = arg
@@ -52,6 +54,8 @@ def main(argv):
5254
defaultcancertype = arg
5355
elif opt in ("-u"):
5456
setoncokbbaseurl(arg)
57+
elif opt in ("-a"):
58+
annotatehotspots = True
5559
elif opt in ("-v"):
5660
setcancerhotspotsbaseurl(arg)
5761

@@ -65,7 +69,7 @@ def main(argv):
6569

6670
print 'annotating '+inputmaffile+"..."
6771

68-
processalterationevents(inputmaffile, outputmaffile, previousresultfile, defaultcancertype, cancertypemap, False)
72+
processalterationevents(inputmaffile, outputmaffile, previousresultfile, defaultcancertype, cancertypemap, False, annotatehotspots)
6973

7074
print 'done!'
7175

@@ -74,6 +78,7 @@ def main(argv):
7478
# '-i', 'data/example_maf.txt',
7579
# '-o', 'data/example_maf.oncokb.txt',
7680
# '-c', 'data/example_clinical.txt',
81+
# '-a'
7782
# ]
7883
# main(argv)
7984

0 commit comments

Comments
 (0)