annotate tools/mytools/intervalSize.py @ 3:33c067c3ae34

Deleted selected files
author xuebing
date Fri, 09 Mar 2012 19:47:53 -0500
parents 9071e359b9a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 '''
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2 plot histogram of interval size
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 '''
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5 import os,sys
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 inputfile = sys.argv[1]
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 outputfile = sys.argv[2]
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 rf = open('tmp.r','w')
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 rf.write("x <- read.table('"+inputfile+"')\n")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 rf.write("len <- x[,3]-x[,2]\n")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 rf.write("pdf('"+outputfile+"')\n")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 rf.write("hist(len,breaks=100,xlab='interval size',main=paste('mean=',mean(len),sep=''))\n")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 rf.write("dev.off()")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 rf.close()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 os.system("R --vanilla < tmp.r")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 os.system('rm tmp.r')