Description Usage Arguments Value Author(s) See Also Examples
A wrapper function for processing node-specific metadata and drawing the resulting graph.
1 | draw.graph(targ.graph, var.obj, node.names, graph.params)
|
targ.graph |
A |
var.obj |
A |
node.names |
A named |
graph.params |
A |
None
Daniel Bottomly
graphDispParams
, variantPriorResult
, graphNEL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
set.seed(123)
if (require(HitWalkerData) && require(Rgraphviz))
{
data(prior_obj)
param.obj <- prior.obj@param.obj
graph.params <- makeGraphDispParams(file.name=character())
graph.obj <- loadGraph(graph.file.path(), param.obj)
use.graph <- getGraph(graph.obj)
##make an induced subgraph of the shortest path between two proteins containing variants for this sample.
annot <- annotation(graph.obj)
node.names <- sapply(split(annot, annot$protein), "[[", "symbol")
prots.in.graph <- intersect(getVarDta(prior.obj)$protein, annotation(graph.obj)$protein)
var.graph <- induced.subgraph(use.graph, get.shortest.paths(use.graph, V(use.graph)[prots.in.graph[1]], V(use.graph)[prots.in.graph[2]])[[1]])
##make a version of graph.nel without duplicated edges and gene symbol names
graph.nel <- igraph.to.graphNEL(var.graph)
edge.l <- lapply(edgeWeights(graph.nel), function(x){new.x=x[!duplicated(names(x))];list(edges=as.character(node.names[names(new.x)]), weights=as.numeric(new.x))})
names(edge.l) <- as.character(node.names[names(edge.l)])
graph.nel <- new("graphNEL", nodes=names(edge.l), edgeL=edge.l, edgemode="undirected")
draw.graph(graph.nel, prior.obj,node.names ,graph.params)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.