draw_graph: Low-level wrapper for drawing a graph based on supplied...

Description Usage Arguments Value Author(s) See Also Examples

Description

A wrapper function for processing node-specific metadata and drawing the resulting graph.

Usage

1
draw.graph(targ.graph, var.obj, node.names, graph.params)

Arguments

targ.graph

A graphNEL object

var.obj

A variantPriorResult object

node.names

A named character vector that maps the original graph node names to the summary IDs

graph.params

A graphDispParams object

Value

None

Author(s)

Daniel Bottomly

See Also

graphDispParams, variantPriorResult, graphNEL

Examples

 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)
	}

dbottomly/HitWalker documentation built on May 15, 2019, 1:22 a.m.