Skip to contents

`plot_taxonomy_annotate_ts_alluvial()` creates an alluvial flow diagram from the output of sourmash taxonomy annotate for metagenomes that were sequenced in time series.

Usage

plot_taxonomy_annotate_ts_alluvial(
  taxonomy_annotate_df,
  time_df,
  tax_glom_level = NULL,
  fraction_threshold = 0.01,
  label = TRUE,
  palette = NULL
)

Arguments

taxonomy_annotate_df

Data frame containing outputs from sourmash taxonomy annotate. Can contain results from one or many runs of sourmash taxonomy annotate. If specified, agglomeration occurs per query.

time_df

A data frame. The first column should contain all of the values in the query_name column of taxonomy_annotate_df and should be called "query_name". The second column should indicate the time that the sample was taken and should be named "time". This plot requires that time be specified as numeric values (e.g. if samples were taken at 2 weeks, 1 month, and 2 months, the values should be specified as 0.5, 1, and 2); this allows the function to appropriately sort and bound the x axis.

tax_glom_level

Optional character string specifying the taxonomic rank to agglomerate the fraction of the metagenome that matched to a genome in the database (f_unique_to_query). Must be one of "domain", "phylum", "class", "order", "family", "genus", "species."

fraction_threshold

A number between 0-1. Defaults to 0.01. The minimum fraction that a taxonomic lineage needs to occur in at least one time series sample for that lineage to have an alluvial ribbon in the final plot. Lineages that occur below this threshold are grouped into an "other" category.

label

Boolean controlling whether taxonomy labels are added to the plot. The default, TRUE, plots labels. Setting to FALSE removes the labels and can be used to control the label appearances; add a layer with `ggalluvial::stat_alluvium(geom = "text")` to re-add labels and use arguments passed to `ggplot2::layer()` to control the appearance of the output.

palette

An optional character vector of palette values passed to `scale_fill_manual(values = palette)`. If no palette is specified, RColorBrewer's Set2 is the default.

Value

A ggplot2 plot

Examples

if (FALSE) {
plot_taxonomy_annotate_ts_alluvial()
}