Skip to contents

Creates volcano plots visualizing differential abundance test results.

Usage

generate_taxa_volcano_single(
  data.obj,
  group.var = NULL,
  test.list,
  feature.sig.level = 0.1,
  feature.mt.method = "fdr",
  features.plot = NULL,
  palette = c("white", "#7FB695", "#006D2C"),
  pdf = FALSE,
  pdf.wid = 7,
  pdf.hei = 5
)

Arguments

data.obj

A MicrobiomeStat data object, which is a list containing at minimum the following components:

  • feature.tab: A matrix of feature abundances (taxa/genes as rows, samples as columns)

  • meta.dat: A data frame of sample metadata (samples as rows)

Optional components include:

  • feature.ann: A matrix/data frame of feature annotations (e.g., taxonomy)

  • tree: A phylogenetic tree object (class "phylo")

  • feature.agg.list: Pre-aggregated feature tables by taxonomy

Data objects can be created using converters like mStat_convert_phyloseq_to_data_obj or importers like mStat_import_qiime2_as_data_obj.

group.var

Character string specifying the column name in meta.dat containing the grouping variable (e.g., treatment, condition, phenotype). Used for between-group comparisons.

test.list

List of test results from generate_taxa_test_single.

feature.sig.level

Numeric; significance level cutoff for highlighting taxa.

feature.mt.method

Character; multiple testing method ("fdr" or "none").

features.plot

Character vector of taxa to plot. If NULL, plots all.

palette

Character vector of colors or a named palette for the plot. If NULL, uses default MicrobiomeStat color scheme. Can be:

  • A vector of color codes (e.g., c("#E41A1C", "#377EB8"))

  • A palette name recognized by the plotting function

pdf

Logical. If TRUE, saves the plot(s) to PDF file(s) in the current working directory. Default is TRUE.

pdf.wid

Numeric value specifying the width of PDF output in inches. Default is typically 11.

pdf.hei

Numeric value specifying the height of PDF output in inches. Default is typically 8.5.

Value

A list of ggplot objects of volcano plots for each taxonomic level.

Examples

if (FALSE) { # \dontrun{
  # Load the data
  data(peerj32.obj)

  # Generate a list of tests for taxa significance
  test.list <- generate_taxa_test_single(
    data.obj = peerj32.obj,
    time.var = "time",
    t.level = "2",
    group.var = "group",
    adj.vars = "sex",
    feature.dat.type = "count",
    feature.level = c("Family"),
    prev.filter = 0.1,
    abund.filter = 0.0001
  )

  # Generate volcano plots from the test results
  volcano_plots <- generate_taxa_volcano_single(
    data.obj = peerj32.obj,
    group.var = "group",
    test.list = test.list,
    feature.sig.level = 0.1,
    feature.mt.method = "none"
  )

  volcano_plots <- generate_taxa_volcano_single(
    data.obj = peerj32.obj,
    group.var = "group",
    test.list = test.list,
    features.plot = peerj32.obj$feature.ann[,"Family"][1:10],
    feature.sig.level = 0.1,
    feature.mt.method = "none"
  )
} # }