collapse_nodes_genes: Collapse nodes into a single representative nodes.

Description Usage Arguments Value Author(s) See Also Examples

Description

Rename the nodes of a graphNEL object according to a character vector named by current node names with elements indicating the new node names. Duplicates are summarized to be a single node containing all edges and indicated by the maximum edge weights

Usage

1
collapse.nodes.genes(targ.graph, node.names)

Arguments

targ.graph

A graphNEL object.

node.names

A named character vector.

Value

A graphNEL object.

Author(s)

Daniel Bottomly

See Also

graphNEL

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
set.seed(123)
rand.graph <- randomGraph(V=sample(colors()[1:10]), M=1:4, p=.4)

node.vec <- nodes(rand.graph)
names(node.vec) <- node.vec

node.vec[sample.int(length(node.vec), 3)] <- "hello"

new.graph <- collapse.nodes.genes(rand.graph, node.vec)

edgeWeights(new.graph)["hello"]
edgeWeights(rand.graph)[names(node.vec)[node.vec == "hello"]]

if (require(Rgraphviz))
{
	par(mfcol=c(2,1))
	plot(rand.graph)
	plot(new.graph)
}

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