rabuplot: Relative Abundance Plot

View source: R/rabuplot.R

rabuplotR Documentation

Relative Abundance Plot

Description

For creating nice microbiome plots

Usage

rabuplot(
  phylo_ob,
  predictor = "none",
  type = "genus",
  relative_abun = TRUE,
  id = NULL,
  xlabs = "Relative abundance (%)",
  ylabs = "Average relative abundance",
  main = "Relative abundance plot",
  violin = TRUE,
  violin_scale = "width",
  legend_title = predictor,
  N_taxa = NULL,
  By_median = TRUE,
  no_other_type = FALSE,
  legend_names = NULL,
  Time = "Time",
  Timepoint = NULL,
  Strata = NULL,
  Strata_val = "1",
  no_legends = FALSE,
  no_names = FALSE,
  italic_names = TRUE,
  Only_sig = FALSE,
  log = TRUE,
  log_max = 100,
  stat_out = FALSE,
  p_val = TRUE,
  p_stars = FALSE,
  stats = "non-parametric",
  p_adjust = FALSE,
  p_adjust_method = "fdr",
  p_adjust_full = FALSE,
  colors = NULL,
  color_by = NULL,
  order = TRUE,
  reverse = FALSE,
  list_taxa = NULL,
  select_taxa = NULL,
  select_type = "genus",
  bar_chart = FALSE,
  bar_chart_stacked = FALSE,
  facet_wrap = NULL,
  facet_label = NULL,
  facet_n = TRUE,
  percent = FALSE,
  order_by = "Time",
  order_val = NULL,
  text_angle_x = 0,
  rank = NULL,
  select_rank = NULL
)

Arguments

phylo_ob

Phyloseq object with metadata in sample_data.

predictor

Predictor of interest for statistics/plotting in sample_data.

type

Taxonomic rank from tax_table, case insensitive; default is "genus".

relative_abun

Use relative abundances, else absolute; default is TRUE.

id

Define id variable for mixed models.

xlabs

X-axis label

ylabs

Y-axis label

main

Title of plot

violin

Use geom_violin for plotting, else boxplot; default is TRUE.

violin_scale

Scale option for geom_violin; default is "width".

legend_title

Legend title; default is name of predictor.

N_taxa

Number of taxa to be plotted; default is 15.

By_median

Order plot by median abundances, else mean abundances; default is TRUE.

no_other_type

Taxa in lower abundances than top N_taxa, are grouped as "other", this will remove this group from the plot; default is FALSE.

legend_names

Define variable names for legend text.

Time

Time variable name for longitudinal datasets.

Timepoint

Value in variable @Time to select.

Strata

Name of variable for stratification;

Strata_val

Value in variable @Strata to keep; default is 1.

no_legends

Removes legend; default is FALSE.

no_names

Removes taxa names; default is FALSE.

italic_names

Taxa names will be in italic e.g. usable for family, genus, species levels; default is TRUE

Only_sig

Only keep significant taxa; default is FALSE.

log

Present plot on a log scale; default is TRUE.

log_max

Maximum value of log-axis options:1, 10, 100; default is 100.

stat_out

Outputs a data.frame with statistics to Global environment; default is FALSE.

p_val

Displays p-values on plot; default is TRUE.

p_stars

Shows stars instead of p-values; default is FALSE.

stats

Select type of statistical test; options: "non-parametric", "parametric", "mixed", "mgs_feature", "maaslin2"; default is "non-parametric".

p_adjust

adjust p-values; default is "FALSE.

p_adjust_method

options: "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr"; default is "fdr".

p_adjust_full

correction applied for all taxa in the dataset; default is FALSE.

colors

define list of colors for plot. If not color brewer will be used; default is NULL.

color_by

define taxonomic rank to color by; default is NULL.

order

Order by abundance, else alphabetically; default is TRUE.

reverse

Flip taxa order; default is FALSE.

list_taxa

A list of specific taxa names to be analyzed; default is NULL.

select_taxa

Choose all taxa from one or more taxonomic variables, eg. "Staphylococcus" or "Staph" or "coccus" or c("staph",bifido"); default is NULL.

select_type

Taxonomic rank of the @select_taxa; default is "genus".

bar_chart

Choose to make bar chart; default is FALSE.

bar_chart_stacked

Produce stacked bar chart; default is FALSE

facet_wrap

Facet wrap chart by variable; eg. Time; default is NULL.

facet_label

Facet wrap labels; default is NULL.

facet_n

Show n for each facet; default is TRUE.

percent

Print percentages on bar chart; default is FALSE.

order_by

Choose variable to order the selected taxa by; eg. Time; default is Time.

order_val

Choose value for @order_by; default is NULL.

text_angle_x

Choose value for rotation of axis-text; default is 0.

rank

Taxonomic rank from tax_table, replaces "type", case insensitive; default is "genus".

select_rank

Taxonomic rank of the @select_taxa, replaces "select_type"; default is "genus".

Value

A ggplot


jstokholm/rabuplot documentation built on Dec. 8, 2024, 3:49 p.m.