plot_pwy: Plot network diagram for a pathway

View source: R/plot_pwy.R

plot_pwyR Documentation

Plot network diagram for a pathway

Description

Plot nodes most impacting a pathway as a network diagram with node color corresponding to z-score. The most impactful nodes are inferred by assuming the input here is the same as was used to calculate pathway significance. The feat.tab is assumed to have all nodes to consider for plotting. Including nodes with NA stats allows these to be included in networks as a connector. An annot.colnm should have preferred labels for all nodes.

Usage

plot_pwy(
  feat.tab,
  G.pwy,
  gr,
  stat.colnm,
  annot.colnm,
  ntop = 7,
  name = NULL,
  colorbar.nm = stat.colnm,
  alternative = c("two.sided", "greater", "less"),
  repel = FALSE,
  plot = TRUE,
  seed = 0
)

Arguments

feat.tab

Matrix-like object for all analytes with row names as analyte names, which should have some overlap with G.pwy$genes.

G.pwy

Element of list object G used in ezlimma. Should have elements name, description, genes. Accessible via G[[pathway.name]].

gr

graph object of class igraph, possibly a result of edgelist2graph.

stat.colnm

Column name in feat.tab indicating scores to select top analytes for this pathway and plot. Stats should be finite unless they are NA. Stats for all nodes are used to define color scale, for consistency across pathway visualizations.

annot.colnm

Column name in feat.tab of node names to possibly replace rownames(feat.tab). Set this column to be rownames(feat.tab) if these are desired node names. Must not be NA.

ntop

Number of top impactful analytes to plot, >=2. Their network neighbors may also be included.

name

Name of file to plot to. If NULL, a filename is created using colnames(Gmat.pwy)[1]. Set to NA to plot to screen instead of to file.

colorbar.nm

Title of color bar.

alternative

Alternative hypothesis; must be one of "two.sided", "greater" or "less". "greater" corresponds to positive association, "less" to negative association.

repel

Logcal; use the repel functionality from ggrepel to avoid overlapping text?

plot

Logical; should plot be generated?

seed

Numeric seed value for reproducibility.

Details

Unmeasured nodes have stat of NA and are drawn gray.

Value

Invisibly, a list with tbl_graph, a subclass of igraph so every igraph method will work as expected. If plot=TRUE, there is a second element of the list, which is a ggplot object.


jdreyf/ezlimmaplot documentation built on Feb. 8, 2025, 2:25 a.m.