Adjust Cnet node set
Usage
adjust_cnet_nodeset(
g,
set_nodes = NULL,
x = 0,
y = 0,
percent_spacing = NULL,
expand = 0,
rotate_degrees = 0,
cnet_nodesets = NULL,
verbose = FALSE,
...
)
Arguments
- g
igraph
Cnet plot, with vertex attributenodeType
that contains values"Gene"
and"Set"
, as produced bymemIM2cnet()
.- set_nodes
character
vector of one or more set names, which are defined here as the names of the nodes withnodeType="Set"
to which each node withnodeType="Gene"
is connected. For exampleset_nodes=c("A", "B")
will return all Gene nodes that are connected only to Set nodes"A"
and"B"
. Alternatively, one can refer to a cluster by the node name of one member of the cluster, as a convenience option.- x, y
numeric
indicating the relative amount to move nodes in the node set, based upon the overall range of x and y values in the layout coordinates.- percent_spacing
numeric
within node spacing as percentage of the max x/y layout ranges. This option is preferred toexpand
when trying to keep nodeset spacing consistent for the overall layout. As a general rule, usesummarize_node_spacing(g)$nearest_within
with column 'Median' to determine node spacing for each nodeset, then adjust each nodeset to relatively consistent median spacing.- expand
numeric
the relative amount to expand node coordinates, whereexpand=0
does no expansion,expand=1
will expand coordinates 100% of the distance to the center of the cluster, twice the original distance; andexpand=-1
will expand coordinates to half the distance to the center.- rotate_degrees
numeric
value indicating the rotation in degrees to adjust the node coordinates, relative to the center of the coordinates.- cnet_nodesets
list
optional to provide the known nodesets upfront, in order to avoid re-determining the nodesets. Otherwiseget_cnet_nodesets()
is called, which for large networks may introduce a small time lag.- verbose
logical
indicating whether to print verbose output.- ...
additional arguments are ignored.
Details
This function is intended to help adjust a node set,
defined as a set of "Gene"
nodes that all connect
to the same "Set"
nodes. These nodes are usually clustered
together in a Cnet plot, and can be manipulated as a
group using this function. Use get_cnet_nodeset(g)
to get all node sets from a Cnet igraph
object.
Specifically, this function can be used to expand, rotate, and move the cluster of nodes in a Cnet network layout. The purpose is usually to help the visual clarity of the plot, and to reduce node label overlaps.
See also
Other jam cnet igraph functions:
adjust_cnet_set_relayout_gene()
,
apply_cnet_direction()
,
apply_nodeset_spacing()
,
get_cnet_nodeset()
,
make_cnet_test()
,
nudge_igraph_node()
,
rotate_igraph_layout()
Examples
# the examples below are for internal data
# and will be rewritten to work with example data
if (1 == 2) {
g <- mem_dmjdm_gp_20_plots_jikl$cnet_collapsed_set;
set_nodes <- c("J", "L")
g2 <- adjust_cnet_nodeset(g, set_nodes=c("J", "L"), expand=0.5)
jam_igraph(g)
g2 <- adjust_cnet_nodeset(g, set_nodes=c("I", "K", "L"), x=0.01, y=-0.01, expand=0.2)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("I", "J", "K", "L"), x=-0.08, y=-0.05, expand=0.2)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("I", "L"), x=-0.05, y=0.05, expand=0.3)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("I", "J", "L"), x=-0.02, y=0.03, expand=0.3)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("I", "K"), x=0.03, y=0.09, expand=0.)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("I", "J", "K"), x=0.02, y=-0.01, expand=0.)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("I", "J"), x=0.01, y=-0.00, expand=0.1)
g2 <- adjust_cnet_nodeset(g2, set_nodes=c("J"), x=-0.03, y=-0.02, expand=0.)
jam_igraph(g2)
}