1 | renderSubNetSimple(NodeName, sampleName, GeneName, intome = intome, gisticCopyCalls = NULL, resultObj, fileOut = NULL)
|
NodeName |
|
sampleName |
|
GeneName |
|
intome |
|
gisticCopyCalls |
|
resultObj |
|
fileOut |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (NodeName, sampleName, GeneName, intome = intome, gisticCopyCalls = NULL,
resultObj, fileOut = NULL)
{
library(Rgraphviz)
library(BioNet)
if (!is.null(gisticCopyCalls)) {
cellFrame <- gisticCopyCalls[, c("Gene.Symbol", "NodeName",
sampleName)]
}
mutCopyFrame <- resultObj$mutCopyFrames[[sampleName]]
cellResults <- resultObj$cellResults
nodenet <- c(NodeName, intersect(as.character(inEdges(NodeName,
intome)[[1]]), as.character(mutCopyFrame$NodeName)))
brcamut <- intersect(nodenet, as.character(mutCopyFrame[mutCopyFrame$mutations !=
0, "NodeName"]))
labeltab <- geneIntTable[geneIntTable$NodeName %in% nodenet,
]
labels <- as.character(labeltab$Gene)
names(labels) <- labeltab$NodeName
nodenetwork <- subNetwork(nodenet, intome)
nodeRenderInfo(nodenetwork) <- list(shape = "circle", iheight = 0.5,
iwidth = 0.5, fixedsize = FALSE, label = as.list(labels))
RPPAshape <- list()
RPPAshape[[NodeName]] <- "diamond"
nodeRenderInfo(nodenetwork) <- list(shape = RPPAshape)
if (!is.null(gisticCopyCalls)) {
nodecopyframe <- cellFrame[as.character(cellFrame$NodeName) %in%
nodenet, ]
rownames(nodecopyframe) <- nodecopyframe$NodeName
colnames(nodecopyframe) <- c("GeneName", "NodeName",
"copyStatus")
}
else {
nodecopyframe <- mutCopyFrame[, c("GeneName", "NodeName",
"copyStatus")]
}
nodecolors <- list()
for (nd in rownames(nodecopyframe)) {
ndcol <- "white"
if (nodecopyframe[nd, "copyStatus"] > 0) {
ndcol <- "pink"
}
if (nodecopyframe[nd, "copyStatus"] < 0) {
ndcol <- "lightgreen"
}
nodecolors[[nd]] <- ndcol
}
for (nd in brcamut) {
nodecolors[[nd]] <- "lightblue"
}
cellRes <- cellResults[[sampleName]]
NodDegree <- cellRes[cellRes$NodeName == NodeName, "degree"]
NeighborMuts <- cellRes[cellRes$NodeName == NodeName, "neighborVec"]
pval <- cellRes[cellRes$NodeName == NodeName, "pvalue"]
nodenetwork <- layoutGraph(nodenetwork)
if (NeighborMuts > 0 & length(nodes(nodenetwork)) > 1) {
nodeRenderInfo(nodenetwork) <- list(fill = nodecolors)
if (is.null(fileOut)) {
fileOut <- paste(sampleName, "-", GeneName, ".svg",
sep = "")
}
svg(height = 7, width = 7, filename = fileOut)
renderGraph(nodenetwork)
plotTitle <- paste(NodeName, " (", sampleName, " ", ", p=",
pval, ", n=", NeighborMuts, ", d=", NodDegree, ")",
sep = "")
title(plotTitle)
dev.off()
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.