meltPeak {TransView} | R Documentation

## Convenience function which returns a data frame with normalized peak densities suitable for plotting with ggplot2

### Description

Returns a data frame with labels and normalized densities of the provided DensityContainer

### Usage

    meltPeak(..., region, control=FALSE, peak_windows = 0, bin_method="mean", rpm=TRUE, smooth=0)

### Arguments

`...` | DensityContainer objects
`region` | Can be one entry of the annotated output of annotatePeaks or a GRanges object with one entry and with a transcript_id and distance metadata column.
`control` | An optional vector of DensityContainer objects, that have to match the order of experiments passed as a first argument. E.g. `plotTV(ex1.ChIP,ex2.ChIP,control=c(ex1.Input,ex2.Input)`. The content will be treated as background densities and subtracted from the matching experiment.
`peak_windows` | If set to an integer greater than 0, all binding profiles will be interpolated into this amount of windows by the method specified by `bin_method`.
`bin_method` | Specifies the function used to summarize the bins specified by nbins. Possible methods are ‘max’, ‘mean’, ‘median’ or ‘approx’ for linear interpolation.
`rpm` | If set to `TRUE`, all sample groups will be normalized to Reads Per Million mapped reads after quality filtering according to the filtered_reads slot of the DensityContainer. Should not be set in truncated density maps!
`smooth` | If greater than 0, smooth defines the smoother span as described in the function `lowess`. This function will be applied to reads or RPM values, depending on `rpm` and the results will be stored in the column ‘Smooth’.

### Details

Convenience function which returns a data frame with one row per BP or, if `peak_window` greater than zero, per `peak_window`. The label will be taken from the `ex_name` slot of the DensityContainer. The slot should be set to meaningful names before using this function. All read densities will be normalized to the total map mass and if a control is provided also background subtracted.

### Value

`data.frame` with 3 columns: ‘NormalizedReads’, ‘Label’ and ‘Position’. Optionally a column ‘Smooth’ will be appended.

### Author(s)

Julius Muller ju-mu@alumni.ethz.ch

### Examples

    exbam<-dir(system.file("extdata", package="TransView"),full=TRUE,patt="bam$")
    exls<-dir(system.file("extdata", package="TransView"),full=TRUE,patt="xls$")
    exgtf<-dir(system.file("extdata", package="TransView"),full=TRUE,patt="gtf.gz$")[2]
    fn.macs<-dir(system.file("extdata", package="TransView"),full=TRUE,patt="xls$")

    exden.ctrl<-parseReads(exbam[1],verbose=0)
    exden.chip<-parseReads(exbam[2],verbose=0)

    peaks<-macs2gr(exls,psize=500)

    GTF<-gtf2gr(exgtf)
    peaks<-macs2gr(fn.macs,psize=500)
    peaks.anno<-annotatePeaks(peaks=peaks,gtf=GTF)

    peak1.df<-meltPeak(exden.chip,region=peaks.anno["Peak.1"],bin_method="mean",peak_windows=100,rpm=TRUE)
    head(peak1.df)

[Package TransView version 1.30.0 Index]