R/netProcess.R
makeGeneNetwork.Rd
These are general functions to expand vertices by their attributes, i.e. create a separate vertex for each attribute value.
An annotated igraph object.
Name of the attribute which vertices are expanded to.
A (List of) regex
experssions representing attributes to be
inherited by daughter vertices. If "all"
is passed, all parent attributes are inherited.
If "duplicate"
, attribute values sharing more than one parent vertex
are duplicated for each vertex they participate in. For exmaple, if one gene G1 catalyzes reactions
R1, R2; then G1##R1, and G1##R2 vertices are created. If "normal"
only one vertex (G1) is created,
and inherit all R1 and R2 connections and attributes.
How to deal with vertices with no attribute values. "keep"
retains the parent
node, "remove"
simply deletes the vertex, and "reconnect"
removes the vertex and connect its
neighbours to each other (to prevent graph cuts).
A new graph with vertices expanded.
makeGeneNetwork
returns a graph, where nodes are genes, and edges represent
participation in succesive reactions.
These 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 expand metabolite vertices by "miriam.kegg.compound" attribute.
Other Network processing methods:
makeMetaboliteNetwork()
,
makeReactionNetwork()
,
reindexNetwork()
,
rmSmallCompounds()
,
simplifyReactionNetwork()
,
vertexDeleteReconnect()
## Make a gene network from a reaction network.
data(ex_sbml) # A bipartite metbaolic network.
rgraph <- makeReactionNetwork(ex_sbml, simplify=TRUE)
#> This graph was created by an old(er) igraph version.
#> ℹ Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...
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"))
#> This graph was created by an old(er) igraph version.
#> ℹ Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...
## Create a separate vertex for each compartment. This is useful in duplicating
## metabolite vertices in a network.
if (FALSE) { # \dontrun{
graph <- expandComplexes(graph, v.attr = "compartment",
keep.parent.attr = "all",
expansion.method = "duplicate",
missing.method = "keep")
} # }