CpGsInfoOneRegion: Test Associations Between a Region and Phenotype

View source: R/CpGsInfoOneRegion.R

CpGsInfoOneRegionR Documentation

Test Associations Between a Region and Phenotype

Description

Test associations of individual CpGs in a genomic region with a continuous phenotype

Usage

CpGsInfoOneRegion(
  regionName_char,
  region_gr = NULL,
  betas_df,
  pheno_df,
  contPheno_char,
  covariates_char = NULL,
  genome = c("hg19", "hg38"),
  arrayType = c("450k", "EPIC"),
  manifest_gr = NULL
)

Arguments

regionName_char

character string of location information for a genomic region, specified in the format of "chrxx:xxxxxx-xxxxxx"

region_gr

An object of class GRanges with location information for one region. If this argument is NULL, then the region in regionName_char is used.

betas_df

data frame of beta values with row names = CpG IDs, column names = sample IDs

pheno_df

a data frame with phenotype and covariate variables, with variable "Sample" for sample IDs.

contPheno_char

character string of the continuous phenotype to be tested against methylation values

covariates_char

character vector of covariate variables names

genome

human genome of reference hg19 (default) or hg38

arrayType

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

manifest_gr

A GRanges object with the genome manifest (as returned by ExperimentHub or by ImportSesameData). This function by default ignores this argument in favour of the genome and arrayType arguments.

Details

This function implements linear models that test association between methylation values in a genomic region with a continuous phenotype. Note that methylation M values are used as regression outcomes in these models. The model for each CpG is:

methylation M value ~ contPheno_char + covariates_char

Value

a data frame with location of the genomic region (Region), CpG ID (cpg), chromosome (chr), position (pos), results for testing association of methylation in individual CpGs with continuous phenotype (slopeEstimate, slopePval) and annotations for the region.

Examples

   data(betasChr22_df)
   data(pheno_df)
   myRegion_gr <- RegionsToRanges("chr22:18267969-18268249")

   CpGsInfoOneRegion(
     region_gr = myRegion_gr,
     betas_df = betasChr22_df,
     pheno_df = pheno_df,
     contPheno_char = "stage",
     covariates_char = c("age.brain", "sex"),
     arrayType = "450k"
   )


TransBioInfoLab/coMethDMR documentation built on Oct. 15, 2024, 12:52 a.m.