| RAS-package | R Documentation |
The RAS package implements the Regional Association Score method for
genome-wide association studies. It converts per-SNP effect sizes into a
genomic -\log_{10}(p) time series and applies changepoint detection
to locate peaks that mark significant association regions. The method
supports both continuous and binary traits.
ras runs the complete pipeline and returns a "ras"
object; use plot.ras to visualise results.
result <- ras(geno, phenotype, covariates,
covariate_cols = c("age", "sex", paste0("pc", 1:10)),
is_continuous = TRUE,
chrom = 1, save_dir = "results/")
print(result) # detected changepoint positions
plot(result) # full-chromosome scan profile
plot(result, zoom = TRUE) # zoomed view around each changepoint
ras_scan \to ras_detect \to
ras_validate \to plot.ras
## Step 1: compute averaged -log10(p) profile
scan <- ras_scan(geno, phenotype, covariates,
covariate_cols = c("age", "sex", paste0("pc", 1:10)),
is_continuous = TRUE, chrom = 1, save_dir = "results/")
## Step 2: first-pass changepoint detection
detected <- ras_detect(scan$x, scan$y,
window_size = 3000,
slope.p.values.threshold.left = 1e-10,
slope.p.values.threshold.right = 1e-20)
## Step 3: second-pass validation
final <- ras_validate(detected, x = scan$x, y = scan$y,
this.skip = 10, p.value.threshold = 1e-10)
## Step 4: plot
result <- structure(
list(scan = scan, detection = final, chrom = 1, save_dir = "results/"),
class = "ras")
plot(result)
plot(result, zoom = TRUE)
ras_scan performs num_rep independent 50/50
train/hold-out splits. In each repetition it fits per-SNP regressions on
the training half (compute_gwas_weights), builds a weighted
dosage matrix for the hold-out half (compute_pgs_matrix),
and runs a forward scan (screen_forward_max_region) that
slides an expanding window and records the minimum p-value at each
grid position. The -\log_{10}(p) vectors are averaged across
repetitions. For continuous traits, covariates are residualised from the
training phenotype each repetition (no hold-out leakage); for binary
traits, logistic regression is used in the scan step.
ras_detect slides a window of width cp_window_size
across the profile. At each position get_break_points fits
a segmented linear model and applies the Davies test. A candidate is
retained only when three conditions all hold: Davies p <
cp_p_threshold, left-side slope significantly positive
(slope_test, p < cp_slope_left), and
right-side slope significantly negative (p < cp_slope_right).
Each accepted candidate is snapped to the nearest local peak via
get_local_maximum.
ras_validate re-tests each first-pass candidate with local
Davies tests on both sides within a window of half-width
second_window_size. A candidate is accepted if either side passes
p < second_p_threshold. Candidates with
-\log_{10}(p) \le min_signal at the estimated position are
discarded regardless.
plot.ras with zoom = FALSE produces two files: the
RAS scan profile with detected changepoints highlighted, and a dual-axis
overlay with Davies test significance at every candidate.
plot.ras with zoom = TRUE produces a multi-panel
figure with one zoomed panel per changepoint.
Jiahe Jin jiahe.jin@yale.edu (maintainer), Yiran Jiang yiran.jiang@uky.edu, Heping Zhang heping.zhang@yale.edu
compute_gwas_weights
compute_pgs_matrix
get_break_points
get_local_maximum
plot.ras
print.ras
ras
ras_detect
ras_memory
ras_scan
ras_validate
release_memory
screen_forward_max_region
slope_test
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.