Learn R Programming

GRAB

GRAB is an R package that provides a comprehensive suite of GWAS methods for biobank-scale data. For detailed instructions, see the GRAB manual page.

Version 0.1.2 (the last version before v0.2.0 and prior to June 2025) is archived in branch release/v0.1.2.

Installation

GRAB is an R package, with part of its code written in C++ for improved performance. GRAB can be installed on Linux, Windows, or macOS via CRAN, Conda, or from source code.

Install via CRAN

Install GRAB from CRAN in your R console:

install.packages("GRAB", dependencies = TRUE)

Install via Conda

Install GRAB in a new Conda environment named grab_env from the conda-forge channel:

conda create -n grab_env -c conda-forge r-grab r-skat r-dbplyr r-tidyr r-r.utils

Quick tutorial

Here is a quick tutorial for GWAS of a time-to-event trait using SPAmix.

Step 1: fit a null model

library(GRAB)
PhenoFile <- system.file("extdata", "simuPHENO.txt", package = "GRAB")
PhenoData <- data.table::fread(PhenoFile, header = TRUE)

obj.SPAmix <- GRAB.NullModel(
  survival::Surv(SurvTime, SurvEvent) ~ AGE + GENDER + PC1 + PC2,
  data = PhenoData,
  subjIDcol = "IID",
  method = "SPAmix",
  traitType = "time-to-event",
  control = list(PC_columns = "PC1,PC2")
)

Step 2: conduct score test

GenoFile <- system.file("extdata", "simuPLINK.bed", package = "GRAB")
OutputFile <- file.path(tempdir(), "Results_SPAmix.txt")

GRAB.Marker(obj.SPAmix, GenoFile = GenoFile, OutputFile = OutputFile)
data.table::fread(OutputFile)

Copy Link

Version

Install

install.packages('GRAB')

Version

0.2.4

License

GPL (>= 2)

Maintainer

Woody Miao

Last Published

December 5th, 2025

Functions in GRAB (0.2.4)

GRAB.SPAmix

Instruction of SPAmix method
SAGELD.NullModel

Construct SAGELD/GALLOP null model from a mixed-effects fit
GRAB.SimubVec

Simulate random effects based on family structure
GRAB.getGenoInfo

Get allele frequency and missing rate information from genotype data
GRAB.WtCoxG

Instruction of WtCoxG method
GRAB.SimuPheno

Simulate phenotypes from linear predictors
SPAGRM.NullModel

Fit SPAGRM null model from residuals and relatedness inputs
GRAB.makePlink

Convert genotype matrix to PLINK format files
GRAB.SimuGMatFromGenoFile

Simulate genotype matrix from external genotype file
GRAB.SimuGMat

Simulate genotype data matrix for related and unrelated subjects
TestforBatchEffect

Quality control to check batch effect between study cohort and reference population.
getSparseGRM

Make a SparseGRMFile for GRAB.NullModel.
getTempFilesFullGRM

Make temporary files to be passed to function getSparseGRM.
fitNullModel.POLMM

Fit POLMM null model for ordinal outcomes
fitNullModel.WtCoxG

Fit weighted Cox null model with outlier handling and batch-effect QC
fitNullModel.SPACox

Fit SPACox null model from survival outcomes or residuals
fitNullModel.SPAmix

Fit a SPAmix null model from a survival response (Surv) with covariates or from precomputed residuals. Principal components (PCs) named in control$PC_columns are extracted; residual outliers are detected using an IQR rule with adjustable multiplier and stored for SPA testing.
getPairwiseIBD

Calculate Pairwise IBD (Identity By Descent)
GRAB.NullModel

Top-level API for generating a null model object used by GRAB.Marker and GRAB.Region
GRAB.SAGELD

SAGELD method in GRAB package
GRAB.SPACox

Instruction of SPACox method
GRAB.SPAGRM

Instruction of SPAGRM method
GRAB.Region

Perform region-based association tests
GRAB.ReadGeno

Read genotype data from multiple file formats
GRAB.POLMM

Instruction of POLMM method
CCT

Cauchy Combination Test for p-value aggregation
GRAB.Marker

Perform single-marker association tests using a fitted null model
GRAB.POLMM.Region

Instruction of POLMM-GENE method