reindexNetwork: Replaces current vertex ids with chosen attribute.

View source: R/netProcess.R

reindexNetworkR Documentation

Replaces current vertex ids with chosen attribute.

Description

This function allows users to replace vertex ids with another attribute, calculating connectivities based on the new attribute.

Usage

reindexNetwork(graph, v.attr)

Arguments

graph

An annotated igraph object.

v.attr

Name of the attribute to use as vertex ids.

Details

This functions can be very useful when merging networks constructed from different databases. For example, to match a network created from Reactome to a KEGG network, you can reindex the vertices by "miriam.kegg.compound" attribute. Another usage is to remove duplicated vertices (in case of different subcellular compartments, for example). if a network has ATP_membrane & ATP_cytoplasm vertices, reindexing by chemical name will collapse them into one 'ATP' vertex.

Value

A new graph with vertices expanded.

Author(s)

Ahmed Mohamed

See Also

Other Network processing methods: expandComplexes(), makeMetaboliteNetwork(), makeReactionNetwork(), rmSmallCompounds(), simplifyReactionNetwork(), vertexDeleteReconnect()

Examples

 ## Make a gene network from a reaction network.
 data(ex_sbml)	# A bipartite metbaolic network.
 rgraph <- makeReactionNetwork(ex_sbml, simplify=TRUE)
 ggraph <- makeGeneNetwork(rgraph)

 ## Expand vertices into their contituent genes.
 data(ex_kgml_sig)	# Ras and chemokine signaling pathways in human
	ggraph <- expandComplexes(ex_kgml_sig, v.attr = "miriam.ncbigene",
						keep.parent.attr= c("^pathway", "^compartment"))

 ## Create a separate vertex for each compartment. This is useful in duplicating
	##  metabolite vertices in a network.
## Not run: 
 graph <- expandComplexes(graph, v.attr = "compartment",
        keep.parent.attr = "all",
        expansion.method = "duplicate",
        missing.method = "keep")

## End(Not run)


ahmohamed/NetPathMiner documentation built on Oct. 31, 2024, 8:01 a.m.