Computes relative abundances from a taxonomic abundance table and compares two experimental conditions by calculating a directional abundance ratio for each taxon. Taxa are ranked by mean abundance and visualized as a bubble plot, where bubble size represents mean relative abundance and color indicates the dominant condition.
ratio_plot(
table,
metadata,
condition_col,
condition_A,
condition_B,
taxonomy_db = "silva",
top_n = 30,
level = "genus",
x_axis_title = "Taxon",
fill_palette = c("#1f77b4", "#ff7f0e")
)A data frame containing a taxonomic abundance table with a taxonomy column and sample columns with numeric counts.
A data frame containing sample metadata. The first column must correspond to sample IDs and include a column defining the experimental conditions.
Character. Name of the metadata column defining the experimental condition.
Character. Name of the first condition to compare.
Character. Name of the second condition to compare.
Character. Taxonomic database used for annotation. ("silva","Kraken2").
Integer. Number of taxa with the highest mean abundance to display.
Character. Taxonomic level to use for comparison (e.g. "phylum", "genus", "species").
Character. Label for the x-axis (taxon names).
Character vector of colors used to represent the dominant condition.
A ggplot2 object showing abundance ratios between the two conditions.
ratio_plot(table,
metadata,
condition_col = "metodo",
condition_A = "kit",
condition_B = "fenol")
#> Warning: package 'tidyverse' was built under R version 4.4.3
#> Warning: package 'tidyr' was built under R version 4.4.3
#> Warning: package 'readr' was built under R version 4.4.3
#> Warning: package 'purrr' was built under R version 4.4.3
#> Warning: package 'stringr' was built under R version 4.4.3
#> Warning: package 'forcats' was built under R version 4.4.3
#> Warning: package 'lubridate' was built under R version 4.4.3
#> ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
#> ✔ forcats 1.0.1 ✔ stringr 1.6.0
#> ✔ lubridate 1.9.5 ✔ tibble 3.2.1
#> ✔ purrr 1.2.1 ✔ tidyr 1.3.2
#> ✔ readr 2.1.6
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag() masks stats::lag()
#> ℹ Use the conflicted package to force all conflicts to become errors
#> Error: object 'metadata' not found
ratio_plot(table = table,
metadata = metadata,
condition_col = "Treatment",
condition_A = "Control",
condition_B = "Compost",
level = "genus",
top_n = 20
)
#> Error: object 'metadata' not found