annotate intervalSize.py @ 13:292186c14b08

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