Learn R Programming

⚠️There's a newer version (0.2.4) of this package.Take me there.

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

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

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,
  subjData = 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')

Monthly Downloads

310

Version

0.2.3

License

GPL (>= 2)

Maintainer

Woody Miao

Last Published

August 20th, 2025

Functions in GRAB (0.2.3)

SAGELD.NullModel

Fit a SAGELD Null Model
GRAB.SimubVec

GRAB: simulate random effect (i.e. bVec) based on family structure
GRAB.WtCoxG

WtCoxG method in GRAB package
SPAGRM.NullModel

Fit a SPAGRM Null Model
GRAB.SimuGMat

Simulate an R matrix of genotype data
GRAB.SPAmix

SPAmix method in GRAB package
GRAB.SimuPheno

Simulate phenotype using linear predictor eta
GRAB.SimuGMatFromGenoFile

GRAB: simulate genotype matrix based on family structure
makeGroup

A lower function to make groups based on phenotype
GRAB.makePlink

Make PLINK files using a numeric R matrix
GRAB.getGenoInfo

Get allele frequency and missing rate information from genotype data
setDenseGRM

Set up a dense GRM (only for developers)
getVersionFromBGEN

Get version information from BGEN file
handleFormula

handle a formula (used in GRAB.NullModel function)
getSparseGRM

Make a SparseGRMFile for GRAB.NullModel.
getTempFilesFullGRM

Make temporary files to be passed to function getSparseGRM.
checkIfSampleIDsExist

Check if sample identifiers are stored in a BGEN file
TestforBatchEffect

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

Suppose that a dense GRM is Phi and input is bVec, return Phi * bVec (only for developers)
getSampleIDsFromBGEN

Get sample identifiers from BGEN file
Batcheffect.Test

Test for batch effect
GRAB.SAGELD

SAGELD method in GRAB package
GRAB.SPACox

SPACox method in GRAB package
GRAB.NullModel

Fit a null model to estimate parameters and residuals
CCT

An analytical p-value combination method using the Cauchy distribution
GRAB.SPAGRM

SPAGRM method in GRAB package
GRAB.Marker

Conduct marker-level genetic association testing
GRAB.POLMM

POLMM method in GRAB package
GRAB.Region

Conduct region-level genetic association testing
GRAB.ReadGeno

Read in genotype data