Mercurial > repos > xuebing > sharplabtool
comparison mytools/convertEnsembl.py @ 9:87eb5c5ddfe9
Uploaded
| author | xuebing |
|---|---|
| date | Fri, 09 Mar 2012 20:01:43 -0500 |
| parents | f0dc65e7f6c0 |
| children |
comparison
equal
deleted
inserted
replaced
| 8:361ec1c0479d | 9:87eb5c5ddfe9 |
|---|---|
| 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 |
