lmmTest: Fit mixed model to methylation values in one genomic region

Description Usage Arguments Details Value Examples

View source: R/lmmTest.R

Description

Fit mixed model to methylation values in one genomic region

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
lmmTest(
  betaOne_df,
  pheno_df,
  contPheno_char,
  covariates_char,
  modelType = c("randCoef", "simple"),
  genome = c("hg19", "hg38"),
  arrayType = c("450k", "EPIC"),
  outLogFile = NULL
)

Arguments

betaOne_df

matrix of beta values for one genomic region, with row names = CpG IDs, column names = sample IDs

pheno_df

a data frame with phenotype and covariates, with variable Sample indicating sample IDs.

contPheno_char

character string of the main effect (a continuous phenotype) to be tested for association with methylation values in the region

covariates_char

character vector for names of the covariate variables

modelType

type of mixed model, can be randCoef for random coefficient mixed model, or simple for simple linear mixed model.

genome

Human genome of reference hg19 or hg38

arrayType

Type of array, can be "450k" or "EPIC"

outLogFile

Name of log file for messages of mixed model analysis

Details

This function implements a mixed model to test association between methylation values in a genomic region with a continuous phenotype.

When randCoef is selected, the model is

methylation M value ~ contPheno_char + covariates_char + (1|Sample) + (contPheno_char|CpG). The last term specifies random intercept and slope for each CpG.

When simple is selected, the model is

methylation M value ~ contPheno_char + covariates_char + (1|Sample)

In our simulation studies, we found both models are conservative, so p-values are estimated from normal distributions instead of t-distributions.

Value

A dataframe with one row for association result of one region: Estimate, StdErr, and pvalue for the association of methylation values in the genomic region tested vs. continuous phenotype contPheno_char

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  data(betasChr22_df)

  CpGsChr22_char <- c(
    "cg02953382", "cg12419862", "cg24565820", "cg04234412", "cg04824771",
    "cg09033563", "cg10150615", "cg18538332", "cg20007245", "cg23131131",
    "cg25703541"
  )

  coMethCpGs <- CoMethSingleRegion(CpGsChr22_char, betasChr22_df)

  # test only the first co-methylated region
  coMethBeta_df <- betasChr22_df[coMethCpGs$CpGsSubregions[[1]], ]

  data(pheno_df)

  res <- lmmTest(
    betaOne_df = coMethBeta_df,
    pheno_df,
    contPheno_char = "stage",
    covariates_char = c("age.brain", "sex"),
    modelType = "randCoef",
    arrayType = "450k"
  )

lissettegomez/coMethDMR documentation built on April 25, 2021, 1:10 p.m.