mapStats: Process mapping statistics

View source: R/Annotations.R

mapStatsR Documentation

Process mapping statistics

Description

Using a data frame containing mapping statistics in counts, transform the data in percentages that can be used for stacked barplots.

Usage

mapStats(libs, scope, group = "sampleLabels", facet = NULL, normalise = TRUE)

Arguments

libs

A data frame with containing columns required by the scope chosen.

scope

The name of a “scope”, that defines which data is plotted and how it is normalised, or a function that implements a custom scope. See mapStatsScopes() for details on each scope.

group

A vector of factors defining groups in the data. By default, the sample labels (which means no grouping).

facet

A vector of factors defining facets in the data (in the sense of ggplot2's facet_wrap function).

normalise

Whether to normalise or not. Default: TRUE.

Details

See the plotAnnot vignette and the mapStatsScopes() help page for details on what the scopes are.

See http://stackoverflow.com/questions/10417003/stacked-barplot-with-errorbars-using-ggplot2 about stacked barplot.

Value

Returns a data frame with mean and standard deviation of normalised mapping statistics, plus absolute positions for the error bars. The first column, group, is a vector of factors sorted with the gtools::mixedorder() function. The facet column, if any, is always called facet.

Author(s)

Charles Plessy

See Also

plotAnnot, mapStatsScopes

Examples

CAGEr:::mapStats(as.data.frame(colData(exampleCAGEexp)), "counts", sampleLabels(exampleCAGEexp))
CAGEr:::mapStats(as.data.frame(colData(exampleCAGEexp)), "counts", c("A", "A", "B", "B", "C"))


charles-plessy/CAGEr documentation built on Oct. 27, 2024, 10:11 p.m.