annotate interval/intervalSize.py @ 18:9bbb37e8683f

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