Mercurial > repos > xuebing > sharplab_interval_analysis
view makewindow.py @ 24:8dd2a3f51c42 draft default tip
Deleted selected files
author | xuebing |
---|---|
date | Wed, 09 May 2012 10:53:44 -0400 |
parents | 16ba480adf96 |
children |
line wrap: on
line source
def makeWindow(filename,outfile,window): window = window/2 f=open(filename) out = open(outfile,'w') for line in f: flds = line.strip().split() #new position center = (int(flds[1]) + int(flds[2]))/2 start = center - window end = center + window if start >= 0: flds[1] = str(start) flds[2] = str(end) out.write('\t'.join(flds)+'\n') f.close() out.close() import sys makeWindow(sys.argv[1],sys.argv[2],int(sys.argv[3]))