Skip to content

CuiweiG/tempoNet

Repository files navigation

tempoNet

Edge-Level Inference for Covariate-Dependent Cross-Omic Networks

R-CMD-check License: MIT


Overview

tempoNet tests whether cross-omic partial correlations depend on an exposure or temporal covariate in longitudinal multi-omic data. It combines block-calibrated double machine learning with exact within-subject permutation inference, providing edge-level p-values, effect sizes, and confidence intervals with finite-sample error guarantees.

  • Input: multi-omic matrices (transcriptome, proteome, metabolome, ...) measured in the same subjects across conditions
  • Output: which cross-omic edges change with exposure, how strongly, and under what temporal pattern (linear, acute, step, or arbitrary)
  • Guarantees: exact FWER control via Westfall-Young, exact FDR control via permutation BH, doubly robust against nuisance misspecification

The problem

Longitudinal multi-omic studies — exercise physiology (Contrepois et al. 2020), drug response (MoTrPAC Consortium 2024), environmental exposure (Sinisi et al. 2024) — generate rich panel data where multiple molecular layers are measured in the same individuals across time or dosage. A fundamental question is: which cross-omic regulatory relationships change with the exposure?

This is a high-dimensional conditional independence testing problem with three complications absent from standard settings:

  1. Clustered observations: each subject contributes multiple correlated measurements. Standard tests (Fisher's Z, debiased lasso) assume independence and produce severely inflated type I error with panel data.

  2. Block structure: within-omic correlations (gene-gene) are far stronger than cross-omic signals (gene-metabolite). Without block-calibrated penalization, cross-omic edges are drowned out by within-omic noise during nuisance estimation.

  3. Non-monotone exposure responses: molecular rewiring often follows transient, step-change, or rebound patterns rather than linear dose-response. A test based on a single linear contrast misses the majority of real signals.

No existing tool addresses all three simultaneously.


Why tempoNet?

Capability tempoNet coglasso JGL NetCoMi TVGL ROMY
Edge-level p-values ✓†
Continuous covariate z
Panel / longitudinal data
Multi-omic block penalty
Exact finite-sample control
Multi-contrast detection
Doubly robust score

†NetCoMi provides permutation tests for two-group differential networks, not continuous covariate dependence.

References: coglasso (Albanese et al. 2024); JGL (Danaher et al. 2014); NetCoMi (Peschel et al. 2021); TVGL (Hallac et al. 2017); ROMY (Hecker et al. 2025).


tempoNet validation on Contrepois exercise data

Figure 1 | tempoNet identifies exercise-induced cross-omic network rewiring in longitudinal multi-omics data. (a) Type I error rate across three inference methods (200 null simulations, N=30, T=5, p=100). Normal BH inflates type I error to 32%; z-permutation methods maintain exact control (0% FDR, 4% FWER) at the 5% nominal level. (b) Temporal pattern of 119,683 FDR-significant cross-omic edges. Linear, acute peak, and step-change contrasts contribute near-equally, confirming that linear-only testing misses two-thirds of real signals. (c) Hub metabolites ranked by degree. C16H28O7 (glucuronide conjugate, 582 edges), AAMU (caffeine metabolite, 564 edges), and salicylic acid (517 edges) anchor the exercise-rewired network — all known markers of xenobiotic metabolism and inflammation. (d) Null validation: five permutation-of-z runs produce zero discoveries; the observed 119,683 edges reflect genuine signal (real/null ratio > 200,000×). Data: Contrepois et al. (2020), 33 subjects, 5 timepoints (0–60 min post-exercise), 2,099 transcripts + 260 proteins + 728 metabolites, 2,263,092 cross-omic pairs. Global test p = 0.015.


Before and after

Without tempoNet With tempoNet
Estimate separate networks per timepoint with glasso or JGL Single dml_edge_test() call tests all cross-omic edges simultaneously
No formal edge-level p-values — threshold partial correlations by eye Exact permutation p-values for each edge, with FWER and FDR control
Linear contrast only, missing non-monotone responses Multi-contrast + omnibus catches linear, acute, step, and arbitrary patterns
Normal or t-approximation with N=30 clusters → 32% type I inflation z-permutation: 0% inflation, exact for any N
5–8 packages (glasso, stabs, igraph, JGL, coglasso, ...) library(tempoNet) → 3 lines to results

Statistical framework

Problem formulation

Let X{it} ∈ ℝ^p denote multi-omic measurements for subject i = 1, ..., N at condition t = 1, ..., T_i, with exposure covariate z{it}. Features are partitioned into K omic blocks of sizes p_1, ..., p_K. Let Ω(z) = Σ(z)^{−1} be the z-conditional precision matrix. For each cross-omic pair (j, k) with j in block a and k in block b ≠ a, we test:

H₀: Ω_{jk}(z) does not depend on z

against the general alternative that the partial correlation between features j and k varies with the exposure.

Step 0: Within-subject centering and marginal Gaussianization

Remove subject-level fixed effects by centering each feature within subjects (Mundlak 1978). Apply the nonparanormal transform (Liu et al. 2009) to achieve marginal Gaussianity without parametric assumptions. Optionally residualize against known time-varying covariates W_{it}.

Step 1: Cross-fitted nodewise lasso (nuisance removal)

For each feature j, regress X_j on all other features X_{−j} via lasso, using K-fold cross-fitting by subject to obtain honest out-of-fold residuals R̂_j. Block-calibrated penalty factors assign lower penalty to cross-omic predictors (controlled by λ_ratio), following the collaborative regression principle (Gross & Tibshirani 2015).

The covariate z is deliberately excluded from these regressions. This follows the DML partially linear model principle (Chernozhukov et al. 2018): Step 1 removes confounding from other molecular features, while Step 2 detects z-dependence. Including z in Step 1 would absorb the signal that Step 2 aims to detect.

Step 2: Doubly robust augmented score with z-permutation

Score construction. For each cross-omic pair (j, k), contrast function c(·), and subject i, the augmented per-subject score is:

S_i^(c) = (1/T_i) Σ_t [ R̂_{jt} · R̂_{kt} − μ̂_t ] · c(z_{it})

where μ̂_t = n_t^{−1} Σ_{i'} R̂_{i'jt} · R̂_{i'kt} is the timepoint-specific group mean of the residual product.

The subtraction of μ̂_t provides double robustness by removing between-timepoint level effects that could arise from nodewise regression bias. For balanced panel designs where every subject is observed at every timepoint, the within-subject z-permutation already absorbs between-timepoint level differences, making augmentation unnecessary (set augmented = FALSE, the default). For unbalanced designs with missing timepoints, augmentation with leave-one-out group means prevents confounding. The score connects to the Expected Conditional Covariance (ECC) framework (Shah & Peters 2020) and doubly robust conditional independence testing (Niu et al. 2024).

Test statistic. The cluster-robust t-ratio is:

T_c = S̄_c / SE(S̄_c)

where SE uses the sandwich variance estimator, valid under arbitrary within-subject dependence (Cameron et al. 2008).

Multi-contrast system. Three directed contrasts (linear, acute peak, and step-change) capture common exposure-response patterns. An orthonormal basis spanning the full (T−1)-dimensional contrast space provides an omnibus statistic T_omni = ‖T‖₂ that detects arbitrary z-dependence. The combined statistic is:

T* = max( max_c |T_c|, T_omni / √(T−1) )

This achieves near-optimal power against both sparse alternatives (one dominant contrast) and dense alternatives (diffuse z-dependence across all timepoints), following the detection boundary theory of Donoho & Jin (2004).

z-Permutation inference. Because z is excluded from Step 1, the residuals R̂ are fixed under any permutation of z within subjects. This structural invariance enables exact conditional permutation testing:

For b = 1, ..., B: Permute z within each subject → z^(b) Recompute T*^(b) using R̂ (fixed) and z^(b) (Augmentation terms μ̂_t are recomputed for each permutation)

The edge-specific p-value p_{jk} = (1 + #{b : T*^(b) ≥ T*^obs}) / (B+1) is exactly uniformly distributed under H₀, conditional on R̂. This holds regardless of the number of subjects, the accuracy of the nodewise regression, or the distributional form of the data.

Validity after screening. The two-stage procedure (full scan → targeted permutation on candidates with |T*| > τ) preserves conditional validity. Since R̂ is fixed under permutation, the screening set A = {(j,k) : T*{jk}(z_obs, R̂) > τ} is measurable with respect to (R̂, z_obs). Under H₀ for any edge (j,k) ∈ A, the sequence (T*{jk}(z_obs, R̂), T*_{jk}(z^(1), R̂), ...) is exchangeable conditional on R̂, so the permutation p-value remains valid regardless of the selection rule (cf. Berrett et al. 2020).

Multiple testing. Westfall-Young step-down provides exact strong FWER control. BH applied to edge-specific permutation p-values controls FDR.

Effect sizes and confidence intervals. For each edge and contrast, the point estimate θ̂_c = S̄_c quantifies the change in partial correlation per unit contrast, with cluster-robust standard error. Permutation-calibrated confidence intervals are obtained from the null distribution quantiles.


Quick start

library(tempoNet)

# Step 0: centering + Gaussianization
X_c <- center_within_subject(X, cluster = subject_id)$X_centered
X_g <- nonparanormal_transform(X_c)

# Step 1: cross-fitted nodewise residuals (z excluded)
step1 <- crossfit_nodewise_residuals(
    X_g, z = exposure, cluster = subject_id,
    block_sizes = c(n_transcripts, n_proteins, n_metabolites)
)

# Step 2: doubly robust z-permutation test
result <- dml_edge_test(
    step1$residuals, z = exposure, cluster = subject_id,
    block_sizes = c(n_transcripts, n_proteins, n_metabolites),
    augmented = TRUE, omnibus = TRUE, B = 10000
)

# Inspect results
result$global$p_value          # global test
sig <- result$edges[result$edges$sig_FDR, ]  # FDR-significant edges

Functions

Preprocessing

Function Description
center_within_subject() Remove subject-level fixed effects
nonparanormal_transform() Rank-based marginal Gaussianization
assemble_blocks() Combine omic matrices into BlockOmicData

DML inference (core)

Function Description
crossfit_nodewise_residuals() Block-calibrated cross-fitted lasso, z excluded
dml_edge_test() Doubly robust z-permutation multi-contrast test
clustered_edge_test() Single-contrast asymptotic test (cluster-robust)

Network estimation

Function Description
estimate_network() Block-calibrated glasso + stability selection
estimate_temporal() Networks at multiple time points
test_diff_edges() Two-group permutation / Fisher's Z test

Visualization

Function Description
plot_network() Cross-omic network with block colouring
plot_temporal() Temporal edge dynamics panel

Simulation

Function Description
simulate_temporal_network() Ground-truth data for benchmarking

Installation

# install.packages("remotes")
remotes::install_github("CuiweiG/tempoNet")

References

  • Chernozhukov V, Chetverikov D, Demirer M, Duflo E, Hansen C, Newey W, Robins J (2018). Double/debiased machine learning for treatment and structural parameters. Econom J 21:C1–C68. doi:10.1111/ectj.12097

  • Shah RD, Peters J (2020). The hardness of conditional independence testing and the generalised covariance measure. Ann Statist 48:1514–1538. doi:10.1214/19-AOS1857

  • Niu Z, Chakraborty A, Dukes O, Katsevich E (2024). Reconciling model-X and doubly robust approaches to conditional independence testing. Ann Statist 52:895–921. doi:10.1214/24-AOS2372

  • McClean A, Branson Z, Kennedy EH (2025). Double cross-fit doubly robust estimators: beyond series regression. arXiv 2403.15175.

  • Berrett TB, Wang Y, Barber RF, Samworth RJ (2020). The conditional permutation test for independence while controlling for confounders. J R Stat Soc B 82:175–197. doi:10.1111/rssb.12340

  • Cameron AC, Gelbach JB, Miller DL (2008). Bootstrap-based improvements for inference with clustered errors. Rev Econ Stat 90:414–427. doi:10.1162/rest.90.3.414

  • Meinshausen N, Bühlmann P (2006). High-dimensional graphs and variable selection with the lasso. Ann Statist 34:1436–1462. doi:10.1214/009053606000000281

  • Liu H, Lafferty J, Wasserman L (2009). The nonparanormal: semiparametric estimation of high dimensional undirected graphs. J Mach Learn Res 10:2295–2328.

  • Westfall PH, Young SS (1993). Resampling-Based Multiple Testing. Wiley.

  • Donoho D, Jin J (2004). Higher criticism for detecting sparse heterogeneous mixtures. Ann Statist 32:962–994. doi:10.1214/009053604000000265

  • Albanese A, Kohlen W, Behrouzi P (2024). Collaborative graphical lasso. arXiv 2403.18602.

  • Contrepois K et al. (2020). Molecular choreography of acute exercise. Cell 181:1112–1130. doi:10.1016/j.cell.2020.06.005

  • MoTrPAC Consortium (2024). Temporal dynamics of the multi-omic response to endurance exercise training. Nature 629:174–183. doi:10.1038/s41586-023-06877-w


License

MIT

About

Temporal network analysis for single-cell and spatial omics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages