plotAnnot {CAGEr} | R Documentation

## Plot annotation statistics

### Description

Plot maping statistics of an object containing mapping statistics in counts as percentages in stacked barplots.

### Usage

    plotAnnot(x, scope, title, group = "default", facet = NULL, normalise = TRUE)

    ## S4 method for signature 'data.frame'
    plotAnnot(x, scope, title, group = "default", facet = NULL, normalise = TRUE)

    ## S4 method for signature 'DataFrame'
    plotAnnot(x, scope, title, group = "default", facet = NULL, normalise = TRUE)

    ## S4 method for signature 'CAGEexp'
    plotAnnot(x, scope, title, group = "default", facet = NULL, normalise = TRUE)

### Arguments

`x` | An object from which can be extracted a table with columns named `promoter`, `exon`, `intron`, `mapped`, `extracted`, `rdna`, and `tagdust`, that will be passed to the `mapStats` function.
`scope` | The name of a “scope”, that defines which data is plotted and how it is normalised, or a function implementing that scope. See `mapStatsScopes()` for details on each scope.
`title` | The title of the plot.
`group` | A factor to group the samples, or the name of a `colData` column of a `CAGEexp` object, or a formula giving the names of columns to be pasted together.
`facet` | A factor or the name of a `colData` column of a `CAGEexp` object, to facet the samples in the sense of `ggplot2`'s facet_wrap function.
`normalise` | Whether to normalise or not. Default: TRUE.

### Details

Stacked barplots with error bars inspired from http://stackoverflow.com/questions/10417003/stacked-barplot-with-errorbars-using-ggplot2. See http://www.biomedcentral.com/1471-2164/14/665/figure/F1 for example.

### Value

Returns invisibly a `ggplot2` object of class `c("gg", "ggplot")`.

### Author(s)

Charles Plessy

### See Also

`mapStats()` for a list of scopes.

Other CAGEr annotation functions: `annotateCTSS()`, `ranges2annot()`, `ranges2genes()`, `ranges2names()`

Other CAGEr plot functions: `hanabiPlot()`, `plotCorrelation()`, `plotExpressionProfiles()`, `plotInterquantileWidth()`, `plotReverseCumulatives()`

### Examples

    p <- plotAnnot(exampleCAGEexp, 'counts', 'Here is the title')
    print(p)
    p + ggplot2::theme_bw()
    ggplot2::theme_set(ggplot2::theme_bw()) ; p
    plotAnnot(exampleCAGEexp, 'counts', 'Same, non-normalised', normalise = FALSE)
    exampleCAGEexp$myGroups <- factor(c("A", "A", "B", "B", "C"))
    plotAnnot(exampleCAGEexp, 'counts', group = "myGroups")
    plotAnnot(exampleCAGEexp, 'counts', group = ~myGroups)
    plotAnnot(exampleCAGEexp, 'counts', group = ~sampleLabels + myGroups)
    plotAnnot(exampleCAGEexp, CAGEr:::msScope_counts , group = "myGroups")

[Package CAGEr version 2.0.2 Index]