Subset Cnet igraph
Usage
subsetCnetIgraph(
gCnet,
includeSets = NULL,
includeGenes = NULL,
remove_singlets = TRUE,
minSetDegree = 1,
minGeneDegree = 1,
remove_blanks = FALSE,
spread_labels = TRUE,
force_relayout = TRUE,
do_reorder = TRUE,
repulse = 4,
layout = NULL,
verbose = FALSE,
...
)Arguments
- gCnet
igraph object representing Cnet concept network data
- includeSets
character vector, or NULL, containing the set names or labels to retain.
- includeGenes
character vector, or NULL, containing the gene names or labels to retain.
- remove_singlets
logical whether to remove singlet graph nodes, which are nodes that have no remaining edges. Note that argument
"removeSinglets"is deprecated but will be recognized with preference, support will be removed in future versions.- minSetDegree
integer value indicating the minimum number of edges each Set node must have to be retained in the resulting igraph. Use
minSetDegree=2to retain only Set nodes that have multiple connected Gene nodes.- minGeneDegree
integer value indicating the minimum number of edges each Gene node must have to be retained in the resulting igraph. Use
minGeneDegree=2to retain only Gene nodes that connect to multiple Set nodes.- remove_blanks
logical indicating whether to call
removeIgraphBlanks(), which removes blank colors from"pie.color"and"coloredrect.color"attributes.- spread_labels
logical indicating whether to call
spread_igraph_labels(), which re-orients the node labels after theigraphobject has been subsetted. WhenTRUE, the argumentsforce_relayout, anddo_reorderare passed to that function.- force_relayout
logical indicating whether to re-apply the
igraphlayout function.- do_reorder
logical indicating whether to call
reorderIgraphNodes(), which sorts equivalent nodes by color then label, intended when there are large numbers of nodes with the same edges, typically most common in a cnet plot where many gene nodes may be connected to the same pathway set nodes.- layout
function that takes
igraphobject and returns a numeric matrix of node coordinates. This function is only called whenforce_relayout=TRUE, and must be supplied as a function in order to be applied properly to the subset Cnetigraph. To apply layout before the subset operation, do so withigraph::set_graph_attr(g, "layout", layout).- verbose
logical indicating whether to print verbose output.
- ...
additional arguments are ignored.
Details
This function produces a subset of a Cnet igraph based upon supplied set names or gene names. This function is intended to be a convenient method of filtering a Cnet igraph to a pre-defined set of "Set" names.
The function assumes graph nodes have an attribute "nodeType" with
values either "Set" or "Gene" to indicate the type of node.
When includeSets is supplied, the graph is subsetted to include
only nodes with nodeType="Set" with matching V(gCnet)$name or
V(gCnet)$label. Then only neighboring nodes are retained, thus
removing any nodes with nodeType="Gene" that do not connect to
any of the given Set nodes.
The result is a proper Cnet igraph that only contains
Gene nodes connected to the subset of Set nodes.
If includeGenes is supplied, the graph is subsetted to include
only nodes with nodeType="Gene" with matching V(gCnet)$name or
V(gCnet)$label.
When removeSinglets=TRUE then any nodes that have no remaining
edges are removed. Especially when supplying includeGenes, this
option is useful to hide any Set nodes that have no connected Gene
nodes.
See also
Other jam igraph functions:
communities2nodegroups(),
drawEllipse(),
edge_bundle_bipartite(),
edge_bundle_nodegroups(),
fixSetLabels(),
flip_edges(),
get_bipartite_nodeset(),
highlight_edges_by_node(),
igraph2pieGraph(),
label_communities(),
mem2cnet(),
mem2emap(),
nodegroups2communities(),
rectifyPiegraph(),
removeIgraphBlanks(),
subset_igraph_components(),
sync_igraph_communities()