Mercurial > repos > xuebing > bed_size_stat
view bed_size_stat.py @ 5:e9bc2ab48dd5 default tip
Uploaded
author | xuebing |
---|---|
date | Sat, 31 Mar 2012 18:55:56 -0400 |
parents | cce2eabe8b8d |
children |
line wrap: on
line source
''' plot histogram of interval size ''' import os,sys inputfile = sys.argv[1] outputfile = sys.argv[2] log = sys.argv[3] 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") if log == 'log': rf.write("len <- log10(len+1)\n") rf.write("hist(len,breaks=100,xlab='interval size (log10)',main=paste('mean=',mean(len),sep=''))\n") else: 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')