R/integGM.r

integGM <-
function (G, genes, weights, simplify=T){
	#if (!require(igraph)) {
	#	stop('igraph must be pre-installed!\n')
	#}
	if (is.element("weight", list.vertex.attributes(G))) {
		cat("Warning: previous G node weight replaced!\n")
	}
	names(weights) <- genes
	genes <- intersect(genes,V(G)$name)
	subG <- induced.subgraph(G,genes)
	V(subG)$weight <- weights[V(subG)$name]
	if (simplify) subG <- simplify(subG)
	return(subG)
}

Try the NEpiC package in your browser

Any scripts or data that you put into this service are public.

NEpiC documentation built on May 1, 2019, 10:29 p.m.