1
|
1 '''
|
|
2 plot histogram of interval size
|
|
3 '''
|
|
4
|
|
5 import os,sys
|
|
6
|
|
7 inputfile = sys.argv[1]
|
|
8 outputfile = sys.argv[2]
|
3
|
9 log = sys.argv[3]
|
1
|
10
|
|
11 rf = open('tmp.r','w')
|
|
12 rf.write("x <- read.table('"+inputfile+"')\n")
|
|
13 rf.write("len <- x[,3]-x[,2]\n")
|
|
14 rf.write("pdf('"+outputfile+"')\n")
|
3
|
15 if log == 'log':
|
|
16 rf.write("len <- log10(len+1)\n")
|
|
17 rf.write("hist(len,breaks=100,xlab='interval size',main=paste('mean=',mean(len),sep=''))\n")
|
|
18 else:
|
|
19 rf.write("hist(len,breaks=100,xlab='interval size (log10)',main=paste('mean=',mean(len),sep=''))\n")
|
1
|
20 rf.write("dev.off()")
|
|
21 rf.close()
|
|
22 os.system("R --vanilla < tmp.r")
|
|
23 os.system('rm tmp.r')
|