Mercurial > repos > xuebing > sharplabtool
diff mytools/convertEnsembl.py @ 7:f0dc65e7f6c0
Uploaded
author | xuebing |
---|---|
date | Fri, 09 Mar 2012 19:59:07 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mytools/convertEnsembl.py Fri Mar 09 19:59:07 2012 -0500 @@ -0,0 +1,26 @@ +''' +convert ensembl bed to ucsc +add chr to chromosome +1 = + +-1 = - +''' + +import sys +f = open(sys.argv[1]) +out = open(sys.argv[2],'w') +skip = int(sys.argv[3]) + +for i in range(skip): + f.readline() + +for line in f: + flds = line.strip().split('\t') + flds[0] = 'chr'+flds[0] + if flds[5] == '1': + flds[5] = '+' + else: + flds[5] = '-' + out.write('\t'.join(flds)+'\n') +f.close() +out.close() +