plot_peak {FunChIP} | R Documentation

## Plotting the peaks.

### Description

It plots the peaks both as counts and splines (if provided). Peaks are centered around their summit. If the clustering has been performed, peaks can be aligned and divided in cluster, shown in different panels.

### Usage

    ## S4 method for signature 'GRanges'
    plot_peak(object, index = 1:length(object),
    line.plot = "spline", col = NULL,
    shift = NULL, k = NULL, cluster.peak = FALSE, rescale = FALSE,
    lwd= 2, cex.axis = 1,  cex.lab = 1, cex.main = 1)

### Arguments

`object` | GRanges object of length N. It must contain the metadata column `counts`. If it contains the metadata column `summit_spline`, peaks are plotted centered around their summits (i.e. the 0 of the abscissa is fixed as the summit of the peak). If summit is not provided peaks are not centered.
`index` | vector. Indices of the peaks to be plotted. Default is `1:length(object)` to plot all the peaks.
`line.plot` | string. Type of plot. If `'spline'` (default), the spline approximation of the peaks is plotted. If `'counts'`, only the raw data are plotted. If `'both'`, both the raw data and the approximation spline are plotted.
`col` | vector. Colors used to plot the peaks. If `NULL`, the rainbow color palette is used. If it has a single value, all the peaks are plotted with the same color. If it is a vector shorter than N, only the first element of `col` is used. Default is `NULL`.
`shift` | logical. This parameter controls the abscissae of the plotted peaks, and plays two different roles, depending on the `cluster.peak` parameter. \ If `cluster.peak` is `FALSE`, `shift = TRUE` means that peaks are plotted aligned around the `summit_spline` point. The GRanges object must contain the results of the summit_peak method. If `cluster.peak` is `FALSE` and `shift = FALSE`, peaks are plotted with no centering around the summit. If `cluster.peak` is `FALSE` and `shift = NULL` (default), peaks are centered, if the metadata column `summit_spline` is present in `object`, otherwise they are plotted with the original abscissae, with no centering around the summit. \ If `cluster.peak = TRUE`, the parameter `shift` sets the clustering result to be plotted. If `TRUE` the `shift` results are plotted, otherwise the results associated to `NOshift` clustering are presented.
`k` | integer. If `cluster.peak = TRUE`, results corresponding to `k` number of clusters are plotted. It must be set to a value included in the `n.clust` parameter of the correspondent `object`.
`cluster.peak` | logical. It `FALSE`, `object` contains the set of peaks to be plotted without classification (centered or not around the summit). If `TRUE`, the `plot_peak` method plots the result of the classification associated to `shift` and `k` parameters; in this case, `object` must be the output of the cluster_peak and must contain the correspondent classification. Default is `FALSE`.
`rescale` | logical. If `TRUE` the scaled peaks are plotted. Default is `FALSE`. If `rescale = TRUE` only spline approximations can be shown, then `line.plot` must be `'spline'`.
`lwd, cex.axis, cex.lab, cex.main` | Optional graphical parameters.

### Value

Graphical method to graphically represent data. No output returned,

### Author(s)

Alice Parodi, Marco J. Morelli, Laura M. Sangalli, Piercesare Secchi, Simone Vantini

### Examples

    # load the data
    data(peaks)

    # First example:
    # plot of the spline approximation
    # of the first 10 peaks
    # centered around their summit

    plot_peak(peaks.data.summit, index = 1:10,
              shift = TRUE)

    # Second example:
    # plot of the peaks
    # divided in the k=3
    # and shift = TRUE clusters
    # obtained with the cluster_peak method
    plot_peak(peaks.data.cluster,
    shift = TRUE, k = 3, cluster.peak = TRUE)

[Package FunChIP version 1.13.0 Index]