diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2019-12-04 19:03:19 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2019-12-04 19:03:19 +0800 |
commit | 97fdefab064f63642fa3ece05b807d29b459df31 (patch) | |
tree | a058530023224f3e35b1783996f3530c80c04bc5 /Code/text2json.py |
brain: add python and R code to local repository.
Diffstat (limited to 'Code/text2json.py')
-rw-r--r-- | Code/text2json.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Code/text2json.py b/Code/text2json.py new file mode 100644 index 0000000..dcfb699 --- /dev/null +++ b/Code/text2json.py @@ -0,0 +1,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) |