-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRscript2.rscript
More file actions
28 lines (21 loc) · 987 Bytes
/
Rscript2.rscript
File metadata and controls
28 lines (21 loc) · 987 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
26
27
28
library(gplots)
t<-read.csv("D.csv", header=FALSE)
n<-(t$V2[1]+t$V3[1]+t$V4[1]+t$V5[1])/2
bin<-50
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 (z in 1:(2*n/bin) )
{
#for (x in 1:(2*n/bin) )
for (x in -20:20 )
{
for (y in 1:(2*n/bin) )
{
d[(2*n/bin)-y, 20+x]<-log( max( sum( floor( (t$V2+t$V3)/bin ) == z-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.) )*200) == x), 1) )
}
}
png(paste(z,"_xcond.png",sep=""))
heatmap.2(d, 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()
}