gene.plot: Plot methylation pattern in genomic region

Description Usage Arguments Details Value See Also Examples

View source: R/gene.plot.R

Description

gene.plot returns a plot of β-values for a particular genomic region and optionally according to a grouping variable for the samples

Usage

1
2
gene.plot(fSub, betas, pheno, groupVar = NULL, gene.fld = "GeneSymbol",
  cpg.fld = "cpgSite", pos.fld = "pos", chr.fld = "chr")

Arguments

fSub

A data.frame of CpG site 450K annotation.

betas

A matrix of beta-values containing all CpG sites contained in fSub.

pheno

A data.frame of phenotypes with rows in same order as columns of betas.

groupVar

(optional) Character value corresponding to a column of pheno, indicating grouping variable with which to color points in the plot.

gene.fld, cpg.fld, pos.fld, chr.fld

Character values for names of fSub denoting, respectively: gene symbol/gene name, CpG identifier, genomic position (b.p.) and chromosome.

Details

To add: gene names and genomic locations (e.g. 5'UTR, Body, etc.) This function should be called by gg.DMR.plot()

Value

A ggplot object for the plot of interest

See Also

gg.DMR.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
f <- data.frame(GeneSymbol = c(rep('', 2), rep('BLAH', 3), rep('', 1)),
                cpgSite = paste0('cg0000', 1:6),
                pos = 17500000 + c(1, 147, 1458, 1500, 2157, 2699),
                chr = 'chr19')

p <- data.frame(ID = paste0('S', 1:10), Group = rep(LETTERS[1:2], each = 5))
set.seed(123)
means <- c(2.5, 2, 3, 3, 0, -1, 0, -1.2, 0.2, -1, 0.5, -0.5)
SD <- c(0.5, 0.5, 0.7, 0.8, 1, 0.5)
mvals <- matrix(rnorm(60, rep(means, each = 5), rep(SD, each = 10)), ncol = 6,
            dimnames = list(p$ID, f$cpgSite))
b <- t(2^mvals/(1+2^mvals))
gene.plot(fSub = f, betas = b, pheno = p, groupVar = 'Group')

nickfishbane/DMRtools documentation built on May 23, 2019, 4:47 p.m.