dmr_genome_plot: dmr_genome_plot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/dmr_genome_plot.R

Description

Produces a dotplot of a specific (region of) CpG(s) given a matrix of beta-values superposed onto the RefSeq genomic location.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
dmr_genome_plot(
  name,
  chr,
  betas,
  annotation.gr,
  factor_interest,
  start_dmr,
  end_dmr,
  flanks,
  SNP = F,
  dmps = F,
  genome_version = "hg19",
  biomart = NULL,
  diff_symbol = T,
  dotsize = 0.7,
  plotgrid = T,
  confint = T,
  highlight = T,
  col_DMR = NULL
)

Arguments

name

Name of the DMR/DMP

chr

Chromosome (example "chr6")

betas

Matrix of Beta with the CpG numbers as rownames

annotation.gr

GenomicRanges object containing the annotation/features of the GMset (obtained through minfi::getAnnotation())

factor_interest

A vector based on which you want to stratify your plot

start_dmr

The start of the region you want to plot

end_dmr

The end of the region you want to plot. If the region is only 1 bp, simply enter the same value as the start_dmr

flanks

How large should the flanking region be? Defaults to the same size as the DMR.

SNP

Do you want SNP information sourced from UCSC? Defaults to FALSE, because calling UCSC is slow.

dmps

Do you want to indicate them individually? Defaults to FALSE

genome_version

Which genome build to use? Defaults to "hg19"

biomart

A biomart object. If NULL (default), the gene coordinates will be obtained from RefSeq.

diff_symbol

Do you want the different groups to be represented by different symbols (TRUE)? Defaults to FALSE

dotsize

The pixel size for plotting symbols. Defaults to 0.7 (standard of Gviz)

plotgrid

Do you want to plot a grid (TRUE)? Defaults to TRUE

confint

Do you want to plot the 95% confidence intervals (TRUE)? Defaults to TRUE

highlight

Do you want to highlight the region of interest (TRUE)? Defaults to TRUE

col_DMR

A color vector used for plotting the DMRs. Must be the same size as the levels of factor_interest. Defaults to NULL (which is automatic color assignment)

Value

A dotplot of a specific (region of) CpG(s) of beta-values superposed onto the RefSeq genome. Additionally, it returns a genomic ranges object with the CpGs within the chosen region.

Author(s)

Andrew Y.F. Li Yim

See Also

minfi

minfiData

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
#Load data
require(minfiData)
baseDir <- system.file("extdata", package = "minfiData")
targets <- read.metharray.sheet(base = baseDir)
RGset <- read.metharray.exp(targets = targets, recursive = T)
Mset <- preprocessIllumina(rgSet = RGset, bg.correct = T, normalize = "controls", reference = 2)
Rset <- ratioConvert(Mset)
GMset <- mapToGenome(Rset)

Beta <- getBeta(GMset)
annotation.gr <- makeGRangesFromDataFrame(getAnnotation(GMset), keep.extra.columns = T, start.field = "pos", end.field = "pos")

#Find DMRs
design <- model.matrix(~pData(Mset)$Sample_Group)
bumps <- bumphunter(object = GMset, design = design, coef = 2, cutoff = 0.2, B = 0, type = "Beta")
dmr <- bumps$table[1,]

#Plot DMP
dmr_genomeplot(name = "DMR_1", chr = "chr6", betas = Beta, factor_interest = pData(Mset)$Sample_Group, annotation.gr = annotation.gr, start_dmr = dmr$start, end_dmr = dmr$start)

#Plot DMR (without SNPs)
dmr_genomeplot(name = "DMR_1", chr = "chr6", betas = Beta, factor_interest = pData(Mset)$Sample_Group, annotation.gr = annotation.gr, start_dmr = dmr$start, end_dmr = dmr$end)

#Plot DMR (with SNPs)
dmr_genome_plot(name = "DMR_1", chr = "chr6", betas = Beta, factor_interest = pData(Mset)$Sample_Group, annotation.gr = annotation.gr, start_dmr = dmr$start, end_dmr = dmr$end, SNP = T) 

ND91/ndlib documentation built on Aug. 10, 2020, 11:59 a.m.