plotAbundance {miaViz}R Documentation

Plotting abundance data

Description

plotAbundance plots the abundance on a selected taxonomic rank. Since this probably makes sense only for relative abundance data, the assay used by default is expected to be in the slot ‘relabundance’.

Usage

plotAbundance(x, ...)

## S4 method for signature 'SummarizedExperiment'
plotAbundance(
  x,
  rank = taxonomyRanks(x)[1],
  features = NULL,
  order_rank_by = c("name", "abund", "revabund"),
  order_sample_by = NULL,
  decreasing = TRUE,
  use_relative = TRUE,
  layout = c("bar", "point"),
  one_facet = TRUE,
  ncol = 2,
  scales = "fixed",
  abund_values = "counts",
  ...
)

Arguments

x

a SummarizedExperiment object.

...

additional parameters for plotting. See mia-plot-args for more details

rank

a single character value defining the taxonomic rank to use. Must be a value of taxonomyRanks(x).

features

data colData to be plotted below the abundance plot. Continuous numeric values will be plotted as point, whereas factors and character will be plotted as colour-code bar. (default: features = NULL)

order_rank_by

How to order abundance value: By name (“name”), by abundance (“abund”) or by reverse abundance (“revabund”).

order_sample_by

A single character value from the chosen rank of abundance data data or from colData to select values to order the abundance plot by. If the value is not part of features, it will be added. (default: order_sample_by = NULL)

decreasing

TRUE or FALSE: If the order_sample_by is defined and the values are numeric, should the values used to order in decreasing or increasing fashion? (default: decreasing = FALSE)

use_relative

TRUE or FALSE: Should the relative values be calculated? (default: use_relative = TRUE)

layout

Either “bar” or “point”.

one_facet

Should the plot be returned in on facet or split into different facet, one facet per different value detect in rank. If features or order_sample_by is not NULL, this setting will be disregarded.

ncol, scales

if one_facet = FALSE, ncol defines many columns should be for plotting the different facets and scales is used to define the behavior of the scales of each facet. Both values are passed onto facet_wrap.

abund_values

a character value defining which assay data to use. (default: abund_values = "relabundance")

Details

Subsetting to rows of interested and ordering of those is expected to be done outside of this functions, e.g. x[1:2,]. This will plot data of all features present.

Value

a ggplot object or list of ggplot objects, if features are added to the plot.

Examples

data(GlobalPatterns, package="mia")
se <- GlobalPatterns

#
plotAbundance(se, abund_values="counts")
#
plotAbundance(se, abund_values="counts", rank = "Phylum", add_legend = FALSE)

# If rank is set to NULL plotAbundance behaves like plotExpression
plotAbundance(se, abund_values="counts", rank = NULL,
              features = head(rownames(se)))
              
# Factors can also be plotted and ordered by
plotAbundance(se, abund_values="counts", rank = "Phylum",
              features = "SampleType",
              order_sample_by = "SampleType")

[Package miaViz version 1.0.1 Index]