adjust_cnet_nodeset: Adjust Cnet node set

adjust_cnet_nodesetR Documentation

Adjust Cnet node set

Description

Adjust Cnet node set

Usage

adjust_cnet_nodeset(
  g,
  set_nodes = NULL,
  x = 0,
  y = 0,
  expand = 0,
  percent_spacing = NULL,
  rotate_degrees = 0,
  cnet_nodesets = NULL,
  verbose = FALSE,
  ...
)

Arguments

g

igraph Cnet plot, with vertex attribute nodeType that contains values "Gene" and "Set", as produced by memIM2cnet().

set_nodes

character vector of one or more set names, which are defined here as the names of the nodes with nodeType="Set" to which each node with nodeType="Gene" is connected. For example set_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.

expand

numeric the relative amount to expand node coordinates, where expand=0 does no expansion, expand=1 will expand coordinates 100% of the distance to the center of the cluster, twice the original distance; and expand=-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.

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)
}


jmw86069/multienrichjam documentation built on Nov. 3, 2024, 10:29 p.m.