changeset 3:cce2eabe8b8d

Uploaded
author xuebing
date Sat, 31 Mar 2012 18:50:24 -0400
parents b0e04c112633
children a65882e1636c
files bed_size_stat.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bed_size_stat.py	Sat Mar 31 18:50:12 2012 -0400
+++ b/bed_size_stat.py	Sat Mar 31 18:50:24 2012 -0400
@@ -6,12 +6,17 @@
 
 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")
-rf.write("hist(len,breaks=100,xlab='interval size',main=paste('mean=',mean(len),sep=''))\n")
+if log == 'log':
+    rf.write("len <- log10(len+1)\n")
+    rf.write("hist(len,breaks=100,xlab='interval size',main=paste('mean=',mean(len),sep=''))\n")
+else:
+    rf.write("hist(len,breaks=100,xlab='interval size (log10)',main=paste('mean=',mean(len),sep=''))\n")
 rf.write("dev.off()")
 rf.close()
 os.system("R --vanilla < tmp.r")