
Generate Volcano Plots for Longitudinal Taxa Trend Test
Source:R/generate_taxa_trend_volcano_long.R
generate_taxa_trend_volcano_long.RdCreates volcano plots visualizing longitudinal taxa trends and significance.
Usage
generate_taxa_trend_volcano_long(
data.obj,
group.var = NULL,
time.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_objor importers likemStat_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.
- time.var
Character string specifying the column name in meta.dat containing the time variable. Required for longitudinal and paired analyses. Supports character/factor labels (e.g., "baseline", "week4") and numeric values. Some trend/volatility methods require numeric or coercible-to-numeric time values.
- test.list
List of test results from generate_taxa_trend_test_long.
- 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 features 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
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.
Examples
if (FALSE) { # \dontrun{
data("subset_T2D.obj")
test.list <- generate_taxa_trend_test_long(
data.obj = subset_T2D.obj,
subject.var = "subject_id",
time.var = "visit_number",
group.var = "subject_race",
adj.vars = "sample_body_site",
prev.filter = 0.1,
abund.filter = 0.001,
feature.level = c("Genus","Family"),
feature.dat.type = c("count")
)
plot.list <- generate_taxa_trend_volcano_long(
data.obj = subset_T2D.obj,
group.var = "subject_race",
time.var = "visit_number_num",
test.list = test.list,
feature.sig.level = 0.1,
feature.mt.method = "none")
generate_taxa_trend_test_long(
data.obj = ecam.obj,
subject.var = "studyid",
time.var = "month_num",
group.var = NULL,
feature.level = c("Phylum","Class"),
feature.dat.type = c("proportion")
)
} # }