Learn R Programming

GRAB (version 0.2.4)

GRAB.SPAGRM: Instruction of SPAGRM method

Description

SPAGRM is a scalable and accurate framework for retrospective association tests. It treats genetic loci as random vectors and uses a precise approximation of their joint distribution. This approach enables SPAGRM to handle any type of complex trait, including longitudinal and unbalanced phenotypes. SPAGRM extends SPACox to support sample relatedness.

Usage

GRAB.SPAGRM()

Arguments

Details

See SPAGRM.NullModel for detailed instructions on preparing a SPAGRM_NULL_Model object required for GRAB.Marker().

Additional Control Parameters for GRAB.Marker():

  • zeta (numeric, default: 0): SPA moment approximation parameter.

  • tol (numeric, default: 1e-5): Numerical tolerance for SPA convergence.

Marker-level results (OutputFile) columns:

Marker

Marker identifier (rsID or CHR:POS:REF:ALT).

Info

Marker information in format CHR:POS:REF:ALT.

AltFreq

Alternative allele frequency in the sample.

AltCounts

Total count of alternative alleles.

MissingRate

Proportion of missing genotypes.

zScore

Z-score from the score test.

Pvalue

P-value from the score test.

hwepval

Hardy-Weinberg equilibrium p-value.

References

Xu et al. (2025). SPAGRM: effectively controlling for sample relatedness in large-scale genome-wide association studies of longitudinal traits. tools:::Rd_expr_doi("10.1038/s41467-025-56669-1")

Examples

Run this code
ResidMatFile <- system.file("extdata", "ResidMat.txt", package = "GRAB")
SparseGRMFile <- system.file("extdata", "SparseGRM.txt", package = "GRAB")
PairwiseIBDFile <- system.file("extdata", "PairwiseIBD.txt", package = "GRAB")
GenoFile <- system.file("extdata", "simuPLINK.bed", package = "GRAB")
OutputFile <- file.path(tempdir(), "resultSPAGRM.txt")

# Step 2a: pre-calculate genotype distributions
obj.SPAGRM <- SPAGRM.NullModel(
  ResidMatFile = ResidMatFile,
  SparseGRMFile = SparseGRMFile,
  PairwiseIBDFile = PairwiseIBDFile,
  control = list(ControlOutlier = FALSE)
)

# Step 2b: perform association tests
GRAB.Marker(obj.SPAGRM, GenoFile, OutputFile)

head(data.table::fread(OutputFile))

Run the code above in your browser using DataLab