Mercurial > repos > xuebing > bed_size_stat
changeset 1:b1da797d49a5
Uploaded
author | xuebing |
---|---|
date | Sat, 31 Mar 2012 14:02:27 -0400 |
parents | 26b8fea8a9e7 |
children | b0e04c112633 |
files | bed_size_stat.py |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bed_size_stat.py Sat Mar 31 14:02:27 2012 -0400 @@ -0,0 +1,18 @@ +''' +plot histogram of interval size +''' + +import os,sys + +inputfile = sys.argv[1] +outputfile = sys.argv[2] + +rf = open('tmp.r','w') +rf.write("x <- read.table('"+inputfile+"')\n") +rf.write("len <- x[,3]-x[,2]\n") +rf.write("pdf('"+outputfile+"')\n") +rf.write("hist(len,breaks=100,xlab='interval size',main=paste('mean=',mean(len),sep=''))\n") +rf.write("dev.off()") +rf.close() +os.system("R --vanilla < tmp.r") +os.system('rm tmp.r')