Mercurial > repos > xuebing > bed_size_stat
comparison bed_size_stat.py @ 3:cce2eabe8b8d
Uploaded
author | xuebing |
---|---|
date | Sat, 31 Mar 2012 18:50:24 -0400 |
parents | b1da797d49a5 |
children | e9bc2ab48dd5 |
comparison
equal
deleted
inserted
replaced
2:b0e04c112633 | 3:cce2eabe8b8d |
---|---|
4 | 4 |
5 import os,sys | 5 import os,sys |
6 | 6 |
7 inputfile = sys.argv[1] | 7 inputfile = sys.argv[1] |
8 outputfile = sys.argv[2] | 8 outputfile = sys.argv[2] |
9 log = sys.argv[3] | |
9 | 10 |
10 rf = open('tmp.r','w') | 11 rf = open('tmp.r','w') |
11 rf.write("x <- read.table('"+inputfile+"')\n") | 12 rf.write("x <- read.table('"+inputfile+"')\n") |
12 rf.write("len <- x[,3]-x[,2]\n") | 13 rf.write("len <- x[,3]-x[,2]\n") |
13 rf.write("pdf('"+outputfile+"')\n") | 14 rf.write("pdf('"+outputfile+"')\n") |
14 rf.write("hist(len,breaks=100,xlab='interval size',main=paste('mean=',mean(len),sep=''))\n") | 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") | |
15 rf.write("dev.off()") | 20 rf.write("dev.off()") |
16 rf.close() | 21 rf.close() |
17 os.system("R --vanilla < tmp.r") | 22 os.system("R --vanilla < tmp.r") |
18 os.system('rm tmp.r') | 23 os.system('rm tmp.r') |