Learn R Programming

MethylSeekR (version 1.12.0)

plotPMDSegmentation: Plotting the PMD Segmentation

Description

This function generates a figure showing the PMD segmentation in a randomly chosen region.

Usage

plotPMDSegmentation(m, segs, numRegions = 1, pdfFilename=NULL, minCover = 5)

Arguments

m
GRanges object containing the methylation data.
segs
GRanges object containing the PMD segmentation. Return value of the segmentPMDs function (see example).
numRegions
The number of randomly chosen regions to be plotted. The default (1) can only be changed if a pdfFilename is provided (see below).
pdfFilename
Name of the pdf file in which the figure is saved. If no name is provided (default), the figure is printed to the screen.
minCover
Only CpGs with a coverage of at least minCover reads will be used for plotting.

Value

No return value. The function creates a figure showing the inferred segmentation for a randomly chosen region. The figure is either printed to the screen (default) or saved as a pdf if a filename is provided. If a filename (pdfFilename) is provided, several regions (set via the numRegions argument) can be plotted and saved in a multi-page pdf file. The randomly chosen region that is displayed is broken up into 6 panels and in each panel, the raw (ie unsmoothed) methylation levels of all CpGs with a minimal coverage of 5 reads are shown. PMDs are indicated as green bars, extending over the entire PMD.

Examples

Run this code

library(MethylSeekR)

# get chromosome lengths
library("BSgenome.Hsapiens.UCSC.hg18")
sLengths=seqlengths(Hsapiens)

# read methylation data
methFname <- system.file("extdata", "Lister2009_imr90_hg18_chr22.tab",
package="MethylSeekR")
meth.gr <- readMethylome(FileName=methFname, seqLengths=sLengths)

#segment PMDs
PMDsegments.gr <- segmentPMDs(m=meth.gr, chr.sel="chr22", seqLengths=sLengths)

#plot PMD segmentation examples
plotPMDSegmentation(m=meth.gr, segs=PMDsegments.gr, numRegions=1)


Run the code above in your browser using DataLab