ezviz {mbX} | R Documentation |
Visualize Microbiome Data
Description
Generates publication-ready visualizations for microbiome data. This function first processes the microbiome and metadata files using ezclean(), then creates a bar plot using ggplot2. Supported file formats are CSV, TXT, and 'Excel'. Note: Only one of the parameters top_taxa or threshold should be provided.
Usage
ezviz(
microbiome_data,
metadata,
level,
selected_metadata,
top_taxa = NULL,
threshold = NULL,
flip = FALSE
)
Arguments
microbiome_data |
A string specifying the path to the microbiome data file. |
metadata |
A string specifying the path to the metadata file. |
level |
A string indicating the taxonomic level for filtering the data (e.g., "genus"). |
selected_metadata |
A string specifying the metadata column used for grouping. |
top_taxa |
An optional numeric value indicating the number of top taxa to keep. Use this OR threshold, but not both. |
threshold |
An optional numeric value indicating the minimum threshold value; taxa below this threshold will be grouped into an "Other" category. |
flip |
Logical. If 'TRUE', the order of the stacks is reversed. |
Value
A ggplot object containing the visualization.
Examples
mb <- system.file("extdata", "microbiome.csv", package = "mbX")
md <- system.file("extdata", "metadata.csv", package = "mbX")
plot_obj <- ezviz(
microbiome_data = mb,
metadata = md,
level = "genus",
selected_metadata = "sample_type",
top_taxa = 20,
flip = FALSE
)
print(plot_obj)