Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2013 21:10
data=open("features.bed").readlines()
dict={}
for i in range(1,len(data)):
col=data[i].strip().split()
chr=col[0]
start=col[1]
stop=col[2]
for j in range(int(start),int(stop)+1):
if j in dict:
dict[j]+=1
else:
dict[j]=1
print str(chr)+":"+str(start)+"-"+str(stop)+" counted."
out=open("features.depth","w")
for key in range(min(dict.keys())/5000*5000+5000,max(dict.keys())+1,5000):
print >> out, str(key) +"\t"+ str(dict[key])
out.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment