Skip to contents

This function estimates a network-specific threshold for spillover activation, based on the expected signal that each node would receive from random initiator sets. It uses the assumption that, in a row-normalized matrix, initiators distribute 1 unit of signal across their neighbors, and thus the expected spillover is proportional to the degree (number of connections) of each node.

Usage

spillover_threshold_from_degree(
  W,
  quantile = 0.95,
  verbose = TRUE,
  tolerance = 1e-06
)

Arguments

W

A row-normalized sparse network matrix of class `dgCMatrix`, where rows and columns have matching gene names.

quantile

Numeric value between 0 and 1 (default = 0.95). The threshold is set at this quantile of the expected background distribution.

verbose

Logical. If TRUE, prints the computed threshold and quantile information.

tolerance

Numeric tolerance for row-sum deviation (default = 1e-6).

Value

A single numeric value representing the recommended spillover threshold.

Details

This threshold can be used to distinguish spillover values that exceed what is expected from random signal diffusion alone, and is intended for use with row-normalized sparse adjacency or TOM matrices.

Examples

if (FALSE) { # \dontrun{
threshold <- spillover_threshold_from_degree(W = my_network, quantile = 0.95)
spill_binary <- ifelse(spillover > threshold, 1, 0)
} # }