annotate tools/mytools/convertEnsembl.py @ 3:33c067c3ae34

Deleted selected files
author xuebing
date Fri, 09 Mar 2012 19:47:53 -0500
parents 9071e359b9a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 '''
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2 convert ensembl bed to ucsc
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 add chr to chromosome
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4 1 = +
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5 -1 = -
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6 '''
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 import sys
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 f = open(sys.argv[1])
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 out = open(sys.argv[2],'w')
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 skip = int(sys.argv[3])
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 for i in range(skip):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 f.readline()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 for line in f:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 flds = line.strip().split('\t')
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 flds[0] = 'chr'+flds[0]
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19 if flds[5] == '1':
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 flds[5] = '+'
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21 else:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22 flds[5] = '-'
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23 out.write('\t'.join(flds)+'\n')
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
24 f.close()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
25 out.close()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
26