Package 0.99.0 · engine v1.6 · frame layer v1.8. The engine described in the methods paper, packaged, with a frame layer that declares the designs of behavioral epigenetics on top of it.
library(tewas)
## the registered scan on a 450k / EPIC array (beta: probes x samples with CpG rownames)
res <- tewas_v16(beta, y, X, chr = man$chr, pos = man$pos, mask = sesame_general_mask)
res$counts # probes in scan, tested, re-admitted, ruler size, units, rejections (v1.6 / no-prior / BH)
res$ruler # alive-ruler raw p < .05 rate, Efron sigma0, pi0 - the calibration report of the scan
res$lens # gain, guard tripped?, applied gain
res$diagnostic$branch # bar / partial / lit / mild - is the inflation removable structure? (report-only)
## a declared design: moderation and functional form, methylation as the outcome, regions with their genes
fr <- tewas_frame(beta, y, X, chr, pos, frame_role = "outcome", moderation = TRUE, mod = adversity, type = "non-linear",
labels = list(y = "Attachment anxiety", mod = "Childhood adversity"))
files <- tewas_report(fr, "out_run1") # tables, trajectory figures, summary.md; genes through cpgdirection when installed
## the same calls on a SummarizedExperiment / GenomicRatioSet (beta from the assay, chr / pos from rowRanges, y / X from colData)
res <- tewas_v16(grset, "phenotype", c("age", "sex"), mask = sesame_general_mask)
tewas_granges(fr, "dmrs", "moderation") # regions, units or probes of any arm as a GRangesWhat the engine does, in the order of the registered kits: QC (autosomal cg probes, ≤ 5 % missing, β-IQR ≥ 0.05; anchor probes
re-admitted below the rule; positive controls tested), M-values, rank–inverse-normal transform of a continuous outcome, per-probe OLS
statistics, run units (500 / 2,000 bp), four unit statistics (dense, coherence-gated flip, Simes, kernel matched filter) calibrated on
one permutation stream with an exponential tail below the floor, the Cauchy combination, weighted BH over units with cross-fitted
structural weights and the knowledge prior tempered by the lens (tone, darkness) and switched off by the inflation guard, level-local
descent to probes. Every calibration quantity is reported; nothing is corrected.
What the frame layer adds: every design is one focal regressor after a nuisance design (Frisch–Waugh–Lovell), run through the same
engine and the same residual-permutation stream: a linear arm (the registered scan, asserted identical by test), a moderation arm
(optionally three-way), quadratic and threshold departure arms, an opt-in exponential arm, a moderated-curvature arm, and a shape
omnibus with the Sasabuchi test and the Fieller interval for U-shape claims. Selected units that overlap are merged into regions with
coordinates, the probes and their target genes within (cpgdirection::cpg_gene_pairs()), trajectory figures, and a summary.md that
declares the run: its calibration first, then the regions, then the standing of every arm as measured by the registered null report
NR2 (the moderation, quadratic, threshold and moderated-curvature arms held their null bands; the exponential arm did not and prints
that reading beside any result).
R/engine2.R |
the engine (v1.6); prior = NULL → the no-prior selection; guard = NULL → the pre-guard engine |
R/pipeline.R |
tewas_v16(), tewas_scan_stats(), tewas_run_units(), tewas_anchor_table(), tewas_ruler_stats(), tewas_removability(), tewas_inverse_normal(), tewas_panel() |
R/frame.R, R/report.R, R/report_traj.R, R/genes.R |
tewas_frame(), tewas_focal_stats(), tewas_report(), tewas_genes() |
R/simulate.R |
tewas_simulate(): a small synthetic array with planted loci for the examples and the vignette |
R/bioc.R |
SummarizedExperiment / GenomicRatioSet input for both entry points; tewas_granges() |
R/calibset.R, R/roles.R, R/engine.R |
the lens (empirical null, tone, darkness, gain), the role table, the frozen v1.1.1 reference engine and the flip-arm amplitudes (internal) |
inst/extdata/anchor_panel_R11_v3.csv.gz |
the R11 anchor panel (families A / B / C, null ruler N, positives P); sha256 5ba2d6b6… |
inst/extdata/ruler_alive_v4.csv.gz |
the alive null ruler, panel v4 (1,439 probes); sha256 5dd5e283… |
tests/ |
the engine invariants and the frame / report / gene / standing invariants (plain R, run by R CMD check) |
vignettes/tewas.Rmd |
the walk-through |
Both panels are per-probe summaries derived from the Alpha cohort; no participant-level methylation or phenotype is in the package. The registered record behind the paper (the registrations with their amendments, every kit, every result and table, and the 1.4.0 to 1.6.2 tarballs the registered runs used) is deposited on Zenodo: https://doi.org/10.5281/zenodo.22761521.
# Bioconductor (once accepted)
BiocManager::install("tewas")
# GitHub
remotes::install_github("teindor/tewas")
# gene annotation (optional)
remotes::install_github("teindor/cpgdirection")Ein-Dor, T. (2026). tewas: unit-level multiple testing for epigenome-wide association studies with an anchor-calibrated knowledge prior. R package version 0.99.0. https://github.com/teindor/tewas. https://doi.org/10.5281/zenodo.22761398 (all versions; this version 10.5281/zenodo.22761399).
MIT © 2026 Tsachi Ein-Dor (teindor@runi.ac.il, ORCID 0000-0002-3078-7591)