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
)
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. |
Value
A ggplot object containing the visualization.
Examples
# Example usage (ensure that 'inst/extdata' contains the appropriate files):
microbiome_data <- system.file("extdata", "microbiome.csv", package = "mbX")
metadata <- system.file("extdata", "metadata.csv", package = "mbX")
plot_obj <- ezviz(microbiome_data, metadata, "genus", "sample_type", top_taxa = 20)
print(plot_obj)