setwd ("/Users/shah/insulator_data/insulator_combination_numbers/clustering_visulaization")
# Read Table
insulatorFile <- read.table ("simulated_1fdr_no_250_pvalue_for_figure.txt", sep="\t")
presMatrix <- t(as.matrix (insulatorFile [,c (6,7,8,9,10,11)]))
#color2D.matplot (presMatrix, redrange=c(0.9,0), greenrange=c(0.9,0), bluerange=c(0.9,0), xlab = "presence", ylab ="insulator combination", axes=FALSE)
pv1 <- insulatorFile[,3]
changeVal <-function (x) { if (x <= 1e-16) { x <- 1e-16} else { x <- x}}
pv3 <- lapply (pv1, changeVal)
pv4 <- -1*log10(as.numeric(pv3))
direction <- insulatorFile[,4]
pv5 <- t(as.matrix(pv4*direction))
# Generate the colors
cellcol<-matrix(rep("#000000",63),nrow=63)
cellcol[pv5<0]<-color.scale(pv5[pv5<0], c(1,0),c(1,0),c(0,0))
cellcol[pv5>0]<-color.scale(pv5[pv5>0], c(0,0),c(0,0),c(0,1))
# Generate Legend (this one is yellow - black - blue)
legval<-seq(min(pv5),max(pv5),length.out=32)
legcol<-rep("#000000",32)
legcol[legval<0]<-color.scale(legval[legval<0], c(1,0),c(1,0), c(0,0))
legcol[legval>0]<-color.scale(legval[legval>0], c(0,0),c(0,0),c(0,1))
#color2D.matplot(pv5,cellcolors=cellcol,border=NA, axes=FALSE)
#color.legend(0,0,6,-4,round(c(min(pv5),0,max(pv5)),1),rect.col=legcol)
color2D.matplot(t(as.matrix(legcol)),cellcolors=legcol,border=NA, axes=FALSE)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment