changeset 1:7c1a351ad733 default tip

Uploaded
author xuebing
date Sat, 31 Mar 2012 22:58:13 -0400
parents 4ac24aaed8d6
children
files ensembl_to_ucsc.py
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ensembl_to_ucsc.py	Sat Mar 31 22:58:13 2012 -0400
@@ -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()
+