lkhrWrapper: Perform glm test for all gene probes

Description Usage Arguments Details Value Author(s) Examples

View source: R/glmWrapper.R

Description

Perform glm test for all gene probes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
lkhrWrapper(es, 
           formulaReduced = FEV1 ~ xi + gender,
           formulaFull =    FEV1 ~ xi + age + gender,
           family = gaussian, 
           logit = FALSE, 
           pvalAdjMethod = "fdr", 
           alpha = 0.05, 
           probeID.var = "ProbeID", 
           gene.var = "Symbol", 
           chr.var = "Chromosome", 
           applier = lapply,
           verbose = TRUE) 

Arguments

es

An LumiBatch object. fData(es) should contains information about probe ID, chromosome number and gene symbol.

formulaReduced

An object of class formula. Formula for reduced model. The left handside of ~ is the response variable. Gene probe must be represented by the variable xi. For example, xi~gender (gene probe is the response variable); Or FEV1~xi+gender (gene probe is the predictor).

formulaFull

An object of class formula. Formula for Full model. The left handside of ~ is the response variable. Gene probe must be represented by the variable xi. For example, xi~age+gender (gene probe is the response variable); Or FEV1~xi+age+gender (gene probe is the predictor).

family

By default is gaussian. refer to glm.

logit

logical. Indicate if the gene probes will be logit transformed. For example, for DNA methylation data, one might want to logit transformation for the beta-value (methylated/(methylated+unmethylated)).

pvalAdjMethod

One of p-value adjustment methods provided by the R function p.adjust in R package stats: “holm”, “hochberg”, “hommel”, “bonferroni”, “BH”, “BY”, “fdr”, “none”.

alpha

Significance level. A test is claimed to be significant if the adjusted p-value < alpha.

probeID.var

character string. Name of the variable indicating probe ID in feature data set.

gene.var

character string. Name of the variable indicating gene symbol in feature data set.

chr.var

character string. Name of the variable indicating chromosome number in feature data set.

applier

By default, it is lapply. If the library multicore is available, can use mclapply to replace lappy.

verbose

logical. Determine if intermediate output need to be suppressed. By default verbose=TRUE, intermediate output will be printed.

Details

This function applies R functions lrtest in R package lmtest and glm for each gene probe.

Value

A list with the following elements:

frame

A data frame containing test results sorted according to the ascending order of unadjusted p-values for the covariate of the interest. The data frame contains 8 columns: probeIDs, geneSymbols (gene symbols of the genes where the probes come from), chr (numbers of chromosomes where the probes locate), Chisq (chi square test statistic), Df (degree of freedom of the chisquare test statistic), pval (p-values of the tests for the covariate of the interest), p.adj (adjusted p-values), pos (row numbers of the probes in the expression data matrix). The rows are ordered based on the descending order of chisquare test statistic.

frame.unsorted

A data frame containing test results. unordered frame.

Author(s)

Weiliang Qiu <stwxq@channing.harvard.edu>, Brandon Guo <brandowonder@gmail.com>, Christopher Anderson <christopheranderson84@gmail.com>, Barbara Klanderman <BKLANDERMAN@partners.org>, Vincent Carey <stvjc@channing.harvard.edu>, Benjamin Raby <rebar@channing.harvard.edu>

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
    # generate simulated data set from conditional normal distribution
    set.seed(1234567)
    es.sim = genSimData.BayesNormal(nCpGs = 100, 
      nCases = 20, nControls = 20,
      mu.n = -2, mu.c = 2,
      d0 = 20, s02 = 0.64, s02.c = 1.5, testPara = "var",
      outlierFlag = FALSE, 
      eps = 1.0e-3, applier = lapply) 
    print(es.sim)

set.seed(1234567)
es.sim$age = rnorm(ncol(es.sim), mean=50, sd=5)
res.lkh = lkhrWrapper(
  es = es.sim, 
  formulaReduced = xi ~ memSubj,
  formulaFull =    xi ~ memSubj + age,
  family = gaussian(), 
  logit = FALSE, 
  pvalAdjMethod = "fdr", 
  alpha = 0.05, 
  probeID.var = "probe", 
  gene.var = "gene", 
  chr.var = "chr", 
  applier = lapply,
  verbose = TRUE) 

iCheck documentation built on Nov. 8, 2020, 11:09 p.m.