ShowOnePeak: Visulization of a single peak along the genome.

View source: R/ShowOnePeak.R

ShowOnePeakR Documentation

Visulization of a single peak along the genome.

Description

This function plots the estimated methylation level (as bars) of each bin within a peak for each replicate, and the corresponding normalized input read depth (grey curve).

Usage

ShowOnePeak(onePeak, allBins, binCounts,
            isDMR = FALSE,Sname = NULL,
            ext = 500, ylim = c(0, 1))

Arguments

onePeak

A one-row dataframe containing the genomic position of a single peak: chr, start, end, strand.

allBins

A dataframe contaning genomic position of all bins used to call peaks: chr, start, end, strand.

binCounts

A dataframe contaning the read counts of all bins for each replicate. The sample order is: input1, ip1, input2, ip2, ...

isDMR

A logical value indicating whether the input region is DMR. Default is FALSE.

Sname

Sample names. If isDMR = TRUE, then it will be used as the title of each plot.

ext

An integer indicating the length of base paris to extend the region on both sides: (start - ext, end + ext). Default is 500.

ylim

The range of y-axis to plot. Default is c(0, 1)

Value

It only generates a plot. No specific output.

See Also

ShowOneDMR from "DSS" package.

Examples

### read peaks
peaks = read.table(file.path(system.file(package = "TRESS"),
                             "extdata/examplebyBam_peaks.xls"),
                   sep = "\t", header = TRUE)
### load annotation and bin counts
load(file.path(system.file(package = "TRESS"),
               "extdata/examplebyBam.rda"))
 allBins = as.data.frame(bins$bins)
 colnames(allBins)[1] = "chr"
 allBins$strand = binStrand
 for (i in 1:4) {
   ShowOnePeak(
   onePeak = peaks[i,],
   allBins = allBins, binCounts = allCounts
   )
 }

ZhenxingGuo0015/TRESS documentation built on April 14, 2023, 4:21 p.m.