| Title: | Epigenetic Clock and Phenotype Associations from EWAS Summary Statistics |
| Version: | 0.1.0 |
| Description: | Estimates the association between an epigenetic clock and a phenotype using only summary statistics from an epigenome-wide association study (EWAS), the clock's CpG weights, and a reference DNA methylation covariance matrix. No individual-level data is required. Handles linear, logistic and Cox proportional hazards EWAS models, either regression direction, and beta-value or M-value methylation scales. |
| License: | GPL (≥ 3) |
| URL: | https://github.com/qlu-lab/SARDINE |
| BugReports: | https://github.com/qlu-lab/SARDINE/issues |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.0.0) |
| Imports: | data.table, R.utils, stats, utils |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.1.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-11-07 00:54:21 UTC; Ryan |
| Author: | Ryan Moreno [aut, cre], Yuchang Wu [aut] |
| Maintainer: | Ryan Moreno <rrmoreno@wisc.edu> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-27 18:20:02 UTC |
sardine: Epigenetic Clock and Phenotype Associations from EWAS Summary Statistics
Description
Estimates the association between an epigenetic clock and a phenotype using only summary statistics from an epigenome-wide association study (EWAS), the clock's CpG weights, and a reference DNA methylation covariance matrix. No individual-level data is required. Handles linear, logistic and Cox proportional hazards EWAS models, either regression direction, and beta-value or M-value methylation scales.
Author(s)
Maintainer: Ryan Moreno rrmoreno@wisc.edu
Authors:
Ryan Moreno rrmoreno@wisc.edu
Yuchang Wu ywu423@wisc.edu
See Also
Useful links:
Print a SARDINE result
Description
Print a SARDINE result
Usage
## S3 method for class 'sardine_result'
print(x, ...)
Arguments
x |
An object of class |
... |
Passed to |
Value
x, invisibly.
Summary-statistics-based association between epigenetic clock and phenotype
Description
Estimates the association between an epigenetic clock and a phenotype using only EWAS summary statistics, the clock's CpG weights, and a reference DNA methylation covariance matrix. No individual-level data is required.
Usage
sardine(
ewas_sumstats,
ewas_direction = c("M~Y", "Y~M"),
ewas_model = c("linear", "logistic", "cox"),
ewas_DNAm_scale = c("beta", "m"),
ewas_pheno_type = c("continuous", "binary"),
clock,
DNAm_cov_matrix,
mean_beta = NULL,
varY = NULL,
scale = FALSE,
age_adult = 20,
N = NULL,
cox_pi = NULL,
cox_E = NULL,
verbose = TRUE
)
Arguments
ewas_sumstats |
EWAS summary statistics: can be a dir/to/file or a data.table, data.frame; must contain columns CpG, BETA, SE, and N. |
ewas_direction |
Direction of the association (outcome ~ exposure) in
the EWAS model: |
ewas_model |
EWAS regression model: |
ewas_DNAm_scale |
Scale of the EWAS DNA methylation data: |
ewas_pheno_type |
EWAS phenotype type: For all four options above, matching ignores case and whitespace
(e.g. |
clock |
Epigenetic clock weights: can be a dir/to/clock/file or a data.frame/data.table; must contain columns CpG, CoefficientTraining. |
DNAm_cov_matrix |
Variance-covariance matrix for DNAm. Must have the same covariate adjustments as the ewas summary stats. Can be a dir/to/file of a delimited table (e.g. TSV) whose first column holds the CpG IDs and whose header lists the same CpG IDs in the same order; a dir/to/file.rds containing a matrix; a matrix with CpG rownames and colnames; a data.frame of numeric columns with CpG rownames; or a data.frame/data.table laid out like the delimited file. |
mean_beta |
Optional. dir/to/file containing mean DNAm beta-value at each CpG
site (expected to be in beta-scale). Needed for M-value to beta-value conversion.
A data.frame or data.table with 2 columns: CpGmarker, beta_bar. Best if computed
from the same samples as the EWAS itself. Default: |
varY |
Variance of the phenotype used in EWAS: raw phenotype if no
covariates; residualized phenotype if adjusted for covariates in the EWAS
model. Default: |
scale |
Logical. For Horvath or PedBE clocks, we can scale the point estimate and SE; doesn't affect Pvalue. |
age_adult |
Only used if |
N |
Optional. EWAS total sample size. Default is to read this from the EWAS summary statistics. |
cox_pi |
Only used when |
cox_E |
Only used when |
verbose |
True/False. Whether to print progress and diagnostic messages. |
Details
Two coefficients are always returned: lambda, from the regression of
the clock on the phenotype, and gamma, from the regression of the
phenotype on the clock. Binary phenotypes additionally yield
gamma_logistic, a log-odds ratio. Cox-model inputs additionally
yield log_HR, a clock-level log hazard ratio. All rows share the same Z
statistic and p-value by construction.
See https://github.com/qlu-lab/SARDINE/blob/main/inputs.md for details on every input.
Value
An object of class sardine_result: a data.frame with one row per
estimated parameter (lambda and gamma always; gamma_logistic for binary
phenotypes; log_HR for Cox EWAS) and columns:
- model
EWAS model used, e.g.
"Phenotype ~ Clock (Cox)".- param
Parameter being estimated, e.g.
"log_HR".- coef
Point estimate for the parameter.
- SE
Estimated standard error for the point estimate.
- z
Z statistic (estimate / SE). All rows share the z of the linear
gammatest; forgamma_logisticthe SE comes from the delta method, soz != coef / SEfor that row.- p
Two-sided normal p-value for the estimate, testing the null hypothesis that the effect is 0.
- neglog10p
-log10(p), computed directly from
zso it stays finite when very small p-values underflow to 0.- N
EWAS sample size: the
Nargument if supplied, otherwise the median per-CpG N across the CpGs used.- note
Notes about the specific settings for this row (e.g. log-odds vs log_HR), or
NA.
Retrieve the metadata with attr(result, "metadata"): a one-row
data.frame with columns:
- sardine_version
Version of SARDINE that produced the result.
- N_CpGs_ewas, N_CpGs_clock, N_CpGs_DNAmRef
Number of CpGs in the EWAS, clock, and DNAm reference respectively.
- N_CpGs_ewas_clock, N_CpGs_ewas_ref, N_CpGs_clock_ref
Number of CpGs overlapping between each pair of inputs.
- N_CpGs_final
Number of CpGs in all three inputs; these are the CpGs actually used for the association analysis.
- ClockCpG_coverage_ratio
Fraction of the clock's CpGs that ended up in the final set of CpGs used.
- ClockCpG_missed_ratio
1 -
ClockCpG_coverage_ratio.- cox_pi
Proportion of cases at the end of the study, either input directly or computed as
cox_E / median(N).NAif the EWAS model is not Cox.- kappa_cox
Cox conversion factor
(1 - cox_pi) * -log(1 - cox_pi)used to convert between the linear-scale gamma and the Cox log hazard ratio.NAif the EWAS model is not Cox.- varY
Variance of the phenotype (after any capping), either input directly or estimated from the EWAS summary statistics and the DNAm reference matrix.
- varY_type
"user_provided"or"inferred".- varY_ratio
(varY prior to capping) / (theoretical maximum varY), where the maximum is the varY you'd get if the clock explained all of the phenotype's variance. Values above 1 trigger capping.
NAif the clock has no correlation with the phenotype.- varY_note
Note about whether varY had to be capped at the theoretical maximum, or
NAif no capping was needed.
Cox models
For a Cox Proportional Hazards model, ewas_direction must be "Y~M", ewas_model must
be "cox", ewas_pheno_type must be "binary", and N should represent the
total sample size at the end of the study. Exactly one of cox_pi and cox_E must be provided.
cox_pi = cox_E/N is the proportion of cases at the end of the study. It is recommended that varY
is inferred rather than provided as user-supplied so that the log_hr estimate is invariant to cox_pi.
Logistic models
for a Logistic model, ewas_direction must be "Y~M", ewas_model must be "logistic",
and ewas_pheno_type must be "binary".
Examples
# Small synthetic inputs bundled with the package
inputs <- system.file("extdata", "fixtures", "inputs", package = "sardine")
result <- sardine(
ewas_sumstats = file.path(inputs, "ewas_sumstats_baseline_synthetic.tsv"),
clock = file.path(inputs, "clock_weights_baseline_synthetic.tsv"),
DNAm_cov_matrix = file.path(inputs, "sigma_baseline_synthetic.tsv"),
verbose = FALSE
)
result
attr(result, "metadata")