rwr.render: Render gene sets by random walk with restart

View source: R/render-walks.R

rwr.renderR Documentation

Render gene sets by random walk with restart

Description

Nodes in each AGS define a uniform restart distribution. Steady-state node affinities are summed over the members of each FGS. This sparse-matrix implementation follows the dnet::dRWR() algorithm without requiring the dnet package at run time.

Usage

rwr.render(
  ags,
  fgs,
  net,
  restart = 0.75,
  normalise = c("laplacian", "column", "row", "none"),
  tol = 1e-06,
  max_iter = 50L,
  use_edge_weights = FALSE,
  case_sensitive = FALSE,
  verbose = TRUE
)

Arguments

ags

Named list of altered gene sets.

fgs

Named list of functional gene sets.

net

Undirected igraph network, or a legacy network with a named adjacency list in links and an edge count in Ntotal.

restart

Restart probability in ⁠[0, 1]⁠. Increasing it concentrates affinity nearer the AGS seeds and reduces contributions from longer paths.

normalise

Adjacency normalization method. The "column" and "row" labels describe the normalized matrix margin and differ from the dnet labels.

tol

Positive L1 convergence tolerance.

max_iter

Positive maximum iteration count.

use_edge_weights

Use the igraph weight edge attribute to determine transition probabilities. The default is FALSE because imported edge weights may encode evidence or confidence rather than a transition model.

case_sensitive

Use case-sensitive identifier matching. By default, identifiers in AGS, FGS, and NET are matched case-insensitively.

verbose

Report progress with message().

Details

Node-affinity vectors are stored as columns and updated by left multiplication with the transition matrix. Under this convention, normalise = "column" constructs ⁠A D^-1⁠, whose columns sum to one, so each source node distributes its probability among its neighbors. normalise = "row" constructs ⁠D^-1 A⁠, whose rows sum to one; when applied to column vectors, this is a different, non-probability-conserving propagation rule. For an undirected network the two matrices are transposes, but they coincide only when connected nodes have equal degrees. The dnet::dRWR() interface used the opposite labels; NEArender names the options for the margin of the resulting transition matrix that is actually normalized.

With use_edge_weights = FALSE, every retained edge has equal weight. With TRUE, the non-negative igraph weight attribute is normalized according to normalise to derive propagation coefficients; for normalise = "column", these are transition probabilities. The returned affinities are relative scores, not p- or q-values.

Value

A nearender_result. scores$rwr is an FGS-by-AGS matrix whose cells sum steady-state node affinity over the corresponding FGS; statistics$rwr is the identical master score matrix. diagnostics reports mapped input sizes, convergence, and iteration count; parameters records restart, normalization, tolerance, iteration limit, weight use, and identifier case policy.

References

Fang H, Gough J (2014). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1186/s13073-014-0064-8")}.

See Also

pagerank.render(), nea.render(), spectral.render()

Examples

edges <- data.frame(from = c("A", "A", "B"), to = c("B", "C", "C"),
  confidence = c(5, 1, 2))
net <- import_network(edges, "from", "to", "confidence",
  species = NULL, input_id_format = "custom", verbose = FALSE)
ags <- list(sample = "a")
fgs <- list(pathway_b = "b", pathway_c = "c")
rwr <- rwr.render(ags, fgs, net, verbose = FALSE)
rwr$scores$rwr

NEArender documentation built on Nov. 28, 2026, 5:10 p.m.