Mercurial > repos > xuebing > ensembl_to_ucsc
comparison ensembl_to_ucsc.py @ 1:7c1a351ad733 default tip
Uploaded
author | xuebing |
---|---|
date | Sat, 31 Mar 2012 22:58:13 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4ac24aaed8d6 | 1:7c1a351ad733 |
---|---|
1 ''' | |
2 convert ensembl bed to ucsc | |
3 add chr to chromosome | |
4 1 = + | |
5 -1 = - | |
6 ''' | |
7 | |
8 import sys | |
9 f = open(sys.argv[1]) | |
10 out = open(sys.argv[2],'w') | |
11 skip = int(sys.argv[3]) | |
12 | |
13 for i in range(skip): | |
14 f.readline() | |
15 | |
16 for line in f: | |
17 flds = line.strip().split('\t') | |
18 flds[0] = 'chr'+flds[0] | |
19 if flds[5] == '1': | |
20 flds[5] = '+' | |
21 else: | |
22 flds[5] = '-' | |
23 out.write('\t'.join(flds)+'\n') | |
24 f.close() | |
25 out.close() | |
26 |