Type: Package
Title: Run GWAS/GWEIS Scans Using Binary Dosage Files
Version: 3.0.0
Description: Tools to run genome-wide association study (GWAS) and genome-wide by environment interaction study (GWEIS) scans using the genetic data stored in a binary dosage file. The user provides a data frame with the subject's covariate data and the information about the binary dosage file returned by the BinaryDosage::getbdinfo() routine.
Suggests: testthat (≥ 2.1.0), knitr, rmarkdown
VignetteBuilder: knitr
License: GPL-3
Encoding: UTF-8
Language: en-US
RoxygenNote: 7.3.3
Depends: R (≥ 3.5.0)
Imports: lsReg, BinaryDosage
NeedsCompilation: no
Packaged: 2026-04-30 21:54:02 UTC; jmorr
Author: John Morrison [aut, cre], W. James Gauderman [aut], NCI [fnd] (CA196559), NCI [fnd] (CA201407), NIEHS [fnd] (ES007048), NHLBI [fnd] (HL115606)
Maintainer: John Morrison <jmorr@usc.edu>
Repository: CRAN
Date/Publication: 2026-05-01 16:40:12 UTC

Routine to allocate memory needed to perform a GWEIS.

Description

Routine to allocate memory needed to perform a GWEIS.

Usage

gweis.mem(gemdl, subids, tests, gomdl = NULL)

Arguments

gemdl

The results from glm for the gene-environment model. This model contains the outcome and all covariates of interest with the last covariate listed in the model being the covaraiate that the gene interaction is being tested for.

subids

A character vector of subject IDs that line up with the data that was used in the models that are passed to this routine

tests

The list of tests to perform. These can be any combination of the following values "bg_go", "bg_ge", "bg_gxe", "bgxe", "joint", "bg_eg", "bg_case", "bg_ctrl"

gomdl

The results from glm for the gene-only model. This model contains the outcome and all the covariates except the covariate that the gene interaction is being tested for. Required (non-NULL) when "bg_go" is included in tests; ignored otherwise.

Value

List containing allocated memory to perform the specified GWEIS. This value is passed to the rungweis routine. Returns 1 if any value in tests is not a recognised test name.

Examples

## Not run: 
bdinfo <- BinaryDosage::getbdinfo(system.file("extdata", "gendata.bdose",
                                              package = "GxEScanR"))
subdata <- readRDS(system.file("extdata", "subdata.rds", package = "GxEScanR"))
subdata <- subdata[complete.cases(subdata), ]
subdata <- subdata[subdata$subid %in% bdinfo$samples$sid, ]

linearmodel <- glm(y_linear ~ x2 + x1, data = subdata)
linearmem <- gweis.mem(gemdl = linearmodel,
                       subids = subdata$subid,
                       tests = c("bg_ge", "bg_gxe", "bgxe", "joint"))

## End(Not run)

Routine to run a GWEIS

Description

Routine to run a GWEIS

Usage

rungweis(gweismem, bdinfo, snps, outfilename, maf = 0.01)

Arguments

gweismem

Models and memory allocated by gweis-mem to run the GWEIS.

bdinfo

Information about a Binary Dosage file that contains the genetic data to run the GWEIS

snps

List of SNPs in the Binary Dosage file to perform the GWEIS on.

outfilename

Name of the file to contain the output

maf

Minimum minor allele frequency of SNPs needed to run test on.

Value

Called for its side effect of writing tab-delimited results to outfilename. Returns NULL invisibly.

Examples

## Not run: 
bdinfo <- BinaryDosage::getbdinfo(system.file("extdata", "gendata.bdose",
                                              package = "GxEScanR"))
subdata <- readRDS(system.file("extdata", "subdata.rds", package = "GxEScanR"))
subdata <- subdata[complete.cases(subdata), ]
subdata <- subdata[subdata$subid %in% bdinfo$samples$sid, ]

linearmodel <- glm(y_linear ~ x2 + x1, data = subdata)
linearmem <- gweis.mem(gemdl = linearmodel,
                       subids = subdata$subid,
                       tests = c("bg_ge", "bgxe", "joint"))
outfile <- tempfile(fileext = ".txt")
rungweis(gweismem = linearmem, bdinfo = bdinfo,
         snps = 1:nrow(bdinfo$snps), outfilename = outfile)

## End(Not run)