Skip to content

cran/RAS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAS: Regional Association Score for GWAS

The RAS package implements the Regional Association Score method for genome-wide association studies. It converts per-SNP effect sizes into a genomic −log₁₀(p) time series and applies changepoint detection to locate peaks that mark significant association regions. The method supports both continuous and binary traits.

If you use this package in your research, please cite:

Y. Jiang & H. Zhang, Empowering genome-wide association studies via a visualizable test based on the regional association score, Proc. Natl. Acad. Sci. U.S.A. 122(9) e2419721122 (2025). https://doi.org/10.1073/pnas.2419721122


Installation

Method 1 — From GitHub via remotes (recommended)

remotes is a lightweight alternative to devtools with no extra dependencies.

# install remotes if you don't have it
install.packages("remotes")

remotes::install_github("hepingzhangyale/RAS")

Method 2 — From GitHub via devtools

# install devtools if you don't have it
install.packages("devtools")

devtools::install_github("hepingzhangyale/RAS")

Method 3 — Clone and install from source

Use this when you need a specific branch, want to inspect the code before installing, or are working on a machine without direct GitHub access.

# 1. clone the repository
git clone https://github.com/hepingzhangyale/RAS.git

# 2. install from local source (run inside R)
devtools::install("path/to/RAS")   # replace with your local clone path
# e.g. devtools::install("C:/Users/you/RAS")

Windows note: source installation requires Rtools to be installed. Download the version matching your R installation and make sure it is on the PATH.

Method 4 — Windows binary zip (no compiler required)

Download the pre-built .zip from the Releases page, then install locally:

install.packages(
  "RAS_0.1.12.zip",         # path to the downloaded zip
  repos = NULL,
  type  = "win.binary"
)

Dependencies

RAS imports two packages that are installed automatically:

Package Role
segmented Segmented regression and Davies test for changepoint detection
parallel CPU core detection used by ras_memory() diagnostics

If automatic installation fails, install them manually first:

install.packages(c("segmented", "parallel"))

Quick start

library(RAS)

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

Binary traits: fast score test

For binary (case/control) traits, the per-window scan defaults to a logistic regression (scan_test = "glm"). On large samples this Wald path is the main cost. Passing scan_test = "score" uses a Rao score test that fits the covariate-only null model once and evaluates each window in closed form — substantially faster with essentially the same detected regions:

result <- ras(
  geno, phenotype, covariates,
  covariate_cols = c("age", "sex", paste0("pc", 1:10)),
  is_continuous  = FALSE,
  scan_test      = "score",   # fast Rao score test for the binary scan
  chrom          = 1,
  save_dir       = "results/"
)

Step-by-step (advanced)

# 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)

Documentation

?RAS          # package overview and full pipeline description
?ras          # main one-call entry point
?ras_scan     # Stage 1: scan
?ras_detect   # Stage 2: first-pass changepoint detection
?ras_validate # Stage 3: second-pass validation
?plot.ras     # plotting
?ras_memory   # memory and CPU diagnostics

Citation

If you use RAS in your research, please cite:

Y. Jiang & H. Zhang, Empowering genome-wide association studies via a visualizable test based on the regional association score, Proc. Natl. Acad. Sci. U.S.A. 122(9) e2419721122 (2025). https://doi.org/10.1073/pnas.2419721122

Authors

About

❗ This is a read-only mirror of the CRAN R package repository. RAS — Regional Association Score for Genome-Wide Association Studies. Homepage: https://github.com/hepingzhangyale/RAS Report bugs for this package: https://github.com/hepingzhangyale/RAS/issues

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages