comparison convertEnsembl.py @ 11:b7f1d9f8f3bc

Uploaded
author xuebing
date Sat, 10 Mar 2012 07:59:27 -0500
parents
children
comparison
equal deleted inserted replaced
10:1558594a3c2e 11:b7f1d9f8f3bc
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