Learn R Programming

iCheck (version 1.2.0)

lmFitWrapper: A wrapper function for the function 'lmFit' of the R Bioconductor package 'limma'

Description

A wrapper function for the function 'lmFit' of the R Bioconductor package 'limma'.

Usage

lmFitWrapper( es, formula = ~as.factor(gender), pos.var.interest = 1, pvalAdjMethod = "fdr", alpha = 0.05, probeID.var = "ProbeID", gene.var = "Symbol", chr.var = "Chromosome", verbose = TRUE)

Arguments

es
An LumiBatch object. fData(es) should contains information about chromosome number and gene symbol.
formula
An object of class formula. No left handside of ~ should be specified since the response variable will be the expression level.
pos.var.interest
integer. Indicates which covariate on the right-hand-side of ~ in formula is the covariate of the interest. By default, it is the first covariate pos.var.interest=1.
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.
verbose
logical. Determine if intermediate output need to be suppressed. By default verbose=TRUE, intermediate output will be printed.

Value

A list with the following elements:
n.sig
Number of significant tests after p-value adjustment.
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 7 columns: probeIDs, geneSymbols (gene symbols of the genes where the probes come from), chr (numbers of chromosomes where the probes locate), stats (moderated t-statistics for the covariate of interest, i.e. the first covariate), \ codepval (p-values of the tests for the covariate of interest, i.e. the first covariate), p.adj (adjusted p-values), pos (row numbers of the probes in the expression data matrix).
statMat
A matrix containing test statistics for all covariates and for all probes. Rows are probes and columns are covariates. The rows are ordered according to the ascending order of unadjusted p-values for the covariate of the interest.
pvalMat
A matrix containing pvalues for all covariates and for all probes. Rows are probes and columns are covariates. The rows are ordered according to the ascending order of unadjusted p-values for the covariate of the interest.
pval.quantile
Quantiles (minimum, 25 for all covariates including intercept provided in the input argument formula.
frame.unsorted
A data frame containing test results. The data frame contains 7 columns: probeIDs, geneSymbols (gene symbols of the genes where the probes come from), chr (numbers of chromosomes where the probes locate), stats (moderated t-statistics for the covariate of the interest), 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).
statMat.unsorted
A matrix containing test statistics for all covariates and for all probes. Rows are probes and columns are covariates.
pvalMat.unsorted
A matrix containing pvalues for all covariates and for all probes. Rows are probes and columns are covariates.
memGenes
A numeric vector indicating the cluster membership of probes (unsorted). memGenes[i]=1 if the $i$-th probe is significant (adjusted pvalue $<$ alpha) with positive moderated t-statistic; memGenes[i]=2 if the $i$-th probe is nonsignificant ; memGenes[i]=3 if the $i$-th probe is significant with negative moderated t-statistic;
memGenes2
A numeric vector indicating the cluster membership of probes (unsorted). memGenes2[i]=1 if the $i$-th probe is significant (adjusted pvalue $<$ alpha). memGenes2[i]=0 if the $i$-th probe is nonsignificant.
mu1
Mean expression levels for arrays for probe cluster 1 (average taking across all probes with memGenes value equal to 1.
mu2
Mean expression levels for arrays for probe cluster 2 (average taking across all probes with memGenes value equal to 2.
mu3
Mean expression levels for arrays for probe cluster 3 (average taking across all probes with memGenes value equal to 3.
ebFit
object returned by R Bioconductor function eBayes.

Details

This is a wrapper function of R Bioconductor functions lmFit and eBayes to make it easier to input design and output list of significant results.

Examples

Run this code
    # 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)

   
res.limma = lmFitWrapper(
  es = es.sim, 
  formula = ~as.factor(memSubj), 
  pos.var.interest = 1,
  pvalAdjMethod = "fdr", 
  alpha = 0.05, 
  probeID.var = "probe", 
  gene.var = "gene", 
  chr.var = "chr", 
  verbose = TRUE)

Run the code above in your browser using DataLab