GWAS: Performs Single Marker Regressions Using BGData Objects

Description Usage Arguments Value See Also Examples

View source: R/GWAS.R

Description

Implements single marker regressions. The regression model includes all the covariates specified in the right-hand-side of the formula plus one column of the genotypes at a time. The data from the association tests is obtained from a BGData object.

Usage

1
2
3
GWAS(formula, data, method = "lsfit", i = seq_len(nrow(geno(data))),
  j = seq_len(ncol(geno(data))), chunkSize = 5000L,
  nCores = getOption("mc.cores", 2L), verbose = FALSE, ...)

Arguments

formula

The formula for the GWAS model without including the marker, e.g. y ~ 1 or y ~ factor(sex) + age. The variables included in the formula must be in the sample information of the BGData.

data

A BGData object.

method

The regression method to be used. Currently, the following methods are implemented: rayOLS, lsfit, lm, lm.fit, glm, lmer, and SKAT. Defaults to lsfit.

i

Indicates which rows of the genotypes should be used. Can be integer, boolean, or character. By default, all rows are used.

j

Indicates which columns of the genotypes should be used. Can be integer, boolean, or character. By default, all columns are used.

chunkSize

The number of columns of the genotypes that are brought into physical memory for processing per core. If NULL, all elements in j are used. Defaults to 5000.

nCores

The number of cores (passed to mclapply). Defaults to the number of cores as detected by detectCores.

verbose

Whether progress updates will be posted. Defaults to FALSE.

...

Additional arguments for chunkedApply and regression method.

Value

The same matrix that would be returned by coef(summary(model)).

See Also

file-backed-matrices for more information on file-backed matrices. multi-level-parallelism for more information on multi-level parallelism. BGData-class for more information on the BGData class. lsfit, lm, lm.fit, glm, lmer, and SKAT for more information on regression methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Restrict number of cores to 1 on Windows
if (.Platform$OS.type == "windows") {
    options(mc.cores = 1)
}

# Load example data
bg <- BGData:::loadExample()

# Perform a single marker regression
res1 <- GWAS(formula = FT10 ~ 1, data = bg)

# Draw a Manhattan plot
plot(-log10(res1[, 4]))

# Use lm instead of lsfit (the default)
res2 <- GWAS(formula = FT10 ~ 1, data = bg, method = "lm")

# Use glm instead of lsfit (the default)
y <- pheno(bg)$FT10
pheno(bg)$FT10.01 <- y > quantile(y, 0.8, na.rm = TRUE)
res3 <- GWAS(formula = FT10.01 ~ 1, data = bg, method = "glm")

# Perform a single marker regression on the first 50 markers (useful for
# distributed computing)
res4 <- GWAS(formula = FT10 ~ 1, data = bg, j = 1:50)

Example output

Loading required package: BEDMatrix
Loading required package: LinkedMatrix
Loading required package: symDMatrix
Loading chromosomes as .bed files...
Extracting phenotypes from .fam file, assuming that the .fam file of the first BEDMatrix instance is representative of all the other nodes...
Extracting map from .bim files...
Merging alternate phenotype file...

BGData documentation built on Aug. 3, 2020, 1:07 a.m.