summaryrefslogtreecommitdiff
path: root/Code/text2json.py
blob: dcfb699ca7d9d8eaf24ec26c538db8fe948877ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Usage: python text2json AGI-to-gene-names_v2.txt > genes.json
# Purpose: convert AGI-to-gene-names_v2.txt to genes.json for brain main page.  Put genes.json under ../Webapp/static/json
import sys

f = open(sys.argv[1])

count = 0
s = '{'
for line in f:
    line = line.strip()
    lst = line.split('\t')
    s += '\"%s\":' % ('label'+str(count))
    s += '\"%s\",' % (lst[0]+' '+lst[1])
    count += 1
    
f.close()
s = s[:-1]
s += '}'
print(s)