View source: R/active_snw_search_score.R
| build_score_context | R Documentation |
Computes per-node z-scores from the experiment p-values and the Monte-Carlo mean / standard deviation of the raw subnetwork score at every possible subnetwork size, used to calibrate (normalise) scores.
build_score_context(network, experiment, params)
network |
A network as returned by |
experiment |
A data frame of gene / p-value pairs. |
params |
A list of run parameters. |
The Monte-Carlo step is an exact replica of the Java reference's
ScoreCalculations.calculateMeanAndStdForMonteCarlo: it shuffles the
z-score vector 2000 times with a java.util.Random-equivalent generator
and Fisher-Yates shuffle (see get_java_mc_calibration() in
‘score_calculation_utils.cpp’). Because Collections.shuffle starts
from networkNodeList order, the z-score vector MUST be in Java node
order; network$nodes (from build_network()) provides exactly that,
so z is built over it directly. With the matching seed this reproduces
the Java means/stds to floating-point precision, which is what aligns the
calibrated scores and rankings with the Java output.
P-values are clamped to a safe range, the smallest p-value is kept when a
gene appears more than once, and network nodes without a p-value are given
params$p_for_nonsignificant.
A list with elements z (named z-score vector),
means and stds (numeric vectors indexed by subnetwork size),
and nodes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.