library(grid) library(qpgraph) library(org.Sc.sgd.db) ## helper function to translate from yeast gene symbol ID to ORF ID sym2orfID <- function(syms) { require(org.Sc.sgd.db) orfids <- rep(NA_character_, times=length(syms)) orfids2 <- select(org.Sc.sgd.db, columns="ORF", keys=syms, keytype="GENENAME") orfids[!is.na(orfids2$ORF)] <- orfids2$ORF[!is.na(orfids2$ORF)] orfids } load("eqtlnet.q0.fdr.nrr.sel.RData") ## read list of transcription factor genes download.file("http://www.yeastract.com/download/RegulationTwoColumnTable_Documented_2013927.tsv.gz", "RegulationTwoColumnTable_Documented_2013927.tsv.gz", method="curl") yeastract <- read.csv(gzfile("RegulationTwoColumnTable_Documented_2013927.tsv.gz"), sep=";", stringsAsFactors=FALSE, header=FALSE) yeastractTFs <- sym2orfID(unique(yeastract[, 1])) yeastractTFs <- unique(yeastractTFs[!is.na(yeastractTFs)]) ## read list of RNA-binding proteins (downloaded first from Biomart) biomartRBPs <- unique(make.names(read.table("RBPids.txt", header=TRUE, stringsAsFactors=FALSE)$RBPids)) ## build a list data structure for the gene annotations over the Hive plot hiveGeneAnnotations <- vector(mode="list", length=length(seqlevels(geneAnnotation(eqtlnet.q0.fdr.nrr.sel)))) hiveGeneAnnotations[[2]] <- data.frame(node.lab=sym2orfID(c("SCW11", "AMN1")), node.text=c("SCW11", "AMN1"), angle=rep(0, 2), radius=rep(0, 2), offset=rep(0, 2), hjust=c(0, 1.1), vjust=c(-0.5, 0)) hiveGeneAnnotations[[3]] <- data.frame(node.lab=sym2orfID(c("LEU2", "MATALPHA1", "HMLALPHA1", "HMRA1")), node.text=c("LEU2", "MATALPHA1", "HMALPHA1", "HMRA1"), angle=rep(0, 4), radius=rep(0, 4), offset=rep(0, 4), hjust=rep(1, 4), vjust=rep(0, 4)) hiveGeneAnnotations[[5]] <- data.frame(node.lab=sym2orfID(c("URA3", "URA1", "URA4", "NOP8")), node.text=c("URA3", "URA1", "URA4", "NOP8"), angle=rep(0, 4), radius=rep(0, 4), offset=rep(0, 4), hjust=c(1.1, -0.1, -0.1, -0.1), vjust=c(0, -0.3, 0, 0.2)) hiveGeneAnnotations[[11]] <- data.frame(node.lab=sym2orfID("ARR1"), node.text=c("ARR1"), angle=0, radius=0, offset=0, hjust=0, vjust=0) ## do the hive plots! pdf(file="Figure6.pdf") grid.newpage() pushViewport(viewport(layout=grid.layout(4, 4))) for (i in 1:4) for (j in 1:4) { chr <- (i-1) * 4 + j pushViewport(viewport(layout.pos.col = j, layout.pos.row=i)) plot(eqtlnet.q0.fdr.nrr.sel, type="hive", chr=chr, tfIDs=yeastractTFs, rbpIDs=biomartRBPs, anNodes=hiveGeneAnnotations[[chr]], anNode.gpar=gpar(fontsize=6, col="black")) grid.text(as.roman(4*(i-1) + j), x = unit(0.05, "npc"), y = unit(0.9, "npc"), just = "left") grid.text(paste("chr", as.roman(4*(i-1) + j), sep=" "), x = unit(0.08, "npc"), y = unit(0.2, "npc"), just = "left", gp=gpar(cex=0.9)) grid.text("genes", x = unit(0.08, "npc"), y = unit(0.1, "npc"), just = "left", gp=gpar(cex=0.9)) grid.text("all chr", x = unit(0.92, "npc"), y = unit(0.2, "npc"), just = "right", gp=gpar(cex=0.9)) grid.text("genes", x = unit(0.92, "npc"), y = unit(0.1, "npc"), just = "right", gp=gpar(cex=0.9)) grid.text("markers", x = unit(0.5, "npc"), y = unit(0.95, "npc"), just = "centre", gp=gpar(cex=0.9)) popViewport(2) } dev.off()