| Title: | 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. |
| Authors: | Ryan Moreno [aut, cre], Yuchang Wu [aut] |
| Maintainer: | Ryan Moreno <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-11-27 23:58:12 UTC |
| Source: | https://github.com/cran/sardine |
Print a SARDINE result
## S3 method for class 'sardine_result' print(x, ...)## S3 method for class 'sardine_result' print(x, ...)
x |
An object of class |
... |
Passed to |
x, invisibly.
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.
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 )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 )
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. |
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.
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:
EWAS model used, e.g. "Phenotype ~ Clock (Cox)".
Parameter being estimated, e.g. "log_HR".
Point estimate for the parameter.
Estimated standard error for the point estimate.
Z statistic (estimate / SE). All rows share the z of the linear
gamma test; for gamma_logistic the SE comes from the delta method,
so z != coef / SE for that row.
Two-sided normal p-value for the estimate, testing the null hypothesis that the effect is 0.
-log10(p), computed directly from z so it stays finite
when very small p-values underflow to 0.
EWAS sample size: the N argument if supplied, otherwise the
median per-CpG N across the CpGs used.
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:
Version of SARDINE that produced the result.
Number of CpGs in the EWAS, clock, and DNAm reference respectively.
Number of CpGs overlapping between each pair of inputs.
Number of CpGs in all three inputs; these are the CpGs actually used for the association analysis.
Fraction of the clock's CpGs that ended up in the final set of CpGs used.
1 - ClockCpG_coverage_ratio.
Proportion of cases at the end of the study, either input
directly or computed as cox_E / median(N). NA if the EWAS model is
not 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. NA if the EWAS model is not Cox.
Variance of the phenotype (after any capping), either input directly or estimated from the EWAS summary statistics and the DNAm reference matrix.
"user_provided" or "inferred".
(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. NA if the
clock has no correlation with the phenotype.
Note about whether varY had to be capped at the
theoretical maximum, or NA if no capping was needed.
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.
for a Logistic model, ewas_direction must be "Y~M", ewas_model must be "logistic",
and ewas_pheno_type must be "binary".
# 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")# 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")