Skip to content

Commit c4d6578

Browse files
authored
Generate README (#35)
Generate README
2 parents d6d810f + bbdc8ff commit c4d6578

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

AnnotatorCore.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,10 @@ def getcuratedgenes(genelistfile):
9494

9595

9696
def getOncokbInfo():
97-
ret = ['The data is generated on ' + date.today().strftime('%m/%d/%Y')]
97+
ret = ['Files annotated on ' + date.today().strftime('%m/%d/%Y') + "\nOncoKB API URL: "+oncokbapiurl]
9898
try:
9999
info = json.load(urllib.urlopen(oncokbapiurl + "/info"))
100-
ret.append('\n\nOncoKB data version: ' + info['dataVersion']['version'])
101-
ret.append('\nThis version is released on ' + info['dataVersion']['date'])
100+
ret.append('\nOncoKB data version: ' + info['dataVersion']['version']+', released on ' + info['dataVersion']['date'])
102101
except:
103102
print "error when fetch OncoKB info"
104103
return ''.join(ret)

GenarateReadMe.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/python
2+
3+
import sys
4+
import getopt
5+
from AnnotatorCore import *
6+
7+
def main(argv):
8+
9+
outputfile = ''
10+
11+
try:
12+
opts, args = getopt.getopt(argv, "ho:u:")
13+
except getopt.GetoptError:
14+
print 'for help: python GenerateReadMe.py -h'
15+
sys.exit(2)
16+
17+
for opt, arg in opts:
18+
if opt == '-h':
19+
print 'GenerateReadMe.py -o <output README file> [-u oncokb-base-url]'
20+
print ' Default OncoKB base url is http://oncokb.org'
21+
sys.exit()
22+
elif opt in ("-o"):
23+
outputfile = arg
24+
elif opt in ("-u"):
25+
setoncokbbaseurl(arg)
26+
27+
if outputfile=='':
28+
print 'for help: python GenerateReadMe.py -h'
29+
sys.exit(2)
30+
31+
generateReadme(outputfile)
32+
33+
print 'done!'
34+
35+
if __name__ == "__main__":
36+
# argv = [
37+
# '-o', 'data/README.txt'
38+
# ]
39+
# main(argv)
40+
41+
# print sys.argv[1:]
42+
main(sys.argv[1:])

example.sh

+2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ OCNA="data/example_cna.oncokb.txt"
88
IC="data/example_clinical.txt"
99
OC="data/example_clinical.oncokb.txt"
1010
OCPDF="data/example_clinical.oncokb.pdf"
11+
README="data/example_README.txt"
1112
python MafAnnotator.py -i $IMAF -o $OMAF -c $IC
1213
python FusionAnnotator.py -i $IF -o $OF -c $IC
1314
python CnaAnnotator.py -i $ICNA -o $OCNA -c $IC
1415
python ClinicalDataAnnotator.py -i $IC -o $OC -a $OMAF,$OCNA,$OF
1516
python OncoKBPlots.py -i $OC -o $OCPDF -c ONCOTREE_CODE #-n 10
17+
python GenarateReadMe.py -o $README

0 commit comments

Comments
 (0)