Tutorials › High-Dimensional Genomic Data Analysis › Resampling To Assess Module Stability

Co-Expression Networks · Tutorial 505 of 795

Resampling To Assess Module Stability

Learn a reproducible resampling workflow for module stability, including how to compare modules across refits and interpret overlap and assignment-consistency summaries.

Advanced 12 min read

What You'll Learn

  • Resample biological samples while respecting the study design and keeping network-building choices comparable.
  • Match modules across refits despite arbitrary module labels.
  • Calculate Jaccard overlap and distinguish it from directional gene retention.
  • Summarize gene-level assignment consistency and co-assignment frequencies.
  • Diagnose apparent stability caused by merging, splitting, small modules, or pipeline choices.
  • Explain what resampling stability can and cannot establish.

Why Assess Module Stability?

A co-expression module is an estimated grouping of genes, not a directly observed biological object. Its membership depends on the expression samples and on choices such as the association measure, network transformation, clustering method, and tree-cut parameters. A module that appears in one fitted network may change substantially when a few biological samples are omitted or replaced. Resampling asks whether the estimated structure is reproducible under specified perturbations of the observed samples.

The aim is not to prove that a module is biologically real. Stability describes sensitivity to the sampling variation and analysis pipeline being examined. A stable module may still reflect an unmeasured technical or biological factor; an unstable module may contain genuine relationships that the available sample size cannot estimate reliably. The earlier material on batch, cell mixture, and spurious co-expression is especially relevant: resampling does not remove confounding that is present throughout the data.

Definition: Module stability is the reproducibility of estimated gene-group membership under repeated perturbations of the biological samples, with the network-construction procedure and comparison rules specified. A stability summary is conditional on the data, gene universe, resampling design, and analysis pipeline used.

A Comparable Resampling Workflow

Let the expression data contain \(n\) biological samples measured on a fixed set of genes. Fit the chosen network and module-detection procedure to the original data to obtain reference modules \(M_1,\ldots,M_K\). For each resample, perturb the biological samples, rebuild the network, and detect modules using the same defined procedure. Rebuilding matters: resampling only the final module labels would not assess whether the network and clustering steps reproduce those labels.

For independent, similarly sampled biological units, a common option is the nonparametric bootstrap: draw \(n\) sample indices with replacement from the \(n\) observed samples. Another option is subsampling without replacement, often using fewer than \(n\) samples per refit. These perturbations answer related but different questions. Bootstrap refits retain nominal sample size but contain duplicates; subsamples deliberately fit to smaller data sets. The choice should be stated rather than treated as an interchangeable technical detail.

The independent sampling unit must match the study design. If measurements are paired, repeated within a subject, or clustered by donor, resample the appropriate independent units or intact clusters rather than individual rows. If samples come from distinct strata or conditions, the resampling scheme should preserve the design relevant to the question. Otherwise, changes in module membership may reflect a changed sample composition rather than ordinary sampling variability.

For a fair comparison, keep the gene universe and analysis rules explicit. Use the same association definition, network transformation, clustering procedure, and module-cutting rules across refits unless the purpose is specifically to examine sensitivity to those choices. Refit steps that depend on the resampled data as part of the pipeline. Control stochastic clustering by fixing its random seed or repeating the algorithm enough to distinguish algorithmic randomness from sample-resampling variation. A module absent from a replicate may be genuinely unresolved there; do not silently drop it from summaries.

1
Fit the reference network.
Record each reference module and the analysis choices used to obtain it.
2
Resample biological units.
Apply a design-respecting bootstrap or subsampling scheme to the sample rows.
3
Rebuild and detect modules.
Repeat the specified network and clustering pipeline on each resampled data set.
4
Match and summarize.
Compare reference and resampled modules using gene overlap and assignment consistency.

Matching Modules and Measuring Overlap

Module labels such as “1” and “2” have no meaning across refits. Compare gene sets, not labels. For a reference module \(M_k\) and a resampled module \(M^*_l\), their Jaccard overlap is the size of their intersection divided by the size of their union:

$$ J(M_k,M^*_l)=\frac{|M_k\cap M^*_l|}{|M_k\cup M^*_l|}. $$

The score is between 0 and 1. It equals 1 for identical gene sets and 0 for disjoint sets. Because the union includes genes found in either set, Jaccard overlap penalizes both missing reference genes and extra resampled genes. A directional retention measure answers a different question: the fraction of a reference module retained in a candidate resampled module, \(|M_k\cap M^*_l|/|M_k|\). Reporting both can clarify whether a low Jaccard score reflects loss from the reference module, additions to it, or both.

To give each reference module at most one counterpart in a replicate, match modules by maximizing total overlap across the module pairs. This is a one-to-one assignment problem; it avoids matching several reference modules to the same large resampled module and then describing all of them as reproduced. If a matched overlap is too small to be meaningful, classify the module as unmatched using a prespecified rule. There is no universal cutoff: the threshold depends on module sizes, purpose, and desired stringency, so report it and show the underlying overlap values.

Worked Example: Computing Module Overlap

Suppose a reference module contains genes \(A,B,C,D,E\), while its best-matched module in one resample contains \(A,B,C,D,F\). The intersection is \(\{A,B,C,D\}\), with 4 genes; the union is \(\{A,B,C,D,E,F\}\), with 6 genes.

Jaccard overlap. Substitution gives \(J=4/6=0.6667\). Thus two-thirds of the genes in the union belong to both sets.

Reference retention. The fraction of the reference module retained is \(4/5=0.8000\), or 80.00%. The resampled module also contains one gene, \(F\), not in the reference module. The different values are not contradictory: retention uses the reference module as its denominator, whereas Jaccard uses the union.

This single comparison indicates substantial but imperfect overlap. It does not show whether this module is generally stable; the calculation must be repeated over resamples.

Assignment Consistency Across Resamples

Module-level overlap can hide genes that repeatedly move between groups. A complementary summary tracks each gene’s assignments. For a gene \(g\) in a reference module, define \(I_{gb}=1\) if, in resample \(b\), it is assigned to the matched counterpart of that reference module, and \(I_{gb}=0\) otherwise. An unassigned gene or a gene assigned elsewhere counts as 0. Across \(B\) resamples, its assignment consistency is:

$$ C_g=\frac{1}{B}\sum_{b=1}^{B} I_{gb}. $$

This is the observed fraction of resampled fits in which the gene retains its reference-module assignment. It is a descriptive frequency under the chosen resampling scheme, not the probability that the gene truly belongs to that module. The module-level mean of \(C_g\) can summarize assignment consistency, but the distribution across genes is informative: a high average can conceal a subset of genes with low consistency.

A related pairwise summary is the co-assignment frequency. For genes \(g\) and \(h\), calculate the fraction of resamples in which both are assigned to the same module. This can reveal a stable core when a broader module splits variably. State how unassigned genes are handled; a common choice is not to count two unassigned genes as co-assigned, since that would imply agreement without a detected module.

Worked Example: Gene-Level Assignment Consistency

A reference module contains six genes, \(A\) through \(F\). In five resamples, matching is done before checking whether each gene remains in that module’s counterpart. Suppose the number of successful assignments is 5 for \(A\), 4 for \(B\), 4 for \(C\), 3 for \(D\), 2 for \(E\), and 1 for \(F\).

For gene \(A\), \(C_A=5/5=1.000\). For gene \(D\), \(C_D=3/5=0.600\). For gene \(F\), \(C_F=1/5=0.200\). Thus \(A\) retains its assignment in every resample, whereas \(F\) does so in only one of the five.

The average assignment consistency for this module is \((1.000+0.800+0.800+0.600+0.400+0.200)/6=3.800/6=0.6333\). Reporting only this average would obscure the contrast between \(A\) and \(F\); a per-gene display or distribution should accompany it when gene-level stability matters.

What the Resampling Summary Can Establish

A module-level stability profile can include, for each reference module, its matched Jaccard overlap in every resample, the fraction of resamples in which it has an acceptable match, its size, and gene-level assignment consistency. A compact average is useful, but report the spread and the frequency of missing or split matches as well. For example, an average overlap of 0.65 could arise from consistently moderate overlaps or from a mixture of near-perfect matches and failures; those patterns have different implications.

The bootstrap resamples observed biological units; it does not generate new biological diversity beyond what those units represent. Under independent, identically distributed sampling, each observed sample has probability \((1-1/n)^n\) of being absent from an \(n\)-draw bootstrap resample. As \(n\) grows, this approaches \(e^{-1}\), so a bootstrap replicate contains about 63.2% of the distinct observed samples on average. This helps explain why duplicates do not mean that a replicate contains \(n\) independent observations.

A short justification for assignment consistency is direct. Each \(I_{gb}\) is an indicator that the specified event occurred in resample \(b\). Summing these indicators counts the successful assignments, and dividing by the total number \(B\) gives the empirical relative frequency. Increasing \(B\) reduces Monte Carlo noise in this frequency, but it does not fix biased sampling, confounding, a poor network estimator, or a too-small number of biological samples.

Worked Example: A Module That Splits Across Refits

Consider reference module \(M=\{A,B,C,D,E,F\}\). Four resampled fits produce matched candidate sets \(\{A,B,C,D\}\), \(\{A,B,C\}\), \(\{D,E,F\}\), and \(\{A,B,D,E\}\). Their Jaccard overlaps with \(M\) are respectively \(4/6=0.6667\), \(3/6=0.5000\), \(3/6=0.5000\), and \(4/6=0.6667\).

The mean overlap is \((0.6667+0.5000+0.5000+0.6667)/4=0.5834\), allowing for rounding. The first and fourth fits retain most of the reference set, but the middle fits each retain only half. In particular, the second and third candidate sets emphasize different portions of the reference module. The average alone therefore does not describe a uniformly reproduced module; the individual refit overlaps and gene-level assignments expose its variable membership.

Diagnostics, Alternatives, and Limitations

Interpret stability summaries alongside diagnostics. Check whether sample composition, batch, or cell mixture changes markedly across resamples; whether a few influential samples drive the network; whether modules frequently merge, split, or become unassigned; and whether results depend strongly on module size. Very small modules can have coarse, volatile overlap values, while a large module can achieve a seemingly respectable overlap despite substantial uncertainty in its boundaries. Check that each replicate used the same gene universe and that labels were matched by overlap rather than their arbitrary numbers.

Resampling is not the only way to examine robustness. Repeating a fit with a different network threshold, correlation measure, or tree-cut setting is a sensitivity analysis of modeling choices, not sample resampling. Independent validation data assess reproduction in another sample, with their own design and comparability concerns. Repeated algorithm runs with fixed data assess computational randomness. These approaches answer distinct questions; a strong analysis does not describe one as a substitute for the others.

The main limitation is scope: high stability means reproducibility under the specified perturbation and pipeline, not biological validity, causal relevance, or transportability to another cohort. Low stability may reflect limited sample information, an inherently continuous structure that a hard partition simplifies, or genuine heterogeneity. Stability summaries should therefore inform how confidently module membership is described, not be treated as a pass/fail test of biological truth.

Common mistake: “The module appeared in 80% of bootstrap fits, so there is an 80% probability it is a true biological module.” This interprets a conditional resampling frequency as a probability of biological truth. Instead, state exactly what recurred—for example, “a one-to-one matched module with Jaccard overlap at least 0.5 occurred in 80% of these bootstrap refits”—and identify the threshold, pipeline, and resampling design.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A reference module has 8 genes. Its matched resampled module shares 6 genes and contains 2 additional genes. Calculate Jaccard overlap and reference retention.
  2. Why should repeated measurements from the same subject generally be resampled together rather than as independent rows?
  3. A gene stays in its reference module in 7 of 10 resamples. What is its assignment consistency, and what does that number not mean?
  4. Why can an average Jaccard overlap conceal a module that is inconsistently reproduced?
  5. Name one question addressed by resampling and one distinct question addressed by changing the network threshold.

Solutions. (1) The intersection has 6 genes and the union has \(8+2=10\), so Jaccard overlap is \(6/10=0.6000\). Reference retention is \(6/8=0.7500\). (2) Measurements within a subject are dependent; resampling rows separately can break the dependence and misrepresent the sampling design. (3) \(C_g=7/10=0.7000\). It is the observed fraction of these resamples retaining the assignment, not the probability that the gene truly belongs to the module. (4) The same average can arise from consistently moderate overlap or from a mix of strong matches and failed matches; the distribution and missing-match frequency are needed. (5) Resampling assesses sensitivity to perturbations of biological samples under a specified pipeline. Changing the threshold assesses sensitivity to a network-construction choice.

Clinical Biostats