Skip to contents

Tallies a categorical column from a feature annotation table (e.g. mcols()/rowData() of a SummarizedExperiment, or the data frame returned by the selectmatrix module's getAnnotation()) and renders the counts as a bar chart via interactive_barchart. Generalises the shape of the differential-expression-by-biotype plot rendered by the nf-core/differentialabundance report to any categorical annotation column.

Usage

interactive_count_barplot(
  annotation,
  category,
  fill = NULL,
  barmode = c("group", "stack"),
  palette_name = COLORBLIND_PALETTE_NAME,
  title = NULL
)

Arguments

annotation

A data frame of feature annotation, one row per feature.

category

Name of a column in annotation to count rows by; forms the plot's x axis.

fill

Optional name of a second column in annotation to split counts by (bar colour/legend). Default NULL: a single, unsplit count per category.

barmode

Bar mode when fill is specified: "group" (dodged bars, the default) or "stack".

palette_name

Valid R color palette name

title

Plot title

Value

output Plotly plot object

Examples

interactive_count_barplot(
  data.frame(
    biotype = c("protein_coding", "protein_coding", "lncRNA", "lncRNA"),
    direction = c("Up", "Down", "Up", "Up")
  ),
  category = "biotype", fill = "direction"
)