Convert adjacency matrix output from conditional graphical model output (xy, yy) into into an igraph object and optionally layer attributes onto the vertices.
adj2igraph(yy, xy = NULL, yinfo = NULL, xinfo = NULL, weighted = NULL)
yy | Adjacency matrix encoding y--y edges of conditional graphical model. Format can be either a sparse matrix (i.e. from Matrix package) or a regular matrix. |
---|---|
xy | Adjacency matrix encoding x--y edges of conditional graphical model. Format can be either a sparse matrix (i.e. from Matrix package) or a regular matrix. If NULL, then a network encoding just y--y edges is made. |
yinfo | Data.frame encoding the attributes of the y vertices. If non-null,
the column 'id' must exist for labelling vertices with a unique identifier.
The order of the rows must match the order of the |
xinfo | Data.frame encoding the attributes of the x vertices. If non-null,
the column 'id' must exist for labelling vertices with a unique identifier.
The order of the rows must match the order of the |
weighted | Same argument passed to |
An igraph network object.
The annotation parameters xinfo
and yinfo
are of type `data.frame`, where each row is expected to be ordered
according to the rows of xy
and yy
, respectively.
The first column `id` is always required and must be unique for each node.
The second column `alias` is an optional column that reserves more
human-readable labels to be applied to nodes, and can be duplicated.
For example, two protein isoforms may have different ID's,
but the same gene symbol alias. If gene coordinates are supplied for
cis/trans identification, they require at least three variables:
'chr' a character for the chromosome location,
'start' an integer for the beginning of the genomic feature,
and 'end' for the end location of the feature.
The 'strand' argument is optional.
Additional annotations such as `description` or
whatever other annotations are deemed important
can be added as node attributes. Note that if any vertex
is missing some or all annotations, an `NA` should be used in its place.
rankHub
, cisTrans
,
reportHubs
, xHubEnrich
, modEnrich
#Load BCPLS CNA-protein network output library(spacemap) data("bcpls") #Attach "bcpls" data objects to the R Global Environment attach(bcpls)#>#> #>#>#> #>#>#> #>suppressPackageStartupMessages(library(igraph)) #Label y and x nodes with attributes ig <- spacemap::adj2igraph(yy = net$yy, xy = net$xy, yinfo = yinfo, xinfo = xinfo) #Label y with attributes igy <- spacemap::adj2igraph(yy = net$yy, yinfo = yinfo)