-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRscript.rscript
More file actions
25 lines (19 loc) · 960 Bytes
/
Rscript.rscript
File metadata and controls
25 lines (19 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(gplots)
t<-read.csv("D.csv", header=FALSE)
n<-(t$V2[1]+t$V3[1]+t$V4[1]+t$V5[1])/2
bin<-20
d<-matrix( rep(0, (2*n/bin)^2), ncol=2*n/bin, nrow=2*n/bin)
floor( ( t$V2 / (2*n) * t$V5 / (2*n)- t$V3 / (2*n) * t$V4 / (2*n) )/sqrt( ( (t$V2+t$V3)/(2*n) ) * ( (t$V2+t$V3)/(2*n)-1.) * ( (t$V2+t$V4)/(2*n) ) * ( (t$V2+t$V4)/(2*n)-1.) ) * 10 )
for (z in -5:5 )
{
for (x in 1:(2*n/bin) )
{
for (y in 1:(2*n/bin) )
{
d[(2*n)/bin-x, y]<-log( max( sum( floor( (t$V2+t$V3)/bin ) == x-1 & floor( (t$V2+t$V4)/bin ) == y-1 & floor( ( t$V2 / (2*n) * t$V5 / (2*n)- t$V3 / (2*n) * t$V4 / (2*n) )/sqrt( ( (t$V2+t$V3)/(2*n) ) * ( (t$V2+t$V3)/(2*n)-1.) * ( (t$V2+t$V4)/(2*n) ) * ( (t$V2+t$V4)/(2*n)-1.) )*100) == z), 1) )
}
}
png(paste(z,".png",sep=""))
heatmap.2(d[(2*n/bin-10):(2*n/bin), 1:20], dendrogram='none', Rowv=FALSE, Colv=FALSE, trace='none', labRow=FALSE, labCol=FALSE, col=rev(heat.colors(16) ), density.info="none", lhei=c(1,5) )
dev.off()
}