diff --git a/.Rbuildignore b/.Rbuildignore index 478c465..768799e 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,5 @@ ^\.travis\.yml$ ^.*\.Rproj$ ^\.Rproj\.user$ +CNAME +^pkgdown$ diff --git a/.travis.yml b/.travis.yml index 7382ab5..8b26e88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,15 +10,15 @@ branches: only: - master - dev-master - - build-fixes - env: global: - _R_CHECK_FORCE_SUGGESTS_=false - R_REMOTES_NO_ERRORS_FROM_WARNINGS=true + - CODECOV_TOKEN=2ff74b01-00e8-4e2f-9cc7-1f90ca17e480 r: +- oldrel - release - devel diff --git a/DESCRIPTION b/DESCRIPTION index a0efb27..fc7aec6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,10 @@ Package: MicrobiomeR Title: Analyze Microbiome Data -Version: 0.4.1 +Version: 0.5.1 Authors@R: c( person("Robert", "Gilmore", email = "rgilmore@umc.edu", role = "cre"), person("Shaurita", "Hutchins", email = "shutchins2@umc.edu", role = "aut")) +Maintainer: Rob Gilmore License: MIT + file LICENSE biocViews: Metagenomics, Microbiome, Sequencing, SystemsBiology Description: An R package for microbiome analysis combining functions from phyloseq, metacodeR, @@ -16,48 +17,50 @@ Remotes: github::grunwaldlab/metacoder, github::joey711/phyloseq, github::microbiome/microbiome, + github::r-lib/covr, github::jonclayden/shades Imports: ape, + biomformat, + crayon, DT, data.table, diptest, dplyr, - rlang, + forcats, + ggplot2, + ggpubr, + ggthemes, + ggrepel, glue, + htmlwidgets, + htmltools, + leaflet, + magrittr, metacoder, - modes, microbiome (>= 1.5.27), + modes, openxlsx, phyloseq, plotly, purrr, + rlang, + rstudioapi, + scales, scico, + shades, + stringr, taxa, tibble, tidyr, - viridis, - yaml, - ggplot2, - stringr, - rstudioapi, - magrittr, - ggpubr, - ggthemes, - crayon, - biomformat, - forcats, - ggrepel, - scales, vegan, - leaflet, - htmlwidgets, - shades + viridis, + yaml Suggests: + covr, knitr, - testthat, rmarkdown, - covr + testthat Additional_repositories: http://bioconductor.org/packages/release/bioc/, http://bioconductor.org/packages/release/data/annotation, @@ -66,6 +69,6 @@ Additional_repositories: Encoding: UTF-8 LazyData: true RoxygenNote: 6.1.1 -URL: https://github.com/vallenderlab/MicrobiomeR +URL: https://github.com/vallenderlab/MicrobiomeR, https://microbiomer.vallenderlab.science/ BugReports: https://github.com/vallenderlab/MicrobiomeR/issues VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 75b7976..deea91b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,7 @@ # Generated by roxygen2: do not edit by hand export("%>%") -export(agglomerate_metacoder) +export(agglomerate_taxmap) export(alpha_diversity_measures) export(alpha_diversity_plot) export(as_MicrobiomeR_format) @@ -15,9 +15,9 @@ export(correlation_data) export(correlation_plot) export(correlation_plots) export(cov_filter) -export(create_metacoder) export(create_phyloseq) export(create_pub_table) +export(create_taxmap) export(get_color_palette) export(heat_tree_parameters) export(heat_tree_plots) @@ -59,7 +59,6 @@ export(viridis_magma_palette) export(viridis_palette) export(vlookup) export(which_format) -import(scales) import(vegan) importFrom(ape,Ntip) importFrom(ape,is.rooted) @@ -155,6 +154,8 @@ importFrom(purrr,modify_at) importFrom(rlang,enquos) importFrom(rlang,eval_tidy) importFrom(rlang,is_quosure) +importFrom(scales,percent) +importFrom(scales,pretty_breaks) importFrom(scico,scico) importFrom(shades,saturation) importFrom(shades,scalefac) diff --git a/NEWS.md b/NEWS.md index ed8ad51..a3e67ae 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,32 @@ +# MicrobiomeR 0.5.1 +* A specific bug was introduced that prevented local machines and Travis CI servers from building +the package. + * This bug is attributed to a dplyr update (0.7.8 -> 0.8.0.1) + * See [Joss branch #79](https://github.com/vallenderlab/MicrobiomeR/pull/79) + * See [Joss debug branch #82](https://github.com/vallenderlab/MicrobiomeR/pull/82) + * See [dplyr issue #4213](https://github.com/tidyverse/dplyr/issues/4213) + * See [Travis CI forum post](https://travis-ci.community/t/travis-build-ignoring-r-package-version-in-description/2431) +* Updated the paper for submission + + +# MicrobiomeR 0.5.0 + +* Added the JOSS paper and draft vignette +* Changed correlation plots + * Removed color from background + * Removed hard coded plot limits + * Added "1:1" line and Average lines + * Added a `trans` parameter to transform the x and y axis +* Changed function names + * From `create_metacoder` to `create_taxmap` + * From `agglomerate_metacoder` to `agglomerate_taxmap` + * From `melt_metacoder` to `melt_taxmap` +* Bugs + * Fixed `output_dir` bug where error should have been a warning + * Fixed correlation plot bug where treatments were on the wrong axis. + * Fixed output message for heat tree plots. +* Fixed build-check Notes and Warnings + # MicrobiomeR 0.4.1 * Fixed wilcoxon pvalue in analysis vignette. @@ -8,7 +37,7 @@ ## Renamed functions * `get_alpha_diversity_measures` to `alpha_diversity_measures` - + ## Added functions * Added `stacked_barplots`, `alpha_diversity_plots`, `ordination_plots` diff --git a/R/alpha-diversity.R b/R/alpha-diversity.R index c66ee0b..70be6c8 100644 --- a/R/alpha-diversity.R +++ b/R/alpha-diversity.R @@ -1,6 +1,6 @@ #' @title Alpha Diveristy Measues #' @description This function generates various alpha diversity measures include Shannon, Fisher, Coverage, Gini Simpson, and Inverse Simpson. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param group The "TreatmentGroup" or similar grouping from your metadata to denote sample groups, Default: 'TreatmentGroup' #' @return Returns a list of alpha diversity measures with metadata. #' @pretty_print TRUE @@ -22,11 +22,11 @@ #' @importFrom utils combn alpha_diversity_measures <- function(obj, group = "TreatmentGroup") { metacoder_object <- validate_MicrobiomeR_format( - obj = create_metacoder(obj), + obj = create_taxmap(obj), valid_formats = c("analyzed_format") ) - # Convert metacoder object to a phyloseq object. + # Convert Taxmap object to a phyloseq object. phyloseq_object <- metacoder::as_phyloseq(metacoder_object, otu_table = "otu_abundance", phy_tree = "phy_tree") # Get all of the diversities. @@ -52,7 +52,7 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") { #' @title Alpha Diversity Plot #' @description Plot the alpha diversity using a violin plot. `alpha_diversity_plots` generates plots for all alpha diversity measures. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param measure Select an alpha diversity measure such as shannon, gini simpson, and inverse simpson, Default: 'shannon' #' @param group The "TreatmentGroup" or similar grouping or column from your metadata to denote sample groups, Default: 'TreatmentGroup' #' @param select_otu_table Choose an otu table to analyze, Default: 'otu_proportions' @@ -65,7 +65,9 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") { #' if (interactive()) { #' library(MicrobiomeR) #' data <- analyzed_silva -#' plot <- alpha_diversity_plot(obj = data, measure = "shannon", select_otu_table = "otu_proportions") +#' plot <- alpha_diversity_plot(obj = data, +#' measure = "shannon", +#' select_otu_table = "otu_proportions") #' plot #' } #' } @@ -81,7 +83,7 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") { alpha_diversity_plot <- function(obj, measure = "shannon", group = "TreatmentGroup", select_otu_table = "otu_proportions", title = NULL) { # Validate data format metacoder_object <- validate_MicrobiomeR_format( - obj = create_metacoder(obj), + obj = create_taxmap(obj), valid_formats = c("analyzed_format") ) metacoder_object$data$sample_data[[measure]] <- vegan::diversity(metacoder_object$data[[select_otu_table]][, metacoder_object$data$sample_data$X.SampleID], diff --git a/R/barplot.R b/R/barplot.R index 3c26bc0..2589a69 100644 --- a/R/barplot.R +++ b/R/barplot.R @@ -1,8 +1,10 @@ +#' @title Melt Taxmap +#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @importFrom dplyr right_join setdiff #' @importFrom tidyr gather_ #' @family Formatting -#' @rdname stacked_barplot -melt_metacoder <- function(obj) { +#' @rdname melt_taxmap +melt_taxmap <- function(obj) { sd <- data.frame(obj$data$sample_data) TT <- data.frame(obj$data$otu_annotations, stringsAsFactors = FALSE) otu.table <- data.frame(obj$data$otu_proportions, check.names = FALSE, stringsAsFactors = FALSE) @@ -13,12 +15,13 @@ melt_metacoder <- function(obj) { rename(SampleID = `X.SampleID`) %>% rename(OTU = `otu_id`) } - +#' @title Convert Proportions #' @param melted_df A "melted" dataframe from the metacoder object's data. +#' @param tax_level The taxonomic level, Default: 'Phylum' #' @importFrom dplyr filter group_by summarize mutate enquo quo_name #' @importFrom stats na.omit #' @family Data Manipulators -#' @rdname stacked_barplot +#' @rdname convert_proportions convert_proportions <- function(melted_df, tax_level) { t <- dplyr::enquo(tax_level) tax_level.abund <- paste0(dplyr::quo_name(t), ".Abundance") @@ -34,7 +37,7 @@ convert_proportions <- function(melted_df, tax_level) { #' @title Stacked Barplot #' @description Create a stacked barplot to show relative abundance of taxa. `convert_proportions` converts the dataframe abundance values to percent 100 and returns a transformed dataframe. #' `melt_metacoder` melts the metacoder or phyloseq tables into a dataframe and returns a melted dataframe. `stacked_barplots` creates a stacked barplots for multiple taxonomic levels and returns a list of stacked barplots. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param tax_level The taxonomic level, Default: 'Phylum' #' @param fill The taxonomic level by which the bars are filled, Default: 'Phylum' #' @param xlabel The label of the x axis, Default: 'Samples' @@ -55,8 +58,8 @@ convert_proportions <- function(melted_df, tax_level) { #' @importFrom ggplot2 ggplot aes annotate geom_bar ylab element_blank element_rect xlab annotate #' @importFrom magrittr %>% #' @importFrom dplyr mutate +#' @importFrom scales pretty_breaks #' @importFrom shades scalefac saturation -#' @import scales #' @import vegan #' #' @inheritParams convert_proportions @@ -66,13 +69,13 @@ convert_proportions <- function(melted_df, tax_level) { #' @export stacked_barplot <- function(obj, tax_level = "Phylum", fill = "Phylum", xlabel = "Samples", faceted = FALSE, title = NULL, palette_values = NULL) { metacoder_object <- validate_MicrobiomeR_format( - obj = create_metacoder(obj), + obj = create_taxmap(obj), valid_formats = c("analyzed_format") ) # Start by melting the data in the "standard" way using psmelt. # Also, transform the abundance data to relative abundance - mdf <- convert_proportions(melt_metacoder(metacoder_object), tax_level) + mdf <- convert_proportions(melt_taxmap(metacoder_object), tax_level) mdf <- dplyr::mutate(mdf, !!sym(tax_level) := factor(!!sym(tax_level), levels = unique(mdf[[tax_level]]))) # Build the plot data structure @@ -116,12 +119,13 @@ stacked_barplot <- function(obj, tax_level = "Phylum", fill = "Phylum", xlabel = return(p) } - +#' @title Stacked Barplots #' @param tax_levels The taxonomic levels, Default: 'c("Phylum", "Class", "Order")' +#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @family Visualizations -#' @rdname stacked_barplot +#' @rdname stacked_barplots #' @export -stacked_barplots <- function(obj, tax_levels = c("Phylum", "Class", "Order"), group = "TreatmentGroup", select_otu_table = "otu_proportions") { +stacked_barplots <- function(obj, tax_levels = c("Phylum", "Class", "Order")) { if (is.null(tax_levels)) { tax_levels <- c("Phylum", "Class", "Order") } else if (length(tax_levels) < 2) { diff --git a/R/correlation-plot.R b/R/correlation-plot.R index ae06aec..746d8af 100644 --- a/R/correlation-plot.R +++ b/R/correlation-plot.R @@ -1,11 +1,14 @@ #' @title Correlation Plot #' @description Create a correlation plot from a metacoder/taxmap object. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param primary_rank The primary rank used to label the points. #' @param secondary_rank The secondary rank used to color the points. Can be an integer specifying #' the number of supertaxon ranks above the primary rank or the name of a supertaxon rank. Default: TRUE #' @param wp_value The Wilcoxian P-Value used to represent significant points. Default: 0.05 #' @param pal_func A palette function that returns grDevices::colorRampPalette. +#' @param trans Either the name of a transformation object, or the object itself given to \code{\link[ggplot2]{scale_continuous}}. +#' Built-in transformations include "asn", "atanh", "boxcox", "exp", "identity", "log", "log10", "log1p", +#' "log2", "logit", "probability", "probit", "reciprocal", "reverse" and "sqrt". #' @return A 1:1 correlation plot built with ggplot2. #' @pretty_print TRUE #' @details Correlation plots help to better explain the heat tree findings. @@ -23,7 +26,7 @@ #' @family Visualizations #' @rdname correlation_plot #' @seealso -#' \code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{correlation_data}}, \code{\link[MicrobiomeR]{plot_limits}}, \code{\link[MicrobiomeR]{get_color_palette}} +#' \code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{correlation_data}}, \code{\link[MicrobiomeR]{plot_limits}}, \code{\link[MicrobiomeR]{get_color_palette}} #' #' \code{\link[ggplot2]{ggplot}}, \code{\link[ggplot2]{aes}}, \code{\link[ggplot2]{geom_polygon}}, \code{\link[ggplot2]{geom_point}}, \code{\link[ggplot2]{labs}}, \code{\link[ggplot2]{scale_continuous}}, \code{\link[ggplot2]{scale_manual}}, \code{\link[ggplot2]{guide_legend}}, \code{\link[ggplot2]{geom_abline}} #' @@ -34,9 +37,10 @@ #' @importFrom forcats fct_reorder #' @importFrom ggrepel geom_label_repel #' @importFrom crayon yellow +#' @importFrom scales percent correlation_plot <- function(obj, primary_rank, secondary_rank = TRUE, - wp_value = 0.05, pal_func = NULL) { - metacoder_object <- create_metacoder(obj) + wp_value = 0.05, pal_func = NULL, trans = "logit") { + metacoder_object <- create_taxmap(obj) metacoder_object <- validate_MicrobiomeR_format(obj = metacoder_object, valid_formats = c("analyzed_format")) ranks <- pkg.private$ranks @@ -71,10 +75,22 @@ correlation_plot <- function(obj, primary_rank, secondary_rank = TRUE, # Get the limits of the plot based on the data plot_limits <- plot_limits(primary_data$mean_treat1, primary_data$mean_treat2) # Create a dataframe for background color - background_limits <- data.frame(id = c("1", "1", "1", "2", "2", "2"), x = c(0, Inf, 0, 0, Inf, Inf), y = c(0, Inf, Inf, 0, 0, Inf)) + #background_limits <- data.frame(id = c("1", "1", "1", "2", "2", "2"), x = c(0, Inf, 0, 0, Inf, Inf), y = c(0, Inf, Inf, 0, 0, Inf)) # Get a color palette secondary_taxa <- length(unique(primary_data[[(secondary_rank)]])) + # Get the mean significant increase and mean significant decrease for x and y + # sig_decrease <- dplyr::filter(significant_data, Abundance == "Significant Decrease") + # sig_increase <- dplyr::filter(significant_data, Abundance == "Significant Increase") + # x_inc <- mean(sig_increase$mean_treat1) + # x_dec <- mean(sig_decrease$mean_treat1) + # y_inc <- mean(sig_increase$mean_treat2) + # y_dec <- mean(sig_decrease$mean_treat2) + # y_pos <- max(primary_data$mean_treat2) + # x_pos <- max(primary_data$mean_treat1) + x_avg <- mean(significant_data$mean_treat2) + y_avg <- mean(significant_data$mean_treat1) + if (is.null(pal_func)) { pal_func <- combination_palette( magma = list(palette = viridis::magma, args = list(n=500), range=450:500, rev=TRUE), @@ -88,19 +104,30 @@ correlation_plot <- function(obj, primary_rank, secondary_rank = TRUE, display = FALSE) # Start ggplot2 workflow - corr <- ggplot2::ggplot(primary_data, ggplot2::aes(x = mean_treat1, y = mean_treat2)) + - ggplot2::geom_polygon(background_limits, mapping = ggplot2::aes(x = x, y = y, fill = id), alpha = 0.07, show.legend = FALSE) + + corr <- ggplot2::ggplot(primary_data, ggplot2::aes(x = mean_treat2, y = mean_treat1)) + + #ggplot2::geom_polygon(background_limits, mapping = ggplot2::aes(x = x, y = y, fill = id), alpha = 0.07, show.legend = FALSE) + + #ggplot2::geom_vline(aes(linetype = "dotted"), xintercept = x_avg) + + # ggplot2::geom_vline(xintercept = x_dec, show.legend = TRUE, linetype = "dotted") + + # ggplot2::geom_hline(yintercept = y_inc, show.legend = TRUE, linetype = "dotted") + + #ggplot2::geom_hline(aes(linetype = "dotted"), yintercept = y_avg) + + # ggplot2::annotate("text", x=c(x_inc, x_dec, x_pos, x_pos), y = c(y_pos, y_pos, y_inc, y_dec), label = c("+", "-", "+", "-"), color = "darkred", size=5) + ggplot2::geom_point(data = significant_data, ggplot2::aes(shape = Abundance), size = 3.2, color = "black", stroke = 2, show.legend = FALSE) + ggplot2::geom_point(data = primary_data, ggplot2::aes(shape = Abundance, color = forcats::fct_reorder(primary_data[[secondary_rank]], color_wilcox_p_value, min)), size = 2.5, stroke = 1.5) + ggrepel::geom_label_repel( mapping = ggplot2::aes(label = rank_label), size = 3, segment.size = 0.15, point.padding = 0.5, box.padding = 0.6, alpha = 0.65, force = 45, max.iter = 10000, min.segment.length = 0.1, seed = 2289, - nudge_x = ifelse(primary_data$mean_treat1 < primary_data$mean_treat2, -2, 2.5), nudge_y = ifelse(primary_data$mean_treat2 < primary_data$mean_treat1, -1.9, 2)) + + nudge_x = ifelse(primary_data$mean_treat2 < primary_data$mean_treat1, -2, 2.5), nudge_y = ifelse(primary_data$mean_treat1 < primary_data$mean_treat2, -1.9, 2)) + ggplot2::labs(title = glue::glue("{primary_rank} ({comp_title})"), x = glue::glue("Mean Abundance Before {treatments[1]}"), y = glue::glue("Mean Abundance After {treatments[1]}")) + - ggplot2::scale_y_log10(limits = plot_limits) + ggplot2::scale_x_log10(limits = plot_limits) + - ggplot2::scale_shape_manual(name = glue::glue("Abundance After {treatments[1]}:"), values = c("Significant Increase" = 16, "Significant Decrease" = 15, "Insignificant Change" = 4)) + + ggplot2::scale_x_continuous(trans=trans, label = scales::percent) + + ggplot2::scale_y_continuous(trans=trans, label = scales::percent) + + ggplot2::theme(axis.text.x = element_text(angle=45)) + + ggplot2::scale_shape_manual(name = glue::glue("Abundance After {treatments[1]}"), values = c("Significant Increase" = 16, "Significant Decrease" = 15, "Insignificant Change" = 4)) + ggplot2::scale_fill_manual(values = c("red", "blue", myPal), guide = FALSE) + - ggplot2::scale_color_manual(values = c(myPal), name = sprintf("%s:", c(secondary_rank)), guide = ggplot2::guide_legend(ncol = 2)) + - ggplot2::geom_abline(slope = 1, intercept = 0, linetype = "dashed") + ggplot2::scale_color_manual(values = c(myPal), name = sprintf("%s", c(secondary_rank)), guide = ggplot2::guide_legend(ncol = 2)) + + ggplot2::geom_abline(aes(linetype = "dashed", intercept = 0, slope = 1)) + + ggplot2::geom_vline(aes(linetype = "dotted", xintercept = x_avg)) + + ggplot2::geom_hline(aes(linetype = "dotted", yintercept = y_avg)) + + ggplot2::scale_linetype_identity(name = 'Lines',guide = "legend",labels = c("1:1", glue::glue("Average {primary_rank}"))) #+ + #ggplot2::guide_legend(override.aes = list(linetype = c(2,3))) message(crayon::green(sprintf("Generating Correlation Plot comparing %s for %s with color based on %s", crayon::bgWhite(comp_title), crayon::bgWhite(primary_rank), crayon::bgWhite(secondary_rank)))) corrs[[comp_title]] <- corr } @@ -109,7 +136,7 @@ correlation_plot <- function(obj, primary_rank, secondary_rank = TRUE, #' @title Get Multiple Correlation Plots #' @description This function allows the user to create a list of multiple correlation plots. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param primary_ranks A vector of primary ranks used to label the points. #' @param secondary_ranks The secondary rank used to color the points. Can be an integer specifying #' the number of supertaxon ranks above the primary rank or the name of a supertaxon rank. Default: TRUE @@ -172,7 +199,7 @@ correlation_plots <- function(obj, primary_ranks, secondary_ranks = TRUE, ...) { #' @title Get Correlation Plot Data #' @description Get the correlation plot data comparing all of the treatment groups. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param primary_rank A primary rank used to label the points. #' @param secondary_rank The secondary rank used to color the points, Default: TRUE #' @param wp_value The wilcoxon p-value cutoff/threshold, Default: 0.05 @@ -189,7 +216,7 @@ correlation_plots <- function(obj, primary_ranks, secondary_ranks = TRUE, ...) { #' @family Visualizations #' @rdname correlation_data #' @seealso -#' \code{\link[MicrobiomeR]{agglomerate_metacoder}}, \code{\link[MicrobiomeR]{vlookup}} +#' \code{\link[MicrobiomeR]{agglomerate_taxmap}}, \code{\link[MicrobiomeR]{vlookup}} #' #' \code{\link[dplyr]{tidyeval}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr]{filter}}, \code{\link[dplyr]{arrange}} #' @@ -201,11 +228,11 @@ correlation_plots <- function(obj, primary_ranks, secondary_ranks = TRUE, ...) { correlation_data <- function(obj, primary_rank, secondary_rank = TRUE, wp_value = 0.05) { # Quotes quoted_str <- dplyr::enquo(secondary_rank) - # Create the primary metacoder object - primary_mo <- agglomerate_metacoder(obj = obj, rank = primary_rank, + # Create the primary Taxmap object + primary_mo <- agglomerate_taxmap(obj = obj, rank = primary_rank, validated = TRUE) - # Create the secondary metacoder object - secondary_mo <- agglomerate_metacoder(obj = obj, rank = secondary_rank, + # Create the secondary Taxmap object + secondary_mo <- agglomerate_taxmap(obj = obj, rank = secondary_rank, validated = TRUE) # Get the primary and secondary statistical-taxonomy data frame primary_data <- primary_mo$data$stats_tax_data @@ -241,8 +268,8 @@ correlation_data <- function(obj, primary_rank, secondary_rank = TRUE, wp_value dplyr::mutate(label = ifelse(Significance == TRUE, ifelse(sign(log2_mean_ratio) == 1, TRUE, TRUE), FALSE)) # Update points with 0 values so they look good on the plot - p_d$mean_treat1[p_d$mean_treat1 == 0] <- 0.000000001 - p_d$mean_treat2[p_d$mean_treat2 == 0] <- 0.000000001 + #p_d$mean_treat1[p_d$mean_treat1 == 0] <- 0.000000001 + #p_d$mean_treat2[p_d$mean_treat2 == 0] <- 0.000000001 # Create a label for the legend rank_label <- sprintf("%s_label", primary_rank) diff --git a/R/heat-tree.R b/R/heat-tree.R index 89bdd0b..b823be4 100644 --- a/R/heat-tree.R +++ b/R/heat-tree.R @@ -1,7 +1,9 @@ #' @title Get Heat Tree Plots #' @description A function for getting multiple heat_tree plots per rank. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param rank_list A vector of ranks used to generate heat_trees. Default: NULL +#' @param title Can be a logical, NULL, or a string. The string can utilize `{rank}` to dynamically +#' display the rank in the title via \code{\link[glue]{glue}}. #' @param ... Any of the \code{\link[metacoder]{heat_tree}} parameters can be used to change the way the heat_tree #' output is displayed. Please see the \code{\link[MicrobiomeR]{heat_tree_parameters}} documentation #' for further explanation. @@ -24,7 +26,7 @@ #' @seealso #' \code{\link[metacoder]{heat_tree}} #' -#' \code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{heat_tree_parameters}} +#' \code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{heat_tree_parameters}} #' #' \code{\link[taxa]{filter_obs}} #' @@ -36,7 +38,8 @@ #' @importFrom metacoder heat_tree #' @importFrom ggplot2 theme element_text ggtitle #' @importFrom crayon green bgWhite -heat_tree_plots <- function(obj, rank_list = NULL, ...) { +#' @importFrom glue glue +heat_tree_plots <- function(obj, rank_list = NULL, title = TRUE, ...) { suppressWarnings({ rank_index <- pkg.private$rank_index if (is.null(rank_list)) { @@ -45,8 +48,8 @@ heat_tree_plots <- function(obj, rank_list = NULL, ...) { returned_data <- list() htrees <- list() flt_taxmaps <- list() - # Create a metacoder object from a phyloseq/metacoder/RData file - obj <- create_metacoder(obj) + # Create a Taxmap object from a phyloseq/metacoder/RData file + obj <- create_taxmap(obj) obj <- validate_MicrobiomeR_format( obj = obj, valid_formats = c("analyzed_format"), @@ -59,10 +62,20 @@ heat_tree_plots <- function(obj, rank_list = NULL, ...) { supertaxa = TRUE, reassign_obs = FALSE) flt_taxmaps[[rank]] <- filtered_obj - title <- sprintf("Bacterial Abundance (%s Level)", rank) - message(crayon::green(sprintf("Generating a Heat Tree for %s", crayon::bgWhite(title)))) + if (is.logical(title)) { + if (title == TRUE) { + title_param <- sprintf("Bacterial Abundance (%s Level)", rank) + } else { + title_param <- "" + } + } else if (is.null(title)) { + title_param <- title + } else if (is.character(title)) { + title_param <- glue::glue(title) + } + message(crayon::green(sprintf("Generating a Heat Tree for %s", crayon::bgWhite(title_param)))) treatment_no <- length(unique(filtered_obj$data$sample_data$TreatmentGroup)) - default_heat_tree_parameters <- heat_tree_parameters(obj = filtered_obj, title = title, treatment_no = treatment_no, ...) + default_heat_tree_parameters <- heat_tree_parameters(obj = filtered_obj, title = title_param, treatment_no = treatment_no, ...) # Filter by Taxonomy Rank and then create a heat tree. if (treatment_no == 2) { htrees[[rank]] <- do.call(what = metacoder::heat_tree, args = default_heat_tree_parameters) @@ -88,14 +101,14 @@ heat_tree_plots <- function(obj, rank_list = NULL, ...) { #' @title Get Heat Tree Parameters #' @description This function get's the parameters used for the heat_tree_plots function. -#' @param obj A metacoder object. +#' @param obj A Taxmap object. #' @param title The title used in the heat_tree plot. #' @param treatment_no The number of treatment groups in the data. #' @param ... Any of the heat tree parameters list below can be used to change the way the heat_tree #' output is displayed. However, this function acts as a default list of parameters. The memebers #' of the default list will be overridden by the dot parameters. Any variable in obj$data$stats_tax_data #' can be used to manipulate the heat tree parameters. Function calls from the taxa package must -#' be done explicitely on the metacoder object. +#' be done explicitely on the Taxmap object. #' @return A list used with do.call and the metacoder::heat_tree function. #' @pretty_print TRUE #' @export @@ -206,7 +219,7 @@ heat_tree_parameters <- function(obj, title, treatment_no, ...) { ## The node labels are relevant to significant taxon names. node_size = n_obs, node_color = log2_mean_ratio, - node_label = ifelse(wilcox_p_value < 0.05, taxon_names, NA), + node_label = ifelse(is_root, taxon_names, ifelse(wilcox_p_value < 0.05, taxon_names, NA)), node_label_size = 1, ### The color red indicates higher abundance in Treatment_1 animals ### The color blue indicates higher abundance in Treatment_2 animals diff --git a/R/metacoder-formatting.R b/R/metacoder-formatting.R index 60bc5d1..cb9d051 100644 --- a/R/metacoder-formatting.R +++ b/R/metacoder-formatting.R @@ -1,6 +1,6 @@ #' @title Which MicrobiomeR Format -#' @description A function for looking at a metacoder object and returning the identified MicrobiomeR format. -#' @param obj A Taxmap/metacoder object. +#' @description A function for looking at a Taxmap object and returning the identified MicrobiomeR format. +#' @param obj A Taxmap object. #' @return If the format is verified it returns a character string denoting the identified format. #' @pretty_print TRUE #' @details This function is used to get basic information about the format of the taxmap object @@ -35,10 +35,10 @@ which_format <- function(obj) { other_flag <- any(c(raw_flag, basic_flag, analyzed_flag)) if (!other_flag) { message(crayon::yellow("Your object is in the phyloseq format!")) - message(crayon::yellow("Please format your metacoder object to continue analysis.")) + message(crayon::yellow("Please format your Taxmap object to continue analysis.")) return("phyloseq_format") } else { - message(crayon::yellow(sprintf("The table names in the metacoder object are: %s", paste(table_names, collapse = ", ")))) + message(crayon::yellow(sprintf("The table names in the Taxmap object are: %s", paste(table_names, collapse = ", ")))) message(crayon::yellow("You have a mix between phyloseq format and other format.")) return("mixed_format") } @@ -51,7 +51,7 @@ which_format <- function(obj) { } else if (raw_flag) { return("raw_format") } else { - warning(crayon::red(sprintf("The table names in the metacoder object are: %s", paste(table_names, collapse = ", ")))) + warning(crayon::red(sprintf("The table names in the Taxmap object are: %s", paste(table_names, collapse = ", ")))) warning(crayon::red("The object is not in a recognized format.")) return("unknown_format") } @@ -59,7 +59,7 @@ which_format <- function(obj) { #' @title Is Raw MicrobiomeR Format #' @description This function returns a logical based on weather or not the object is in the raw_format. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @return A logical (TRUE/FALSE). #' @pretty_print TRUE #' @details The "raw_format" is Level 1. in the [MicrobiomeR_Formats] hierarchy. @@ -90,7 +90,7 @@ is_raw_format <- function(obj) { #' @title Is Basic MicrobiomeR Format #' @description This function returns a logical based on weather or not the object is in the basic_format. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @return A logical (TRUE/FALSE). #' @pretty_print TRUE #' @details The "basic_format" is Level 2. in the [MicrobiomeR_Formats] hierarchy. @@ -121,7 +121,7 @@ is_basic_format <- function(obj) { #' @title Is Analyzed MicrobiomeR Format #' @description This function returns a logical based on weather or not the object is in the analyzed_format. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @return A logical (TRUE/FALSE). #' @pretty_print TRUE #' @details The "analyzed_format" is Level 3. in the [MicrobiomeR_Formats] hierarchy. @@ -153,7 +153,7 @@ is_analyzed_format <- function(obj) { #' @title Is Phyloseq MicrobiomeR Format #' @description This function returns a logical based on weather or not the object is in the phyloseq_format. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @return A logical (TRUE/FALSE). #' @pretty_print TRUE #' @details The "phyloseq_format" is Level 0. in the [MicrobiomeR_Formats] hierarchy. @@ -183,8 +183,8 @@ is_phyloseq_format <- function(obj) { } #' @title Order Metacoder Observation Data -#' @description A function for changing the order of the observation data in a metacoder object -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @description A function for changing the order of the observation data in a Taxmap object +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @return A taxmap object with observation data in the proper order for downstream analysis. #' @pretty_print TRUE #' @details Changes the order of the observation tables in \strong{metacoder_object$data} to @@ -195,14 +195,14 @@ is_phyloseq_format <- function(obj) { #' @rdname order_metacoder_data #' @importFrom crayon silver order_metacoder_data <- function(obj) { - obj <- create_metacoder(obj = obj) + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() # Create list of expected table names expected_names <- pkg.private$format_table_list$expected_table_order - # Create vector that contains expected tables names already in the metacoder object + # Create vector that contains expected tables names already in the Taxmap object table_order <- names(expected_names[names(expected_names) %in% names(mo_clone$data)]) - # Get the table names that aren't expected but in the metacoder object + # Get the table names that aren't expected but in the Taxmap object other_names <- names(mo_clone$data)[!names(mo_clone$data) %in% c(expected_names)] table_order <- c(table_order, other_names) mo_clone$data <- mo_clone$data[table_order] @@ -211,8 +211,8 @@ order_metacoder_data <- function(obj) { } #' @title Validate MicrobiomeR Format -#' @description This funciton validates that taxmap/metacoder objects are in a valid format MicrobiomeR format. -#' @param obj A Taxmap/metacoder object. +#' @description This funciton validates that Taxmap objects are in a valid format MicrobiomeR format. +#' @param obj A Taxmap object. #' @param validated This parameter provides a way to override validation steps. Use carefully. Default: FALSE #' @param valid_formats A vector of formats that are used for validation. #' @param force_format A logical denoting if the selected format is to be forced. Default: FALSE @@ -220,7 +220,7 @@ order_metacoder_data <- function(obj) { #' This is particularly useful if you provide multiple \emph{valid_formats}. Min will choose the lowest #' level format, while max will choose the highest level format. Default: base::max #' @param ... An optional list of parameters to use in \code{\link[MicrobiomeR]{as_MicrobiomeR_format}}. -#' @return If the object is validated, a Taxmap/metacoder object. +#' @return If the object is validated, a Taxmap object. #' @details This function can provide a way to check if a taxmap object has undergone a #' \code{\link[MicrobiomeR:MicrobiomeR_Workflow]{MicrobiomeR Style Workflow}}. #' @export @@ -246,19 +246,19 @@ validate_MicrobiomeR_format <- function(obj, validated = FALSE, valid_formats, f rank_list <- c(rank_list, format_list[[v_fmt]]) high_rank <- ifelse(format_list[[v_fmt]] >= min_or_max(rank_list), v_fmt, high_rank) } - message(crayon::yellow(glue::glue("Forcing the metacoder object from the ", crayon::bgWhite(crayon::red({fmt})), " to the ", + message(crayon::yellow(glue::glue("Forcing the Taxmap object from the ", crayon::bgWhite(crayon::red({fmt})), " to the ", crayon::bgWhite(crayon::green({high_rank})),"."))) mo_clone <- as_MicrobiomeR_format(obj = mo_clone, format = high_rank, ...) return(mo_clone) } else { - stop(glue::glue("The metacoder object is not in one of the valid formats: {valid_formats}." )) + stop(glue::glue("The Taxmap object is not in one of the valid formats: {valid_formats}." )) } } #' @title As Raw MicrobiomeR Format -#' @description Converts a metacoder object to the raw_format. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. -#' @return A Taxmap/metacoder object in the "raw_format". +#' @description Converts a Taxmap object to the raw_format. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. +#' @return A Taxmap object in the "raw_format". #' @pretty_print TRUE #' @details See the [MicrobiomeR_Formats] documentation. #' @export @@ -268,7 +268,7 @@ validate_MicrobiomeR_format <- function(obj, validated = FALSE, valid_formats, f #' \code{\link[MicrobiomeR]{is_phyloseq_format}}, \code{\link[MicrobiomeR]{is_raw_format}}, \code{\link[MicrobiomeR]{order_metacoder_data}} #' @importFrom crayon silver red greem as_raw_format <- function(obj) { - obj <- create_metacoder(obj = obj) + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() if (is_phyloseq_format(mo_clone) == TRUE) { mo_clone$data$otu_abundance <- mo_clone$data$otu_table @@ -286,11 +286,11 @@ as_raw_format <- function(obj) { } #' @title As Basic MicrobiomeR Format -#' @description Converts a metacoder object to the basic_format. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @description Converts a Taxmap object to the basic_format. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param cols Column names used for \code{\link[metacoder]{calc_taxon_abund}}. Default: NULL #' @param out_names Column names of the output used for \code{\link[metacoder]{calc_obs_props}}. Default: NULL -#' @return A Taxmap/metacoder object in the "basic_format". +#' @return A Taxmap object in the "basic_format". #' @pretty_print TRUE #' @details See the [MicrobiomeR_Formats] documentation. #' @export @@ -303,9 +303,9 @@ as_raw_format <- function(obj) { #' @importFrom metacoder calc_taxon_abund calc_obs_props #' @importFrom crayon red green silver as_basic_format <- function(obj, cols = NULL, out_names = NULL) { - obj <- create_metacoder(obj = obj) + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() - # Convert the metacoder object up the heirarchy of formants. + # Convert the Taxmap object up the heirarchy of formants. if (is_phyloseq_format(mo_clone) == TRUE) { mo_clone <- as_raw_format(obj = mo_clone) } @@ -347,14 +347,14 @@ as_basic_format <- function(obj, cols = NULL, out_names = NULL) { #' @title As Analyzed MicrobiomeR Format -#' @description Converts a metacoder object to the analyzed_format. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @description Converts a Taxmap object to the analyzed_format. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param cols Column names used for \code{\link[metacoder]{calc_taxon_abund}}. Default: NULL #' @param groups Group names used for \code{\link[metacoder]{compare_groups}}. Default: NULL #' @param comp_func A Comparison based function used in \code{\link[metacoder]{compare_groups}}. Default: NULL #' @param combinations Combinations of treatments used in \code{\link[metacoder]{compare_groups}}. Default: NULL #' @param out_names Column names of the output used for \code{\link[metacoder]{calc_obs_props}}. Default: NULL -#' @return A Taxmap/metacoder object in the "analyzed_format". +#' @return A Taxmap object in the "analyzed_format". #' @pretty_print TRUE #' @details See the [MicrobiomeR_Formats] documentation. #' @export @@ -371,9 +371,9 @@ as_basic_format <- function(obj, cols = NULL, out_names = NULL) { #' @importFrom dplyr rename right_join #' @importFrom crayon silver red green as_analyzed_format <- function(obj, cols = NULL, groups = NULL, combinations = NULL, out_names = NULL, comp_func = metacoder_comp_func_1) { - obj <- create_metacoder(obj = obj) + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() - # Convert the metacoder object up the heirarchy of formants. + # Convert the Taxmap object up the heirarchy of formants. if (is_phyloseq_format(mo_clone)) { mo_clone <- as_raw_format(obj = mo_clone) } @@ -423,23 +423,23 @@ as_analyzed_format <- function(obj, cols = NULL, groups = NULL, combinations = N #' @title As MicrobiomeR Format -#' @description Converts a metacoder object to the specified format. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @description Converts a Taxmap object to the specified format. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param format The name of the format to convert the object to. #' @param ... An optional list of parameters to use in the as_*_format function specified #' by the format parameter. -#' @return A Taxmap/metacoder object in the specified format. +#' @return A Taxmap object in the specified format. #' @pretty_print TRUE #' @details See the [MicrobiomeR_Formats] documentation. #' @export #' @family Formatting #' @rdname as_MicrobiomeR_format #' @seealso -#' \code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{as_raw_format}}, \code{\link[MicrobiomeR]{as_basic_format}}, \code{\link[MicrobiomeR]{as_analyzed_format}}, \code{\link[MicrobiomeR]{as_phyloseq_format}}, \code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{order_metacoder_data}} +#' \code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{as_raw_format}}, \code{\link[MicrobiomeR]{as_basic_format}}, \code{\link[MicrobiomeR]{as_analyzed_format}}, \code{\link[MicrobiomeR]{as_phyloseq_format}}, \code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{order_metacoder_data}} #' @importFrom glue glue #' @importFrom crayon silver green red as_MicrobiomeR_format <- function(obj, format, ...) { - obj <- create_metacoder(obj = obj) + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() current_format <- which_format(mo_clone) if (format != current_format) { @@ -465,21 +465,21 @@ as_MicrobiomeR_format <- function(obj, format, ...) { #' @title As Phyloseq MicrobiomeR Format -#' @description Converts the metacoder object to the phyloseq_format. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @description Converts the Taxmap object to the phyloseq_format. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param otu_table The name of the observation table with OTU data. Default: NULL #' @param tax_data The name of the observation table with taxonomic annotations. Default: NULL #' @param sample_data The name of the observation table with metadata. Default: NULL #' @param phy_tree The name of the observation data with the phylogenetic tree. Default: NULL -#' @return A Taxmap/metacoder object in the phyloseq_format. +#' @return A Taxmap object in the phyloseq_format. #' @details See the [MicrobiomeR_Formats] documentation. #' @export #' @family Formatting #' @rdname as_phyloseq_format #' @seealso -#' \code{\link[MicrobiomeR]{create_metacoder}},\code{\link[MicrobiomeR]{order_metacoder_data}} +#' \code{\link[MicrobiomeR]{create_taxmap}},\code{\link[MicrobiomeR]{order_metacoder_data}} as_phyloseq_format <- function(obj, otu_table="otu_abundance", tax_data="otu_annotations", sample_data="sample_data", phy_tree="phy_tree") { - obj <- create_metacoder(obj = obj) + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() if (!is.null(otu_table)) { mo_clone$data$otu_table <- mo_clone$data[otu_table] @@ -502,27 +502,27 @@ as_phyloseq_format <- function(obj, otu_table="otu_abundance", tax_data="otu_ann } #' @title As Custom MicrobiomeR Format -#' @description A function for formatting metacoder objects in the MicrobiomeR format. This function +#' @description A function for formatting Taxmap objects in the MicrobiomeR format. This function #' attempts to give more customization than the as_*_format functions. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param format The name of the format to convert the object to. #' @param change_name_list A list with names of the tables in the observation data, that have matching #' values that are used to change the names of the table. Default: NULL #' @param ... An optional list of parameters to use in the as_*_format function specified -#' @return A metacoder object that we have tried to format with all of our heart. +#' @return A Taxmap object that we have tried to format with all of our heart. #' @pretty_print TRUE -#' @details This function is meant to be more helpful for customizing the metacoder object. +#' @details This function is meant to be more helpful for customizing the Taxmap object. #' @export #' @family Formatting #' @rdname as_custom_format #' @seealso -#' \code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{order_metacoder_data}}, \code{\link[MicrobiomeR]{as_MicrobiomeR_format}} +#' \code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{order_metacoder_data}}, \code{\link[MicrobiomeR]{as_MicrobiomeR_format}} #' @importFrom glue glue #' @importFrom crayon red as_custom_format <- function(obj, format, change_name_list = NULL, ...) { - # Metacoder Objects - obj <- create_metacoder(obj = obj) + # Taxmap Objects + obj <- create_taxmap(obj = obj) mo_clone <- obj$clone() fmt <- which_format(obj = mo_clone) # Get table lists and vectors @@ -547,7 +547,7 @@ as_custom_format <- function(obj, format, change_name_list = NULL, ...) { stop(glue::glue(crayon::red("None of the parameters that you've given are in your observation data: {bad_table_names}"))) } else { - stop(glue::glue(crayon::red("You have given some bad table names that aren't in you metacoder object: + stop(glue::glue(crayon::red("You have given some bad table names that aren't in you Taxmap object: {bad_table_names}"))) } } diff --git a/R/metacoder.R b/R/metacoder.R index 13fddbe..47964cb 100644 --- a/R/metacoder.R +++ b/R/metacoder.R @@ -1,13 +1,13 @@ -#' @title Filter Samples Ids from Metacoder Objects +#' @title Filter Samples Ids from Taxmap Objects #' @description This function provides a flexible way to filter unwanted samples from the #' \emph{"otu_abundance"} and \emph{"sample_data"} observations of a MicrobiomeR formatted object. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @param .f_transform A function used for transforming the data. Default: NULL #' @param .f_filter A function used for summarising the data like 'sum' or 'mean'. Default: NULL #' @param .f_condition A function that takes the summarised data and applied a condition like x > 10000. Default: NULL #' @param validated This parameter provides a way to override validation steps. Use carefully. Default: FALSE #' @param ... An optional list of parameters to use in the .f_filter function specified -#' @return Returns a metacoder object with samples that pass the filters. +#' @return Returns a Taxmap object with samples that pass the filters. #' @details Get the samples to keep by using purr and the user supplied transform and filter + condition formulas. #' The purr packge allows the use of anonymous functions as described in the link below: #' @@ -19,10 +19,10 @@ #' library(MicrobiomeR) #' library(metacoder) #' library(taxa) -#' # Convert Phyloseq object to metacoder object +#' # Convert Phyloseq object to Taxmap object #' metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_silva_2, format = "raw_format") #' -#' # Remove Archaea from the metacoder object +#' # Remove Archaea from the Taxmap object #' metacoder_obj <- filter_taxa( #' obj = metacoder_obj, #' taxon_names == "Archaea", @@ -76,7 +76,7 @@ sample_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_cond purrr::keep(~ . == TRUE) %>% names() # Determine which samples to keep - # Update the otu_abundance and sample_data in the metacoder object by removing samples + # Update the otu_abundance and sample_data in the Taxmap object by removing samples other_vars <- abund_data %>% dplyr::select_if(function(x) is.numeric(x) == FALSE) %>% colnames() #%>% purrr::discard(~.=="taxon_id") mo_clone$data$otu_abundance <- dplyr::select(abund_data, c(other_vars, samples_to_keep)) mo_clone$data$sample_data <- mo_clone$data$sample_data %>% dplyr::filter(sample_id %in% samples_to_keep) @@ -86,11 +86,11 @@ sample_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_cond } } -#' @title Filter Taxon Ids from Metacoder Objects +#' @title Filter Taxon Ids from Taxmap Objects #' @description This function provides a flexible way to filter unwanted taxon_ids from the taxmap object and from the #' observations of a MicrobiomeR formatted object. #' @inheritParams sample_id_filter -#' @return Returns a metacoder object with taxon_ids that pass the filters. +#' @return Returns a Taxmap object with taxon_ids that pass the filters. #' @pretty_print TRUE #' @details Get the taxon_ids to keep by using purr and the user supplied transform and filter + condition formulas. #' The purr packge allows the use of anonymous functions as described in the link below: @@ -102,10 +102,10 @@ sample_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_cond #' library(MicrobiomeR) #' library(metacoder) #' library(taxa) -#' # Convert Phyloseq object to metacoder object +#' # Convert Phyloseq object to Taxmap object #' metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") #' -#' # Remove Archaea from the metacoder object +#' # Remove Archaea from the Taxmap object #' metacoder_obj <- filter_taxa( #' obj = metacoder_obj, #' taxon_names == "Archaea", @@ -170,11 +170,11 @@ taxon_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_condi } } -#' @title Filter OTU Ids from Metacoder Objects +#' @title Filter OTU Ids from Taxmap Objects #' @description This function provides a flexible way to filter unwanted otu_ids from the taxmap object and from the #' observations of a MicrobiomeR formatted object. #' @inheritParams sample_id_filter -#' @return Returns a metacoder object with otu_ids that pass the filters. +#' @return Returns a taxmap object with otu_ids that pass the filters. #' @pretty_print TRUE #' @details Get the otu_ids to keep by using purr and the user supplied transform and filter + condition formulas. #' The purr packge allows the use of anonymous functions as described in the link below: @@ -188,8 +188,11 @@ taxon_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_condi #' library(MicrobiomeR) #' otu_proportion_filter <- function(obj, otu_percentage = 0.00005, validated = FALSE) { #' mo_clone <- obj$clone() -#' mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, valid_formats = c("raw_format", "basic_format"), -#' force_format = TRUE, validated = validated, min_or_max = min) +#' mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, +#' valid_formats = c("raw_format", "basic_format"), +#' force_format = TRUE, +#' validated = validated, +#' min_or_max = min) #' # Filter OTU ids #' mo_clone <- otu_id_filter(obj = mo_clone, #' .f_transform = ~./sum(.), @@ -251,11 +254,11 @@ otu_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_conditi } } -#' @title Agglomerate Metacoder Objects +#' @title Agglomerate taxmap Objects #' @description A function similar to the \code{\link[phyloseq:tax_glom]{phyloseq::tax_glom}} function, #' that assembles abundance data at a specified rank. This removes subtaxa and reassigns the #' values at the specified rank. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @param rank The rank that will be agllomerated to. #' @param validated This parameter provides a way to override validation steps. Use carefully. Default: FALSE #' @return A taxmap object that has been agglomerated at the specified rank. @@ -269,14 +272,14 @@ otu_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_conditi #' # however, they can be easily generated with \code{\link{MicrobiomeR}{as_basic_format}}. #' library(MicrobiomeR) #' basic_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "basic_format") -#' phylum_obj <- agglomerate_metacoder(obj = basic_silva, rank = "Phylum") -#' class_obj <- agglomerate_metacoder(obj = basic_silva, rank = "Class") -#' order_obj <- agglomerate_metacoder(obj = basic_silva, rank = "Order") +#' phylum_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Phylum") +#' class_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Class") +#' order_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Order") #' } #' } #' @export #' @family Advanced Metacoder Filters -#' @rdname agglomerate_metacoder +#' @rdname agglomerate_taxmap #' @seealso #' \code{\link[taxa]{filter_taxa}} #' @@ -284,7 +287,7 @@ otu_id_filter <- function(obj, .f_transform = NULL, .f_filter = NULL, .f_conditi #' @importFrom taxa filter_taxa taxon_ranks #' @importFrom glue glue #' @importFrom crayon silver -agglomerate_metacoder <- function(obj, rank, validated = FALSE) { +agglomerate_taxmap <- function(obj, rank, validated = FALSE) { mo_clone <- obj$clone() mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, valid_formats = c("raw_format", "basic_format", "analyzed_format"), force_format = TRUE, validated = validated, min_or_max = min) @@ -299,7 +302,7 @@ agglomerate_metacoder <- function(obj, rank, validated = FALSE) { #' @title OTU Proportion FIlter #' @description This function filters OTU values from the observation data and the taxmap object #' based on a minimum proportional mean across samples per OTU. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @param otu_percentage The minimum percentage used to compare against the proportional OTU mean. Default: 5e-05 #' @param validated This parameter provides a way to override validation steps. Use carefully. Default: FALSE #' @return Returns a taxmap object that contains otu_ids that have passed the above filter. @@ -313,10 +316,10 @@ agglomerate_metacoder <- function(obj, rank, validated = FALSE) { #' library(metacoder) #' library(taxa) #' -#' # Convert Phyloseq object to metacoder object +#' # Convert Phyloseq object to taxmap object #' metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") #' -#' # Remove Archaea from the metacoder object +#' # Remove Archaea from the Taxmap object #' metacoder_obj <- filter_taxa( #' obj = metacoder_obj, #' taxon_names == "Archaea", @@ -356,7 +359,7 @@ otu_proportion_filter <- function(obj, otu_percentage = 0.00005, validated = FAL #' @title OTU Prevalence Filter #' @description This function filters observations by thier prevelance across samples. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @param minimum_abundance The minimum abundance needed per observation per sample. Default: 5 #' @param rel_sample_percentage The percentage of samples per observation that meet the minimum abundance. Default: 0.5 #' @param validated This parameter provides a way to override validation steps. Use carefully. Default: FALSE @@ -372,10 +375,10 @@ otu_proportion_filter <- function(obj, otu_percentage = 0.00005, validated = FAL #' library(metacoder) #' library(taxa) #' -#' # Convert Phyloseq object to metacoder object +#' # Convert Phyloseq object to taxmap object #' metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") #' -#' # Remove Archaea from the metacoder object +#' # Remove Archaea from the taxmap object #' metacoder_obj <- filter_taxa( #' obj = metacoder_obj, #' taxon_names == "Archaea", @@ -435,7 +438,7 @@ otu_prevalence_filter <- function(obj, minimum_abundance = 5, rel_sample_percent #' @title Taxonomic Prevalence Filter (Metacoder) #' @description This function filters observations at a specific rank by thier prevelance across samples. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @param rank The rank being analyzed for prevalence across samples. #' @param minimum_abundance The minimum abundance needed per observation per sample. Default: 5 #' @param rel_sample_percentage The percentage of samples per observation that meet the minimum abundance. Default: 0.5 @@ -452,10 +455,10 @@ otu_prevalence_filter <- function(obj, minimum_abundance = 5, rel_sample_percent #' library(metacoder) #' library(taxa) #' -#' # Convert Phyloseq object to metacoder object +#' # Convert Phyloseq object to taxmap object #' metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") #' -#' # Remove Archaea from the metacoder object +#' # Remove Archaea from the taxmap object #' metacoder_obj <- filter_taxa( #' obj = metacoder_obj, #' taxon_names == "Archaea", @@ -513,7 +516,7 @@ taxa_prevalence_filter <- function(obj, rank, minimum_abundance = 5, rel_sample_ min_or_max = min, valid_formats = c("basic_format")) # Calculate the ids that need to be removed based on taxonomic rank suppressMessages({ - ids_to_remove <- agglomerate_metacoder(obj = mo_clone, rank = rank, validated = TRUE) %>% # Agglomeration + ids_to_remove <- agglomerate_taxmap(obj = mo_clone, rank = rank, validated = TRUE) %>% # Agglomeration metacoder::calc_prop_samples("taxa_abundance", more_than = minimum_abundance) %>% # Calculate sample proportions per taxa with min abundance dplyr::filter(n_samples < rel_sample_percentage) # Filter samples with less than the relative sample percentage # Taxonomic Prevalence Filtering @@ -527,7 +530,7 @@ taxa_prevalence_filter <- function(obj, rank, minimum_abundance = 5, rel_sample_ #' @title Coefficient of Variation Filter #' @description This function filters OTUs that have a variance higher than the #' specified CoV. -#' @param obj A Taxmap/metacoder object. +#' @param obj A Taxmap object. #' @param coefficient_of_variation The maximum CoV that an OTU can have. #' @param validated This parameter provides a way to override validation steps. Use carefully. Default: FALSE #' @return Returns a taxmap object that contains otu_ids that have passed the above filter. @@ -542,10 +545,10 @@ taxa_prevalence_filter <- function(obj, rank, minimum_abundance = 5, rel_sample_ #' library(metacoder) #' library(taxa) #' -#' # Convert Phyloseq object to metacoder object +#' # Convert Phyloseq object to taxmap object #' metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") #' -#' # Remove Archaea from the metacoder object +#' # Remove Archaea from the taxmap object #' metacoder_obj <- filter_taxa( #' obj = metacoder_obj, #' taxon_names == "Archaea", diff --git a/R/ordination.R b/R/ordination.R index b9eaef1..36cd530 100644 --- a/R/ordination.R +++ b/R/ordination.R @@ -1,6 +1,6 @@ #' @title Ordination Plot #' @description This function allows for ordination (which helps us to distinguish beta diversity relationships) to be plotted as well as for the corresponding data to be returned. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param method Choose an ordination method from 'PCoA', 'CCA', 'NMDS' or 'DPCoA', Default: 'PCoA' #' @param distance Choose a distance method from 'bray', 'unifrac' or 'wunifrac', Default: 'wunifrac' #' @param color Choose the group or factor of which colors will be mapped to, Default: 'TreatmentGroup' @@ -26,11 +26,11 @@ #' @importFrom ggplot2 element_text geom_point theme element_blank guide_legend guides ggtitle unit scale_fill_manual labs scale_color_manual ordination_plot <- function(obj, method = "PCoA", distance = "wunifrac", color = "TreatmentGroup", title = NULL, only_data = FALSE) { metacoder_object <- validate_MicrobiomeR_format( - obj = create_metacoder(obj), + obj = create_taxmap(obj), valid_formats = c("analyzed_format") ) - # Convert metacoder object to a phyloseq object. + # Convert taxmap object to a phyloseq object. phyloseq_object <- metacoder::as_phyloseq(metacoder_object, otu_table = "otu_abundance", phy_tree = "phy_tree") # Find out how many groups are in the "color" metadata @@ -81,13 +81,16 @@ ordination_plot <- function(obj, method = "PCoA", distance = "wunifrac", color = #' @title Ordination Plots #' @description Generate plots for a list of ordination methods and distances. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param methods A list of ordination methods, Default: 'c("PCoA", "NMDS")' #' @param distances A list of distance methods, Default: 'c("wunifrac", "unifrac", "bray")' +#' @param color Choose the group or factor of which colors will be mapped to, Default: 'TreatmentGroup' +#' @param select_otu_table The data table to use in the observation data. Default: "otu_proportions" #' @return Returns a melted dataframe. +#' @export #' @family Visualizations +#' @rdname ordination_plots #' @rdname ordination_plot -#' @export ordination_plots <- function(obj, methods = c("PCoA", "NMDS"), distances = c("wunifrac", "unifrac", "bray"), color = "TreatmentGroup", select_otu_table = "otu_proportions") { if (is.null(methods)) { diff --git a/R/palettes.R b/R/palettes.R index 16fba01..fad0b3b 100644 --- a/R/palettes.R +++ b/R/palettes.R @@ -134,8 +134,13 @@ viridis_palette <- function(viridis_palette="viridis", viridis_number=800, virid #' if(interactive()){ #' # Below is the code for the viridis_magma_palette function. #' # It's a good example of how to use the combination_palette function. -#' viridis_magma_palette <- function(viridis_number = 800, viridis_range = 300:viridis_number, viridis_rev = TRUE, -#' magma_number = 500, magma_range = 0:magma_number, magma_rev = FALSE, ...) { +#' viridis_magma_palette <- function(viridis_number = 800, +#' viridis_range = 300:viridis_number, +#' viridis_rev = TRUE, +#' magma_number = 500, +#' magma_range = 0:magma_number, +#' magma_rev = FALSE, +#' ...) { #' if (!missing(...)){ #' v_args = list(n=viridis_number, ...) #' m_args = list(n=magma_number, ...) diff --git a/R/permanova.R b/R/permanova.R index 419c8eb..fd922eb 100644 --- a/R/permanova.R +++ b/R/permanova.R @@ -1,6 +1,6 @@ #' @title PERMANOVA #' @description Evaluate whether the group(s) has a significant effect on overall gut microbiota composition. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @param distance_method Use a desired distance method, Default: 'bray' #' @param group The group or column in the metadata to test upon, Default: 'TreatmentGroup' #' @return Returns a list which includes permanova, anova, coefficients, and top coefficients. @@ -25,12 +25,12 @@ permanova <- function(obj, distance_method = "bray", group = "TreatmentGroup") { # Validate data format metacoder_object <- validate_MicrobiomeR_format( - obj = create_metacoder(obj), + obj = create_taxmap(obj), valid_formats = c("analyzed_format") ) permanova <- list() - # Convert metacoder object to a phyloseq object. + # Convert taxmap object to a phyloseq object. phyloseq_object <- metacoder::as_phyloseq(metacoder_object, otu_table = "otu_abundance", phy_tree = "phy_tree") # TODO: Convert this to metacoder strictly. diff --git a/R/phyloseq.R b/R/phyloseq.R index febce28..f2e35a6 100644 --- a/R/phyloseq.R +++ b/R/phyloseq.R @@ -37,7 +37,10 @@ #' parse_func <- parse_parse_taxonomy_silva_128 #' } #' # Create a phyloseq object from the data files. -#' phy_obj <- create_phyloseq(biom_file = biom_file, tree_file = tree_file, metadata_file = md_file, parse_func = parse_func) +#' phy_obj <- create_phyloseq(biom_file = biom_file, +#' tree_file = tree_file, +#' metadata_file = md_file, +#' parse_func = parse_func) #' } #' @export #' @family Data Importers @@ -257,7 +260,8 @@ root_by_longest_edge <- function(unrooted_tree) { #' then please comment on the GitHub PR to encourage merging this feature. #' @examples \dontrun{ #' -#' > taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales", "f__Staphylococcaceae") +#' > taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales", +#' "f__Staphylococcaceae") #' > parse_taxonomy_default(taxvec1) #' > parse_taxonomy_greengenes(taxvec1) #' > taxvec2 = c("Root;k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Staphylococcaceae") @@ -266,10 +270,6 @@ root_by_longest_edge <- function(unrooted_tree) { #' > parse_taxonomy_silva_128(taxvec3) #' } #' @export -#' @usage parse_taxonomy_default(char.vec) -#' parse_taxonomy_greengenes(char.vec) -#' parse_taxonomy_silva_128(char.vec) -#' parse_taxonomy_qiime(char.vec) #' @rdname parse_taxonomy_silva_128 #' @seealso #' \code{\link[phyloseq:parseTaxonomy-functions]{parse_taxonomy_default}} diff --git a/R/utils.R b/R/utils.R index c8e589a..6bf176f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,5 +1,5 @@ -#' @title Get Metacoder Object -#' @description A function that handles the conversion of objects to metacoder (\strong{taxa::taxmap}) objects. +#' @title Get Taxmap Object +#' @description A function that handles the conversion of objects to Taxmap (\strong{taxa::taxmap}) objects. #' @param obj An object that contains the data being analyzed. Can be one of the following: #' \describe{ #' \item{Phyloseq Object}{An object generated from the phyloseq package.} @@ -16,12 +16,12 @@ #' if(interactive()){ #' library(MicrobiomeR) #' phy_obj <- MicrobiomeR::phyloseq_silva_2 -#' mc_obj <- create_metacoder(phy_obj) +#' mc_obj <- create_taxmap(phy_obj) #' } #' } #' @export #' @family Data Importers -#' @rdname create_metacoder +#' @rdname create_taxmap #' @seealso #' \code{\link[metacoder]{parse_phyloseq}} #' @@ -29,7 +29,7 @@ #' @importFrom metacoder parse_phyloseq #' @importFrom tools file_ext #' @importFrom crayon red -create_metacoder <- function(obj) { +create_taxmap <- function(obj) { if (is.null(obj)) { stop(crayon::red("Please use a metacoder/phyloseq object or an rdata file.")) } else { @@ -51,7 +51,7 @@ create_metacoder <- function(obj) { #' @title Get Treatment Matrix #' @description A function that returns a matrix with used for comparing treatment data. -#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}. +#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}. #' @return A matrix with each column representing a comparison to be made. #' @pretty_print TRUE #' @details Use this when you want to do pairwise comparisons. @@ -167,9 +167,9 @@ output_dir <- function(start_path=NULL, experiment=NULL, plot_type=NULL, end_pat if (mkdir == TRUE) { answer_flag <- FALSE if (dir.exists(full_path) && overwrite == FALSE) { - stop(glue::glue("The directory {full_path} already exists. And you don't want to overwrite the directory.")) + warning(glue::glue("The directory {full_path} already exists. And you don't want to overwrite the directory.")) } else if (dir.exists(full_path) && overwrite == TRUE) { - message(glue::glue(crayon::yellow("You have chosen to overwrite the directory: {full_path}."))) + warning(glue::glue(crayon::yellow("You have chosen to overwrite the directory: {full_path}."))) while (answer_flag == FALSE) { answer <- readline(prompt = crayon::blue("Are you sure? (Y/N)")) if (stringr::str_to_lower(answer) == "y") { @@ -248,7 +248,7 @@ transposer <- function(.data, ids = NULL, header_name, preserved_categories = TR message(crayon::yellow(sprintf("There were no ids given. Defaulting to the first column: %s", ids))) } # Get numeric data (columns) - num_cols <- input %>% dplyr::select_if(is.numeric) %>% dplyr::select_if(!names(.) %in% ids) %>% colnames() + num_cols <- input %>% dplyr::select_if(is.numeric) %>% purrr::keep(!names(.) %in% ids) %>% colnames() # Transform if (preserved_categories == TRUE) { # All categorical data is preserved @@ -337,7 +337,7 @@ transformer <- function(.data, func, by = "column", ids = NULL, header_name = NU input <- input %>% transposer(ids = ids, header_name = header_name, preserved_categories = preserved_categories) } # Get numeric column names - num_cols <- input %>% dplyr::select_if(is.numeric) %>% dplyr::select_if(!names(.) %in% ids) %>% colnames() + num_cols <- input %>% dplyr::select_if(is.numeric) %>% purrr::keep(!names(.) %in% ids) %>% colnames() # Get all other columsn as preserved columns preserved_categories <- input %>% dplyr::select(-dplyr::one_of(num_cols)) %>% colnames() # Transform data @@ -393,7 +393,6 @@ vlookup <- function(lookup_vector, df, match_var, return_var) { #' } #' } #' @rdname create_pub_table -#' @seealso #' #' @importFrom ggpubr ggtexttable ttheme colnames_style tbody_style create_pub_table <- function(dataframe) { diff --git a/README.md b/README.md index 5f1d87c..51d6f9b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ library(devtools) # Load the devtools package install_github("vallenderlab/MicrobiomeR") # Install the package ``` +Please visit https://microbiomer.vallenderlab.science/ for extensive documentation of the package. + ## Workflow Features - Standardization of data wrangling. diff --git a/_pkgdown.yml b/_pkgdown.yml index 765e763..4d2d6fe 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,3 +1,4 @@ +url: https://microbiomer.vallenderlab.science/ template: params: bootswatch: yeti @@ -28,8 +29,10 @@ navbar: href: articles/analysis.html - text: "Color Palettes" href: articles/color-palettes.html - - text: "Reference" + - text: "Functions" href: reference/index.html + - text: "Publication" + href: articles/paper.html - text: "Changelog" href: news/index.html right: diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index 169bd5f..a8ca7b1 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -155,7 +158,7 @@

    Contributor Code of Conduct

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index 30cd84b..f0a7db5 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -205,7 +208,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/ISSUE_TEMPLATE.html b/docs/ISSUE_TEMPLATE.html index c4ac28c..cd9f2d3 100644 --- a/docs/ISSUE_TEMPLATE.html +++ b/docs/ISSUE_TEMPLATE.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@

  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    NA

    Brief description of the problem

    - +
    # insert reprex here

    @@ -162,7 +165,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index acc2665..b875664 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -168,7 +171,7 @@

    License

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/PULL_REQUEST_TEMPLATE.html b/docs/PULL_REQUEST_TEMPLATE.html index 3fba7bb..3570ebc 100644 --- a/docs/PULL_REQUEST_TEMPLATE.html +++ b/docs/PULL_REQUEST_TEMPLATE.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -201,7 +204,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/Microbiome-Workflow.png b/docs/articles/Microbiome-Workflow.png new file mode 100644 index 0000000..2a9e2bd Binary files /dev/null and b/docs/articles/Microbiome-Workflow.png differ diff --git a/docs/articles/about.html b/docs/articles/about.html index 4ed5914..6a01a44 100644 --- a/docs/articles/about.html +++ b/docs/articles/about.html @@ -31,7 +31,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -65,7 +65,10 @@

  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -140,7 +143,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/analysis.html b/docs/articles/analysis.html index f4a6e2e..9297d2e 100644 --- a/docs/articles/analysis.html +++ b/docs/articles/analysis.html @@ -31,7 +31,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -65,7 +65,10 @@

  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -102,7 +105,7 @@

    Data Analysis

    Rob Gilmore & Shaurita Hutchins

    -

    2019-02-13

    +

    2019-02-27

    Source: vignettes/analysis.Rmd @@ -115,128 +118,128 @@

    2019-02-13

    Data Import & Wrangling

    Beginning an microbiome analysis starts with importing data and wrangling it into a proper format.

    - +
    # Get the data files from package
    +input_files <- pkg.data$input_files
    +biom_file <- input_files$biom_files$silva # Path to silva biom file
    +tree_file <- input_files$tree_files$silva # Path to silva tree file
    +metadata_file <- input_files$metadata$two_groups # Path to Nephele metadata
    +parse_func <- parse_taxonomy_silva_128 # A custom phyloseq parsing function for silva annotations
    +
    +# Get the phyloseq object
    +phy_obj <- create_phyloseq(biom_file = biom_file, 
    +                                    tree_file = tree_file, 
    +                                    metadata_file = metadata_file,
    +                                    parse_func = parse_func)
    +
    +# Get the taxmap object in the raw format
    +raw_metacoder <- as_MicrobiomeR_format(obj = phy_obj, format = "raw_format")

    Filtering Data

    After importing data and formatting it, data should be filtered to reduce noise and if desired, to subset data.

    -
    # Remove Archaea from the metacoder object
    -metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder,
    -                                   taxon_names == "Archaea",
    -                                   subtaxa = TRUE,
    -                                   invert = TRUE)
    -
    -# Ambiguous Annotation Filter - Remove taxonomies with ambiguous names
    -metacoder_obj <- metacoder::filter_ambiguous_taxa(metacoder_obj, 
    -                                                  subtaxa = TRUE)
    -
    -# Low Sample Filter - Remove the low samples
    -# The sample filter should generally be implemented first
    -metacoder_obj <- sample_id_filter(obj = metacoder_obj,
    -                               .f_filter = ~sum(.),
    -                               .f_condition = ~.>= 20, 
    -                               validated = TRUE)
    -
    -# Master Threshold Filter - Add the otu_proportions table and then filter OTUs based on min %
    -metacoder_obj <- otu_proportion_filter(obj = metacoder_obj,
    -                                       otu_percentage = 0.00001)
    -
    -# Taxon Prevalence Filter - Add taxa_abundance and taxa_proportions and then filter OTUs that do not
    -# appear more than a certain amount of times in a certain percentage of samples at the specified
    -# agglomerated rank.  This is considered a supervised method, because it relies on intermediate
    -# taxonomies to filter the data.
    -# The default minimum abundance is 5 and the sample percentage is 0.5 (5%).
    -# Phylum
    -metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    -                                        rank = "Phylum")
    -# Class
    -metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    -                                        rank = "Class", 
    -                                        validated = TRUE)
    -# Order
    -metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    -                                        rank = "Order", 
    -                                        validated = TRUE)
    -
    -# OTU Prevalence Filter - Filter OTUs that do not appear more than a certian amount of times in a
    -# certain percentage of samples.  This is considered an unsupervised method, because it relies only
    -# on the leaf OTU ids to filter the data.
    -metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, 
    -                                       validated = TRUE)
    -
    -# Coefficient of Variation Filter - Filter OTUs based on the coefficient of variation
    -metacoder_obj <- cov_filter(obj = metacoder_obj,
    -                            coefficient_of_variation = 3, 
    -                            validated = TRUE)
    +
    # Remove Archaea from the taxmap object
    +metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder,
    +                                   taxon_names == "Archaea",
    +                                   subtaxa = TRUE,
    +                                   invert = TRUE)
    +
    +# Ambiguous Annotation Filter - Remove taxonomies with ambiguous names
    +metacoder_obj <- metacoder::filter_ambiguous_taxa(metacoder_obj, 
    +                                                  subtaxa = TRUE)
    +
    +# Low Sample Filter - Remove the low samples
    +# The sample filter should generally be implemented first
    +metacoder_obj <- sample_id_filter(obj = metacoder_obj,
    +                               .f_filter = ~sum(.),
    +                               .f_condition = ~.>= 20, 
    +                               validated = TRUE)
    +
    +# Master Threshold Filter - Add the otu_proportions table and then filter OTUs based on min %
    +metacoder_obj <- otu_proportion_filter(obj = metacoder_obj,
    +                                       otu_percentage = 0.00001)
    +
    +# Taxon Prevalence Filter - Add taxa_abundance and taxa_proportions and then filter OTUs that do not
    +# appear more than a certain amount of times in a certain percentage of samples at the specified
    +# agglomerated rank.  This is considered a supervised method, because it relies on intermediate
    +# taxonomies to filter the data.
    +# The default minimum abundance is 5 and the sample percentage is 0.5 (5%).
    +# Phylum
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Phylum")
    +# Class
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Class", 
    +                                        validated = TRUE)
    +# Order
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Order", 
    +                                        validated = TRUE)
    +
    +# OTU Prevalence Filter - Filter OTUs that do not appear more than a certian amount of times in a
    +# certain percentage of samples.  This is considered an unsupervised method, because it relies only
    +# on the leaf OTU ids to filter the data.
    +metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, 
    +                                       validated = TRUE)
    +
    +# Coefficient of Variation Filter - Filter OTUs based on the coefficient of variation
    +metacoder_obj <- cov_filter(obj = metacoder_obj,
    +                            coefficient_of_variation = 3, 
    +                            validated = TRUE)

    Analysis

    Analysis is primarily done with metacoder, MicrobiomeR, and ggplot2. Before beginning the analysis it’s wise to create an output directory. Use end_path=FALSE with MicrobiomeR’s output_dir() function to avoid the creation of a date formatted directory.

    -
    # Create a directory for whichever plot you want to save
    -heat_tree_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "heat_tree")
    -corr_plot_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "correlation")
    -sb_plot_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "stacked_barplot")
    -ord_plot_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "ordination")
    +
    # Create a directory for whichever plot you want to save
    +heat_tree_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "heat_tree")
    +corr_plot_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "correlation")
    +sb_plot_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "stacked_barplot")
    +ord_plot_path <- output_dir(end_path = FALSE, start_path = "output", plot_type = "ordination")

    Statistical Analysis

    Statistical analysis is primarily done with the help of metacoder style functions such as the calc_*() group of functions, and compare_groups(). The taxa function taxonomy_table() is also useful for matching stats with the proper taxonomic annotation. MicrobiomeR creates the proper tables with as_MicrobiomeR_format(format = "analyzed_format", ...).

    - +
    # Get the statistical observation data.
    +metacoder_obj <- as_MicrobiomeR_format(obj = metacoder_obj, format = "analyzed_format")

    In addition to standard statistical analysis provided by metacoder, MicrobiomeR simplifies alpha diversity, ordination, and PERMANOVA analysis.

    - - - +
    # Generate alpha diversity measures
    +measures <- alpha_diversity_measures(obj = metacoder_obj)
    +measures$Shannon
    +#>  [1] 5.977645 5.807758 5.924257 5.651563 5.712745 5.677156 6.107177
    +#>  [8] 5.263318 6.040767 5.963451 6.011352 6.238364 6.061033 6.213808
    +#> [15] 6.111409 5.930385 5.638817 5.670399 5.665353 5.949696 6.213651
    +#> [22] 5.674047 6.053098 5.818605 6.134535 6.175986 5.681311 5.892901
    +#> [29] 5.561349 6.118321 6.033960 4.994411 6.048751 5.474699 6.004132
    +#> [36] 5.720120 5.309873 5.752245 5.526904 5.698600 5.380529 5.641993
    +#> [43] 5.469683 5.868113 5.453688 5.777398 5.952376 4.249344
    +
    # Get only ordination data for the first Axis based on principal coordinates analysis using weighted unifrac.
    +ordination <- ordination_plot(obj = metacoder_obj, method = "PCoA", distance = "wunifrac", only_data = TRUE)
    +ordination$Axis.1
    +#>  [1]  0.1480991727 -0.0530880826  0.1192335362 -0.1045700493  0.0491129449
    +#>  [6]  0.1265867917 -0.0345322993 -0.1174505365 -0.0377552818 -0.0927269385
    +#> [11] -0.0235620393  0.0008706629 -0.0723557471 -0.0282243478  0.0740555158
    +#> [16] -0.0524377243 -0.1037144750 -0.1418732833 -0.1202257911  0.0617099739
    +#> [21] -0.0390451135 -0.0432635870 -0.0058600684 -0.0552540161  0.0415570399
    +#> [26] -0.0462610529  0.2380605736  0.1145329575  0.0690412299 -0.0336046151
    +#> [31] -0.0495665644  0.1856307251 -0.0617423548  0.1775513193  0.2054672317
    +#> [36] -0.0777818491  0.0076295756 -0.1458834521  0.0797228129 -0.0696594057
    +#> [41] -0.0257490009 -0.1183574855 -0.0721215576  0.0042024229  0.1547426859
    +#> [46]  0.1580175051 -0.0155816171 -0.1735763413
    +
    # Generate permanova statistics for data
    +permanova <- permanova(obj = metacoder_obj, group = "TreatmentGroup")
    +permanova$permanova$aov.tab
    +#> Permutation: free
    +#> Number of permutations: 99
    +#> 
    +#> Terms added sequentially (first to last)
    +#> 
    +#>                Df SumsOfSqs MeanSqs F.Model     R2 Pr(>F)   
    +#> TreatmentGroup  1    0.7051 0.70506  4.8736 0.0958   0.01 **
    +#> Residuals      46    6.6548 0.14467         0.9042          
    +#> Total          47    7.3598                 1.0000          
    +#> ---
    +#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

    @@ -247,131 +250,131 @@

    Analyzing Two “Treatment” Groups

    -
    # Generate heat_trees
    -heat_tree_plots <- heat_tree_plots(metacoder_obj,
    -                                       rank_list = c("Phylum", "Class", "Order"),
    -                                       node_label = ifelse(wilcox_p_value > 0.05, taxon_ids, NA),
    -                                       node_label_size = 2,
    -                                       node_label_color = c("darkgreen"))
    -names(heat_tree_plots)
    -#> [1] "metacoder_object" "heat_trees"       "taxmaps"
    -
    -# Generate correlation_plots
    -corr_plots <- correlation_plots(metacoder_obj, primary_ranks = c("Phylum", "Class", "Order"))
    -names(corr_plots)
    -#> [1] "Phylum" "Class"  "Order"
    -
    -
    -# Generate stacked_barplots
    -sb_plots <- stacked_barplots(metacoder_obj, tax_levels = c("Phylum", "Class", "Order"))
    -names(sb_plots)
    -#> [1] "Phylum" "Class"  "Order"
    -
    # Save plots with a custom output path
    -save_heat_tree_plots(htrees = heat_tree_plots, custom_path = heat_tree_path)
    -save_correlation_plots(corr = corr_plots, custom_path = corr_plot_path)
    -save_stacked_barplots(sb_plots = sb_plots, custom_path = sb_plot_path)
    -save_ordination_plots(ord_plots = ordination, custom_path = ord_plot_path)
    - +
    # Generate heat_trees
    +heat_tree_plots <- heat_tree_plots(metacoder_obj,
    +                                       rank_list = c("Phylum", "Class", "Order"),
    +                                       node_label = ifelse(wilcox_p_value > 0.05, taxon_ids, NA),
    +                                       node_label_size = 2,
    +                                       node_label_color = c("darkgreen"))
    +names(heat_tree_plots)
    +#> [1] "metacoder_object" "heat_trees"       "taxmaps"
    +
    +# Generate correlation_plots
    +corr_plots <- correlation_plots(metacoder_obj, primary_ranks = c("Phylum", "Class", "Order"))
    +names(corr_plots)
    +#> [1] "Phylum" "Class"  "Order"
    +
    +
    +# Generate stacked_barplots
    +sb_plots <- stacked_barplots(metacoder_obj, tax_levels = c("Phylum", "Class", "Order"))
    +names(sb_plots)
    +#> [1] "Phylum" "Class"  "Order"
    +
    # Save plots with a custom output path
    +save_heat_tree_plots(htrees = heat_tree_plots, custom_path = heat_tree_path)
    +save_correlation_plots(corr = corr_plots, custom_path = corr_plot_path)
    +save_stacked_barplots(sb_plots = sb_plots, custom_path = sb_plot_path)
    +save_ordination_plots(ord_plots = ordination, custom_path = ord_plot_path)
    +
    # View the Phylum level heat tree
    +heat_trees <- heat_tree_plots$heat_trees
    +heat_trees$Phylum

    - +
    # View the Phylum level correlation plot
    +corr_plots$Phylum
    +#> $Kingdom
    +#> $Kingdom$`Exp_Var1-vs-Control`

    - +
    # View the Phylum level stacked barplot
    +sb_plots$Phylum

    Analyzing More than 2 “Treatment” Groups

    -
    # Heat Trees
    -input_files <- pkg.data$input_files
    -metadata_file <- input_files$metadata$three_groups
    -biom_file <- input_files$biom_files$silva # Path to silva biom file
    -tree_file <- input_files$tree_files$silva # Path to silva tree file
    -parse_func <- parse_taxonomy_silva_128 # A custom phyloseq parsing function for silva annotations
    -
    -# Get the phyloseq object
    -phy_obj <- create_phyloseq(biom_file = biom_file, 
    -                                    tree_file = tree_file, 
    -                                    metadata_file = metadata_file,
    -                                    parse_func = parse_func)
    -
    -# Get the taxmap object in the raw format
    -raw_metacoder <- as_MicrobiomeR_format(obj = phy_obj, format = "raw_format")
    -# Remove Archaea from the metacoder object
    -metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder,
    -                                   taxon_names == "Archaea",
    -                                   subtaxa = TRUE,
    -                                   invert = TRUE)
    -
    -# Ambiguous Annotation Filter - Remove taxonomies with ambiguous names
    -metacoder_obj <- metacoder::filter_ambiguous_taxa(metacoder_obj, 
    -                                                  subtaxa = TRUE)
    -
    -# Low Sample Filter - Remove the low samples
    -# The sample filter should generally be implemented first
    -metacoder_obj <- sample_id_filter(obj = metacoder_obj,
    -                               .f_filter = ~sum(.),
    -                               .f_condition = ~.>= 20, 
    -                               validated = TRUE)
    -
    -# Master Threshold Filter - Add the otu_proportions table and then filter OTUs based on min %
    -metacoder_obj <- otu_proportion_filter(obj = metacoder_obj,
    -                                       otu_percentage = 0.00001)
    -
    -# Taxon Prevalence Filter - Add taxa_abundance and taxa_proportions and then filter OTUs that do not
    -# appear more than a certian amount of times in a certain percentage of samples at the specified
    -# agglomerated rank.  This is considered a supervised method, because it relies on intermediate
    -# taxonomies to filter the data.
    -# The default minimum abundance is 5 and the sample percentage is 0.5 (5%).
    -# Phylum
    -metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    -                                        rank = "Phylum")
    -# Class
    -metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    -                                        rank = "Class", 
    -                                        validated = TRUE)
    -# Order
    -metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    -                                        rank = "Order", 
    -                                        validated = TRUE)
    -
    -# OTU Prevalence Filter - Filter OTUs that do not appear more than a certian amount of times in a
    -# certain percentage of samples.  This is considered an unsupervised method, because it relies only
    -# on the leaf OTU ids to filter the data.
    -metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, 
    -                                       validated = TRUE)
    -
    -# Coefficient of Variation Filter - Filter OTUs based on the coefficient of variation
    -metacoder_obj <- cov_filter(obj = metacoder_obj,
    -                            coefficient_of_variation = 3, 
    -                            validated = TRUE)
    -metacoder_obj <- as_MicrobiomeR_format(obj = metacoder_obj, format = "analyzed_format")
    -
    -# Generate heat_trees
    -heat_tree_plots <- heat_tree_plots(metacoder_obj,
    -                                       rank_list = c("Phylum", "Class", "Order"),
    -                                       node_label = ifelse(wilcox_p_value < 0.05, taxon_ids, NA),
    -                                       node_label_size = 2,
    -                                       node_label_color = c("darkgreen"))
    -
    -heat_trees <- heat_tree_plots$heat_trees
    -heat_trees$Phylum
    +
    # Heat Trees
    +input_files <- pkg.data$input_files
    +metadata_file <- input_files$metadata$three_groups
    +biom_file <- input_files$biom_files$silva # Path to silva biom file
    +tree_file <- input_files$tree_files$silva # Path to silva tree file
    +parse_func <- parse_taxonomy_silva_128 # A custom phyloseq parsing function for silva annotations
    +
    +# Get the phyloseq object
    +phy_obj <- create_phyloseq(biom_file = biom_file, 
    +                                    tree_file = tree_file, 
    +                                    metadata_file = metadata_file,
    +                                    parse_func = parse_func)
    +
    +# Get the taxmap object in the raw format
    +raw_metacoder <- as_MicrobiomeR_format(obj = phy_obj, format = "raw_format")
    +# Remove Archaea from the taxmap object
    +metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder,
    +                                   taxon_names == "Archaea",
    +                                   subtaxa = TRUE,
    +                                   invert = TRUE)
    +
    +# Ambiguous Annotation Filter - Remove taxonomies with ambiguous names
    +metacoder_obj <- metacoder::filter_ambiguous_taxa(metacoder_obj, 
    +                                                  subtaxa = TRUE)
    +
    +# Low Sample Filter - Remove the low samples
    +# The sample filter should generally be implemented first
    +metacoder_obj <- sample_id_filter(obj = metacoder_obj,
    +                               .f_filter = ~sum(.),
    +                               .f_condition = ~.>= 20, 
    +                               validated = TRUE)
    +
    +# Master Threshold Filter - Add the otu_proportions table and then filter OTUs based on min %
    +metacoder_obj <- otu_proportion_filter(obj = metacoder_obj,
    +                                       otu_percentage = 0.00001)
    +
    +# Taxon Prevalence Filter - Add taxa_abundance and taxa_proportions and then filter OTUs that do not
    +# appear more than a certian amount of times in a certain percentage of samples at the specified
    +# agglomerated rank.  This is considered a supervised method, because it relies on intermediate
    +# taxonomies to filter the data.
    +# The default minimum abundance is 5 and the sample percentage is 0.5 (5%).
    +# Phylum
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Phylum")
    +# Class
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Class", 
    +                                        validated = TRUE)
    +# Order
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Order", 
    +                                        validated = TRUE)
    +
    +# OTU Prevalence Filter - Filter OTUs that do not appear more than a certian amount of times in a
    +# certain percentage of samples.  This is considered an unsupervised method, because it relies only
    +# on the leaf OTU ids to filter the data.
    +metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, 
    +                                       validated = TRUE)
    +
    +# Coefficient of Variation Filter - Filter OTUs based on the coefficient of variation
    +metacoder_obj <- cov_filter(obj = metacoder_obj,
    +                            coefficient_of_variation = 3, 
    +                            validated = TRUE)
    +metacoder_obj <- as_MicrobiomeR_format(obj = metacoder_obj, format = "analyzed_format")
    +
    +# Generate heat_trees
    +heat_tree_plots <- heat_tree_plots(metacoder_obj,
    +                                       rank_list = c("Phylum", "Class", "Order"),
    +                                       node_label = ifelse(wilcox_p_value < 0.05, taxon_ids, NA),
    +                                       node_label_size = 2,
    +                                       node_label_color = c("darkgreen"))
    +
    +heat_trees <- heat_tree_plots$heat_trees
    +heat_trees$Phylum

    -
    
    -
    -# Generate Correlation plots
    -corr_plots <- correlation_plots(metacoder_obj, primary_ranks = c("Phylum", "Class", "Order"))
    -
    -corr_plots$Class$Phylum$`Exp_Var2-vs-Exp_Var1`
    +
    
    +
    +# Generate Correlation plots
    +corr_plots <- correlation_plots(metacoder_obj, primary_ranks = c("Phylum", "Class", "Order"))
    +
    +corr_plots$Class$Phylum$`Exp_Var2-vs-Exp_Var1`

    - +
    corr_plots$Class$Phylum$`Exp_Var2-vs-Control`

    - +
    corr_plots$Class$Phylum$`Exp_Var1-vs-Control`

    @@ -404,7 +407,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-10-1.png index 0ef743f..77ac16f 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-10-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-11-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-11-1.png index d0a133f..ff36e62 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-11-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-11-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-12-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-12-1.png index 7a64ac9..9063af7 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-12-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-12-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-1.png index 5c838a0..0179220 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-2.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-2.png index 2da290e..f5fe855 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-2.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-2.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-3.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-3.png index ac66db2..949da42 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-3.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-3.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-4.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-4.png index 1448e8d..44cfb52 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-13-4.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-13-4.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-7-1.png index e2accc4..4fb1f9e 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-7-2.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-7-2.png index 41cb952..8e2c2c8 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-7-2.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-7-2.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-7-3.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-7-3.png index 81d4bf9..8b69e9c 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-7-3.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-7-3.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-8-1.png index 5083c71..ff36e62 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-8-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-8-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-8-2.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-8-2.png index 727309a..3d54068 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-8-2.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-8-2.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-8-3.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-8-3.png index 3cfdd59..bca657a 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-8-3.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-8-3.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-1.png index 9da347b..d8dce1e 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-1.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-2.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-2.png index ee4ce55..f997935 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-2.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-2.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-3.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-3.png index 3417c25..3ef437e 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-3.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-3.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-4.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-4.png index 5c56464..f5fe855 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-4.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-4.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-5.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-5.png index fa01e1e..949da42 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-5.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-5.png differ diff --git a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-6.png b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-6.png index 9cce121..44cfb52 100644 Binary files a/docs/articles/analysis_files/figure-html/unnamed-chunk-9-6.png and b/docs/articles/analysis_files/figure-html/unnamed-chunk-9-6.png differ diff --git a/docs/articles/color-palettes.html b/docs/articles/color-palettes.html index cd43ec5..31b5e4a 100644 --- a/docs/articles/color-palettes.html +++ b/docs/articles/color-palettes.html @@ -31,7 +31,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -65,7 +65,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -102,7 +105,7 @@

    Using Color Palettes

    Rob Gilmore & Shaurita Hutchins

    -

    2019-02-13

    +

    2019-02-27

    Source: vignettes/color-palettes.Rmd @@ -119,59 +122,59 @@

    Getting a Color Palette

    Getting a color palette is simple. You can toggle the palette preview with display=FALSE.

    - +
    analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format")
    +data <- analyzed_silva$data$stats_tax_data$Phylum
    +data_len <- length(unique(data))
    +custom_pal <- get_color_palette(color_no=data_len)

    - +
    print(custom_pal)
    +#>  [1] "#FDE725" "#D3E21A" "#A6DB35" "#7BD150" "#55C667" "#30B47B" "#218E8D"
    +#>  [8] "#1E1149" "#471078" "#762181" "#A6317D" "#D8456B" "#F7725C" "#FEA26E"
    +#> [15] "#FECF92" "#FCFDBF"

    Scico

    We have built in support for the scico package.

    -
    basic_pal <- scico_palette(scico_palette="hawaii")(25)
    -pie(rep(1, length(basic_pal)), col=basic_pal)
    +
    basic_pal <- scico_palette(scico_palette="hawaii")(25)
    +pie(rep(1, length(basic_pal)), col=basic_pal)

    - +
    print(basic_pal)
    +#>  [1] "#8C0172" "#8E1468" "#90255C" "#92344F" "#944344" "#96513B" "#985E31"
    +#>  [8] "#9A6C28" "#9C7B20" "#9C8A1C" "#9A9B1E" "#95A92A" "#8EB53B" "#86BE4E"
    +#> [15] "#7DC562" "#74CC75" "#6CD38A" "#64D89D" "#5FDEB0" "#5FE3C2" "#66E8D4"
    +#> [22] "#78EDE5" "#8CEFEF" "#A0F1F8" "#B2F2FD"
    +better_pal <- get_color_palette(pal_func = scico_palette, color_no = 25)

    - +
    print(better_pal)
    +#>  [1] "#001959" "#07275C" "#0D365D" "#144660" "#1C5561" "#2B625C" "#3B6B55"
    +#>  [8] "#49704E" "#5B7645" "#6C7B3C" "#7E8032" "#8C852E" "#9F892D" "#B38D32"
    +#> [15] "#C7913D" "#DA954D" "#E9995E" "#F49E71" "#F9A384" "#FCAA98" "#FCB0AB"
    +#> [22] "#FCB7BE" "#FDBED0" "#FCC4E4" "#F9CCF9"

    Viridis

    We also provide support for the viridis package.

    Typically, you’d use the viridis palette like we do below.

    -
    basic_pal <- viridis::viridis(n=25, option="magma")
    -pie(rep(1, length(basic_pal)), col=basic_pal)
    +
    basic_pal <- viridis::viridis(n=25, option="magma")
    +pie(rep(1, length(basic_pal)), col=basic_pal)

    - +
    print(basic_pal)
    +#>  [1] "#000004FF" "#060517FF" "#100B2EFF" "#1D1147FF" "#2D1160FF"
    +#>  [6] "#3F0F72FF" "#51127CFF" "#611880FF" "#721F81FF" "#822681FF"
    +#> [11] "#932B80FF" "#A5317EFF" "#B63679FF" "#C73D73FF" "#D8456CFF"
    +#> [16] "#E65164FF" "#F1605DFF" "#F8735CFF" "#FB8861FF" "#FD9B6BFF"
    +#> [21] "#FEAF77FF" "#FEC287FF" "#FED799FF" "#FDEAABFF" "#FCFDBFFF"

    With MicrobiomeR, the viridis palette can be optimized.

    -
    better_pal <- get_color_palette(pal_func = viridis_palette, color_no = 25)
    -pie(rep(1, length(better_pal)), col=better_pal)
    +
    better_pal <- get_color_palette(pal_func = viridis_palette, color_no = 25)
    +pie(rep(1, length(better_pal)), col=better_pal)

    - +
    print(better_pal)
    +#>  [1] "#440154" "#470D60" "#481E6F" "#472B7A" "#443A83" "#3E4A89" "#365B8D"
    +#>  [8] "#2E6D8E" "#277F8E" "#21908C" "#1FA187" "#28AE7F" "#39BA76" "#48C16E"
    +#> [15] "#56C666" "#65CB5D" "#75D054" "#85D549" "#95D83F" "#A7DB34" "#B8DE29"
    +#> [22] "#CAE11F" "#DBE318" "#EDE51B" "#FDE725"

    @@ -180,43 +183,43 @@

    You can use any name for your arguments, but the values must be a named list. palette: This is a palette function that returns a vector of colors. args: This is another named list used for the palette function parameters. range: This is a range (1:10) used to subset the color palette vector. rev: This is a logical (TRUE/FALSE)used to reverse the color palette.

    - +
    # This is the code for MicrobiomeR::viridis_magma_palette, but
    +# it's also a useful example for understanding how this works.
    + viridis_magma_palette <- function(viridis_number = 800, 
    +                                   viridis_range = 300:viridis_number,
    +                                   viridis_rev = TRUE,
    +                                   magma_number = 500, 
    +                                   magma_range = 0:magma_number, 
    +                                   magma_rev = FALSE, 
    +                                   ...) {
    +   # Get the arguments for both functions
    +   if (!missing(...)){
    +       v_args = list(n=viridis_number, ...)
    +       m_args = list(n=magma_number, ...)
    +   } else {
    +       v_args = list(n=viridis_number)
    +       m_args = list(n=magma_number)
    +   }
    +   # Get combo palette
    +   crp <- combination_palette(viridis =
    +                                 list(palette = viridis::viridis,
    +                                       args = v_args,
    +                                       range = viridis_range,
    +                                       rev = viridis_rev),
    +                                magma =
    +                                  list(palette = viridis::magma,
    +                                       args = m_args,
    +                                       range = magma_range,
    +                                       rev = magma_rev)
    +                                )
    +     return(crp)
    + }
    +combo_palette <- get_color_palette(pal_func = viridis_magma_palette)

    - +
    combo_palette
    +#>  [1] "#FDE725" "#D9E319" "#B4DE2B" "#8FD644" "#6DCD58" "#4EC36B" "#2DB27C"
    +#>  [8] "#20938C" "#010105" "#110D30" "#2D1161" "#55137D" "#7B2382" "#A3307E"
    +#> [15] "#CE4070" "#F05F5D" "#FC8861" "#FEB078" "#FED698" "#FCFDBF"

    @@ -246,7 +249,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-1-1.png b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-1-1.png index 9ff6517..d96bb41 100644 Binary files a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-1-1.png and b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-1-1.png differ diff --git a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-1.png index 5e90471..e38ecbd 100644 Binary files a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-1.png and b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-1.png differ diff --git a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-2.png b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-2.png index 7b2260a..f9eb2b7 100644 Binary files a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-2.png and b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-2-2.png differ diff --git a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-3-1.png index 8f45dba..638b020 100644 Binary files a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-3-1.png and b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-3-1.png differ diff --git a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-4-1.png index 625b858..8d878b8 100644 Binary files a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-5-1.png index 84d5a72..e9eab48 100644 Binary files a/docs/articles/color-palettes_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/color-palettes_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/data-wrangling.html b/docs/articles/data-wrangling.html index c328685..5d866c0 100644 --- a/docs/articles/data-wrangling.html +++ b/docs/articles/data-wrangling.html @@ -31,7 +31,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -65,7 +65,10 @@

  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -102,7 +105,7 @@

    Data Wrangling

    Robert Gilmore

    -

    2019-02-13

    +

    2019-02-27

    Source: vignettes/data-wrangling.Rmd @@ -116,48 +119,48 @@

    Import

    Importing data is done via the phyloseq package. MicrobiomeR was developed by testing data from Nephele’s 16S Qiime pipeline, which will influences the workflow for these vignettes. While one can use any phyloseq object generated by phyloseq for MicrobiomeR, we suggest using the function, MicrobiomeR::create_phyloseq(), and we will demonstrate using it to import the Nephele data, which includes a biom file, a phylogenetic tree file, and the metadata file (Nephele mapping file). file.

    (Note: Test data can be found in a private environment variable called with MicrobiomeR:::pkg.private)

    - +
    # Get the data files from package
    +input_files <- pkg.data$input_files
    +biom_file <- input_files$biom_files$silva # Path to silva biom file
    +tree_file <- input_files$tree_files$silva # Path to silva tree file
    +metadata_file <- input_files$metadata$two_groups # Path to Nephele metadata
    +parse_func <- parse_taxonomy_silva_128 # A custom phyloseq parsing function for silva annotations
    +
    +# Get the phyloseq object
    +phyloseq_object <- create_phyloseq(
    +  biom_file = biom_file,
    +  tree_file = tree_file,
    +  metadata_file = metadata_file,
    +  parse_func = parse_func
    +)

    Formatting

    After importing amplicon data with phyloseq, you will need to convert the phyloseq object to a taxa::taxmap object for use with the metacoder package. MicrobiomeR has added additional “formatting” to the taxmap object in the form of specific tables names. For more information please consult the Formatting help page in your R console via ?MicrobiomeR::MicrobiomeR_Formats.

    -
    p_obj <- phyloseq_object
    -# Create the various formats
    -phy_format <- as_MicrobiomeR_format(obj = p_obj, format = "phyloseq_format")
    -raw_format <- as_MicrobiomeR_format(obj = p_obj, format = "raw_format")
    -basic_format <- as_MicrobiomeR_format(obj = p_obj, format = "basic_format")
    -analyzed_format <- as_MicrobiomeR_format(obj = p_obj, format = "analyzed_format")
    -

    The various formats that have been defined include the “phyloseq”, “raw”, “basic”, and “analyzed” formats. These formats define the level or stage that the taxmap object is in. The only difference between MicrobiomeR taxmap objects and regular taxmap objects is the naming convention used for the observation data (e.g. names(MicrobiomeR_obj$data)).

    - +
    p_obj <- phyloseq_object
    +# Create the various formats
    +phy_format <- as_MicrobiomeR_format(obj = p_obj, format = "phyloseq_format")
    +raw_format <- as_MicrobiomeR_format(obj = p_obj, format = "raw_format")
    +basic_format <- as_MicrobiomeR_format(obj = p_obj, format = "basic_format")
    +analyzed_format <- as_MicrobiomeR_format(obj = p_obj, format = "analyzed_format")
    +

    The various formats that have been defined include the “phyloseq”, “raw”, “basic”, and “analyzed” formats. These formats define the level or stage that the taxmap object is in. The only difference between MicrobiomeR taxmap objects and regular taxmap objects is the naming convention used for the observation data (e.g. names(MicrobiomeR_obj$data)).

    +
    # Show the difference in MicrobiomeR formats
    +print(names(phy_format$data))
    +#> [1] "sample_data" "phy_tree"    "otu_table"   "tax_data"
    +
    +print(names(raw_format$data))
    +#> [1] "otu_abundance"   "otu_annotations" "sample_data"     "phy_tree"
    +
    +print(names(basic_format$data))
    +#> [1] "otu_abundance"    "otu_annotations"  "otu_proportions" 
    +#> [4] "sample_data"      "phy_tree"         "taxa_abundance"  
    +#> [7] "taxa_proportions"
    +
    +print(names(analyzed_format$data))
    +#> [1] "otu_abundance"    "otu_annotations"  "otu_proportions" 
    +#> [4] "sample_data"      "phy_tree"         "taxa_abundance"  
    +#> [7] "taxa_proportions" "statistical_data" "stats_tax_data"

    MicrobiomeR provides a group of helpful functions that can be used to format taxmap objects including:

    -
    # Determine format
    -which_format(analyzed_format)
    -#> [1] "analyzed_format"
    -
    -is_analyzed_format(analyzed_format)
    -#> [1] TRUE
    -
    -# Forcing validation
    -low_level_format <- validate_MicrobiomeR_format(obj = raw_format, valid_formats = c("analyzed_format", "basic_format"), force_format = TRUE, min_or_max = min)
    -which_format(low_level_format)
    -#> [1] "basic_format"
    -
    -high_level_format <- validate_MicrobiomeR_format(obj = raw_format, valid_formats = c("analyzed_format", "basic_format"), force_format = TRUE, min_or_max = max)
    -which_format(high_level_format)
    -#> [1] "analyzed_format"
    +
    # Determine format
    +which_format(analyzed_format)
    +#> [1] "analyzed_format"
    +
    +is_analyzed_format(analyzed_format)
    +#> [1] TRUE
    +
    +# Forcing validation
    +low_level_format <- validate_MicrobiomeR_format(obj = raw_format, valid_formats = c("analyzed_format", "basic_format"), force_format = TRUE, min_or_max = min)
    +which_format(low_level_format)
    +#> [1] "basic_format"
    +
    +high_level_format <- validate_MicrobiomeR_format(obj = raw_format, valid_formats = c("analyzed_format", "basic_format"), force_format = TRUE, min_or_max = max)
    +which_format(high_level_format)
    +#> [1] "analyzed_format"

    However, most of the time you will simply use as_MicrobiomeR_format(format=...) to get an object into the proper format.

    (Please note that MicrobiomeR expects the data to be imported with phyloseq and then converted to a taxmap object)

    @@ -210,7 +213,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/filtering.html b/docs/articles/filtering.html index ff7e455..d28dd9a 100644 --- a/docs/articles/filtering.html +++ b/docs/articles/filtering.html @@ -31,7 +31,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -65,7 +65,10 @@

  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -102,7 +105,7 @@

    Filtering Data

    Robert Gilmore

    -

    2019-02-13

    +

    2019-02-27

    Source: vignettes/filtering.Rmd @@ -114,35 +117,35 @@

    2019-02-13

    Data Wrangling

    - +
    # Get the data files from package
    +input_files <- pkg.data$input_files
    +biom_file <- input_files$biom_files$silva # Path to silva biom file
    +tree_file <- input_files$tree_files$silva # Path to silva tree file
    +metadata_file <- input_files$metadata$two_groups # Path to Nephele metadata
    +parse_func <- parse_taxonomy_silva_128 # A custom phyloseq parsing function for silva annotations
    +
    +# Get the phyloseq object
    +phy_obj <- create_phyloseq(biom_file = biom_file, 
    +                           tree_file = tree_file, 
    +                           metadata_file = metadata_file,
    +                           parse_func = parse_func)
    +
    +# Get the taxmap object in the raw format
    +raw_metacoder <- as_MicrobiomeR_format(obj = phy_obj, format = "raw_format")

    Taxmap Filtering

    Metacoder is a highly useful package that comes with tons of features right out of the box. Functions such as metacoder::filter_ambiguous_taxa(), taxa::filter_taxa(), and taxa::filter_obs() for instance can almost always be used in your workflow.

    - +
    # Remove Archaea from the taxmap object
    +metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder,
    +                                   taxon_names == "Archaea",
    +                                   subtaxa = TRUE,
    +                                   invert = TRUE)
    +
    +# Ambiguous Annotation Filter - Remove taxonomies with ambiguous names
    +metacoder_obj <- metacoder::filter_ambiguous_taxa(metacoder_obj, 
    +                                                  subtaxa = TRUE)

    @@ -157,12 +160,12 @@

    otu_id_filter() for filtering by otu_id, which only includes leaf taxa.

  • These functions all take the same parameters, most noteably a transformation function (.f_transform), a filtering function (.f_filter), and a coditional function (.f_condition).

    -
    # Low Sample Filter - Remove the low samples
    -# The sample filter should generally be implemented first
    -metacoder_obj <- sample_id_filter(obj = metacoder_obj,
    -                               .f_filter = ~sum(.),
    -                               .f_condition = ~.>= 20, 
    -                               validated = TRUE)
    +
    # Low Sample Filter - Remove the low samples
    +# The sample filter should generally be implemented first
    +metacoder_obj <- sample_id_filter(obj = metacoder_obj,
    +                               .f_filter = ~sum(.),
    +                               .f_condition = ~.>= 20, 
    +                               validated = TRUE)

    @@ -170,7 +173,7 @@

    The advanced filtering functions available with MicrobiomeR do several things. They wrap the basic filtering functions mentioned above, they wrap common metacoder and taxa functions, and they mimic the tools found in the phyloseq package. Below I’ve mentioned some of them and how they relate to the phyloseq package:

    - +
    # Master Threshold Filter - Add the otu_proportions table and then filter OTUs based on min %
    +metacoder_obj <- otu_proportion_filter(obj = metacoder_obj,
    +                                       otu_percentage = 0.00001)
    +
    +# Taxon Prevalence Filter - Add taxa_abundance and taxa_proportions and then filter OTUs that do not
    +# appear more than a certian amount of times in a certain percentage of samples at the specified
    +# agglomerated rank.  This is considered a supervised method, because it relies on intermediate
    +# taxonomies to filter the data.
    +# The default minimum abundance is 5 and the sample percentage is 0.5 (5%).
    +# Phylum
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Phylum")
    +# Class
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Class", 
    +                                        validated = TRUE)
    +# Order
    +metacoder_obj <- taxa_prevalence_filter(obj = metacoder_obj,
    +                                        rank = "Order", 
    +                                        validated = TRUE)
    +
    +# OTU Prevalence Filter - Filter OTUs that do not appear more than a certian amount of times in a
    +# certain percentage of samples.  This is considered an unsupervised method, because it relies only
    +# on the leaf OTU ids to filter the data.
    +metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, 
    +                                       validated = TRUE)
    +
    +# Coefficient of Variation Filter - Filter OTUs based on the coefficient of variation
    +metacoder_obj <- cov_filter(obj = metacoder_obj,
    +                            coefficient_of_variation = 3, 
    +                            validated = TRUE)

    Other Filtering

    -

    As mentioned previously taxmap filtering can be done in any way that fits your needs with the taxa and metacoder packages. However, MicrobiomeR also provides some utility based function for filtering/manipulating your observation data by hand. Observation data can be accessed within the metacoder object. Make sure you don’t manipulate existing data inside of your taxmap object unless you’re absolutely sure you know what you’re doing.

    +

    As mentioned previously taxmap filtering can be done in any way that fits your needs with the taxa and metacoder packages. However, MicrobiomeR also provides some utility based function for filtering/manipulating your observation data by hand. Observation data can be accessed within the taxmap object. Make sure you don’t manipulate existing data inside of your taxmap object unless you’re absolutely sure you know what you’re doing.

    Transposing

    -
    # Get the abundance tables from the taxmap object
    -taxa_abund <- metacoder_obj$data$taxa_abundance
    -otu_abund <- metacoder_obj$data$otu_abundance
    -
    -# Transposing with one ID (taxon_id)
    -taxa_abund %>% transposer(ids = "taxon_id", header_name = "samples")
    -#> # A tibble: 48 x 176
    -#>    samples     ac    af    ag    ah    ai    aj    ak    al    an    ao
    -#>    <chr>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
    -#>  1 Sample~ 112582 53903  4217  4237    68 46540  1794    11  1524    51
    -#>  2 Sample~  88194 56426   480   750    23 30145    17     7    38     0
    -#>  3 Sample~  74933 39952   557  7138    21 26932    73     5    49     0
    -#>  4 Sample~  80796 41912   629  3234    14 34738   189    12     0     0
    -#>  5 Sample~ 116806 51677  1111  1207    13 62301    47    27   109    11
    -#>  6 Sample~  90122 33032   350     9     0 56274     0    11     0     0
    -#>  7 Sample~ 129778 61153  2346  2882    58 62494    12    24   338   101
    -#>  8 Sample~ 113377 45411   332  1369     3 65815   228    31    16     1
    -#>  9 Sample~ 134396 52332  3202  1560    44 76700    98    43   143    28
    -#> 10 Sample~ 112240 41003  4624   518    54 65317   276    13   300    63
    -#> # ... with 38 more rows, and 165 more variables: aq <dbl>, as <dbl>,
    -#> #   at <dbl>, av <dbl>, aw <dbl>, ay <dbl>, az <dbl>, ba <dbl>, bb <dbl>,
    -#> #   bc <dbl>, bd <dbl>, be <dbl>, bf <dbl>, bg <dbl>, bi <dbl>, bk <dbl>,
    -#> #   bl <dbl>, bm <dbl>, bo <dbl>, br <dbl>, bs <dbl>, bu <dbl>, bv <dbl>,
    -#> #   bx <dbl>, by <dbl>, bz <dbl>, cb <dbl>, cc <dbl>, ce <dbl>, cf <dbl>,
    -#> #   ch <dbl>, ci <dbl>, cj <dbl>, cl <dbl>, co <dbl>, cq <dbl>, cr <dbl>,
    -#> #   cs <dbl>, cu <dbl>, cv <dbl>, cz <dbl>, da <dbl>, dc <dbl>, dd <dbl>,
    -#> #   de <dbl>, df <dbl>, dh <dbl>, dj <dbl>, dl <dbl>, dn <dbl>, do <dbl>,
    -#> #   dq <dbl>, dr <dbl>, dt <dbl>, dx <dbl>, dy <dbl>, dz <dbl>, ea <dbl>,
    -#> #   ec <dbl>, ed <dbl>, ee <dbl>, ef <dbl>, ei <dbl>, ej <dbl>, eo <dbl>,
    -#> #   ep <dbl>, eq <dbl>, es <dbl>, et <dbl>, eu <dbl>, ex <dbl>, ey <dbl>,
    -#> #   fa <dbl>, fe <dbl>, ff <dbl>, fi <dbl>, fj <dbl>, fl <dbl>, fm <dbl>,
    -#> #   fn <dbl>, fp <dbl>, fq <dbl>, fr <dbl>, fs <dbl>, ft <dbl>, fu <dbl>,
    -#> #   fv <dbl>, fx <dbl>, fy <dbl>, fz <dbl>, ga <dbl>, gb <dbl>, gd <dbl>,
    -#> #   ge <dbl>, gf <dbl>, gg <dbl>, gh <dbl>, gj <dbl>, gk <dbl>, gl <dbl>,
    -#> #   ...
    -
    -# Re-Transposing with one ID (taxon_id)
    -taxa_abund %>% 
    -  transposer("taxon_id", "samples") %>% 
    -  transposer("samples", "taxon_id")
    -#> # A tibble: 175 x 49
    -#>    taxon_id Sample_1 Sample_10 Sample_11 Sample_12 Sample_13 Sample_14
    -#>    <chr>       <dbl>     <dbl>     <dbl>     <dbl>     <dbl>     <dbl>
    -#>  1 ac         112582     88194     74933     80796    116806     90122
    -#>  2 af          53903     56426     39952     41912     51677     33032
    -#>  3 ag           4217       480       557       629      1111       350
    -#>  4 ah           4237       750      7138      3234      1207         9
    -#>  5 ai             68        23        21        14        13         0
    -#>  6 aj          46540     30145     26932     34738     62301     56274
    -#>  7 ak           1794        17        73       189        47         0
    -#>  8 al             11         7         5        12        27        11
    -#>  9 an           1524        38        49         0       109         0
    -#> 10 ao             51         0         0         0        11         0
    -#> # ... with 165 more rows, and 42 more variables: Sample_15 <dbl>,
    -#> #   Sample_16 <dbl>, Sample_17 <dbl>, Sample_18 <dbl>, Sample_19 <dbl>,
    -#> #   Sample_2 <dbl>, Sample_20 <dbl>, Sample_21 <dbl>, Sample_22 <dbl>,
    -#> #   Sample_23 <dbl>, Sample_24 <dbl>, Sample_25 <dbl>, Sample_26 <dbl>,
    -#> #   Sample_27 <dbl>, Sample_28 <dbl>, Sample_29 <dbl>, Sample_3 <dbl>,
    -#> #   Sample_30 <dbl>, Sample_31 <dbl>, Sample_35 <dbl>, Sample_36 <dbl>,
    -#> #   Sample_4 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>, Sample_45 <dbl>,
    -#> #   Sample_46 <dbl>, Sample_47 <dbl>, Sample_5 <dbl>, Sample_50 <dbl>,
    -#> #   Sample_51 <dbl>, Sample_52 <dbl>, Sample_55 <dbl>, Sample_56 <dbl>,
    -#> #   Sample_57 <dbl>, Sample_58 <dbl>, Sample_59 <dbl>, Sample_6 <dbl>,
    -#> #   Sample_60 <dbl>, Sample_61 <dbl>, Sample_7 <dbl>, Sample_8 <dbl>,
    -#> #   Sample_9 <dbl>
    -
    -# Transposing with two IDs (taxon_id, otu_id)
    -# The column headers will be a combination of the categorical data that will
    -# be parsed and split back into individual columns if retransposed.
    -otu_abund %>% 
    -  transposer("otu_id", "samples")
    -#> # A tibble: 48 x 1,667
    -#>    samples `ac<_>DQ797054.~ `af<_>EU510171.~ `af<_>New.Clean~
    -#>    <chr>              <dbl>            <dbl>            <dbl>
    -#>  1 Sample~              130                0              108
    -#>  2 Sample~                0                4              106
    -#>  3 Sample~                0               14              152
    -#>  4 Sample~                0               57               71
    -#>  5 Sample~              119                3               34
    -#>  6 Sample~              443                2                1
    -#>  7 Sample~               15                0               74
    -#>  8 Sample~               49               14               49
    -#>  9 Sample~                0                1               12
    -#> 10 Sample~               33                1               55
    -#> # ... with 38 more rows, and 1,663 more variables:
    -#> #   `af<_>New.CleanUp.ReferenceOTU1675` <dbl>,
    -#> #   `af<_>New.CleanUp.ReferenceOTU1778` <dbl>,
    -#> #   `af<_>New.CleanUp.ReferenceOTU2195` <dbl>,
    -#> #   `af<_>New.CleanUp.ReferenceOTU6283` <dbl>,
    -#> #   `af<_>New.ReferenceOTU1018` <dbl>, `af<_>New.ReferenceOTU1460` <dbl>,
    -#> #   `af<_>New.ReferenceOTU1898` <dbl>, `af<_>New.ReferenceOTU662` <dbl>,
    -#> #   `aq<_>EU462203.1.1270` <dbl>, `aq<_>FJ881207.1.1492` <dbl>,
    -#> #   `bd<_>GQ451183.1.1507` <dbl>, `bd<_>New.CleanUp.ReferenceOTU1` <dbl>,
    -#> #   `bd<_>New.ReferenceOTU307` <dbl>, `bv<_>AF371685.1.1445` <dbl>,
    -#> #   `bv<_>EU462407.1.1376` <dbl>, `bv<_>EU469250.1.1356` <dbl>,
    -#> #   `bv<_>EU777569.1.1267` <dbl>, `bv<_>GQ448792.1.1389` <dbl>,
    -#> #   `bv<_>HQ681868.1.1479` <dbl>, `bv<_>New.CleanUp.ReferenceOTU21` <dbl>,
    -#> #   `bv<_>New.CleanUp.ReferenceOTU82` <dbl>,
    -#> #   `bv<_>New.ReferenceOTU648` <dbl>, `cf<_>AF371949.1.1454` <dbl>,
    -#> #   `cf<_>New.CleanUp.ReferenceOTU19053` <dbl>,
    -#> #   `ch<_>New.CleanUp.ReferenceOTU579` <dbl>,
    -#> #   `cq<_>AB506276.1.1515` <dbl>, `cq<_>EU467330.1.1365` <dbl>,
    -#> #   `cq<_>JQ185323.1.1351` <dbl>, `cq<_>JQ187807.1.1343` <dbl>,
    -#> #   `cq<_>KC163104.1.1515` <dbl>, `cq<_>New.CleanUp.ReferenceOTU45` <dbl>,
    -#> #   `dc<_>FJ753766.1.1449` <dbl>, `dc<_>HQ716634.1.1482` <dbl>,
    -#> #   `dc<_>JQ191107.1.1383` <dbl>,
    -#> #   `dc<_>New.CleanUp.ReferenceOTU5376` <dbl>,
    -#> #   `de<_>AB506217.1.1514` <dbl>, `de<_>DQ794395.1.1386` <dbl>,
    -#> #   `de<_>DQ801522.1.1389` <dbl>, `de<_>DQ804804.1.1390` <dbl>,
    -#> #   `de<_>DQ806210.1.1390` <dbl>, `de<_>DQ806419.1.1375` <dbl>,
    -#> #   `de<_>DQ810016.1.1387` <dbl>, `de<_>EF399608.1.1495` <dbl>,
    -#> #   `de<_>EF640147.1.1517` <dbl>, `de<_>EF640148.1.1608` <dbl>,
    -#> #   `de<_>EU462246.1.1393` <dbl>, `de<_>EU462618.1.1379` <dbl>,
    -#> #   `de<_>EU472017.1.1394` <dbl>, `de<_>EU472558.1.1391` <dbl>,
    -#> #   `de<_>EU761737.1.1355` <dbl>, `de<_>EU762031.1.1361` <dbl>,
    -#> #   `de<_>EU768267.1.1370` <dbl>, `de<_>EU774369.1.1254` <dbl>,
    -#> #   `de<_>FJ367054.1.1360` <dbl>, `de<_>FJ368433.1.1378` <dbl>,
    -#> #   `de<_>FJ372296.1.1359` <dbl>, `de<_>FJ678233.1.1439` <dbl>,
    -#> #   `de<_>FJ678914.1.1380` <dbl>, `de<_>FJ681481.1.1448` <dbl>,
    -#> #   `de<_>FJ681993.1.1389` <dbl>, `de<_>FJ681994.1.1392` <dbl>,
    -#> #   `de<_>FJ684811.1.1391` <dbl>, `de<_>FJ880611.1.1492` <dbl>,
    -#> #   `de<_>GQ135595.1.1382` <dbl>, `de<_>HQ716148.1.1427` <dbl>,
    -#> #   `de<_>HQ716567.1.1448` <dbl>, `de<_>HQ775630.1.1451` <dbl>,
    -#> #   `de<_>HQ780641.1.1454` <dbl>, `de<_>HQ781391.1.1449` <dbl>,
    -#> #   `de<_>HQ785245.1.1449` <dbl>, `de<_>HQ790863.1.1455` <dbl>,
    -#> #   `de<_>HQ792930.1.1435` <dbl>, `de<_>HQ808140.1.1436` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU1867` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU2137` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU233` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU292` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU3186` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU4248` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU446` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU451` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU509` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU574` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU66` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU7980` <dbl>,
    -#> #   `de<_>New.CleanUp.ReferenceOTU92` <dbl>,
    -#> #   `de<_>New.ReferenceOTU477` <dbl>, `df<_>AB506215.1.1522` <dbl>,
    -#> #   `df<_>DQ796118.1.1378` <dbl>, `df<_>DQ798544.1.1272` <dbl>,
    -#> #   `df<_>DQ809209.1.1280` <dbl>, `df<_>EF401803.1.1493` <dbl>,
    -#> #   `df<_>EU461642.1.1389` <dbl>, `df<_>EU462752.1.1365` <dbl>,
    -#> #   `df<_>EU771433.1.1280` <dbl>, `df<_>EU772441.1.1390` <dbl>,
    -#> #   `df<_>EU776836.1.1286` <dbl>, `df<_>EU777365.1.1388` <dbl>,
    -#> #   `df<_>EU777419.1.1375` <dbl>, `df<_>EU778354.1.1387` <dbl>, ...
    -
    -# Re-Transposing with two IDs (taxon_id, otu_id)
    -# When you transpose categorical data, the column headers are lost.
    -# To re-transpose you have to supply these headers
    -otu_abund %>% 
    -  transposer("otu_id", "samples") %>% 
    -  transposer("samples", "otu_id", 
    -             separated_categories = c("taxon_id", "otu_id"))
    -#> # A tibble: 1,666 x 50
    -#>    taxon_id otu_id Sample_1 Sample_10 Sample_11 Sample_12 Sample_13
    -#>    <chr>    <chr>     <dbl>     <dbl>     <dbl>     <dbl>     <dbl>
    -#>  1 ac       DQ797~      130         0         0         0       119
    -#>  2 af       EU510~        0         4        14        57         3
    -#>  3 af       New.C~      108       106       152        71        34
    -#>  4 af       New.C~       26         9        52         5         5
    -#>  5 af       New.C~        0         0        15        20        10
    -#>  6 af       New.C~        1         0        12        42         2
    -#>  7 af       New.C~       45        19        17        22         0
    -#>  8 af       New.R~       84        23         6         6         4
    -#>  9 af       New.R~        1         2        25        58         0
    -#> 10 af       New.R~       30        23        80        30         4
    -#> # ... with 1,656 more rows, and 43 more variables: Sample_14 <dbl>,
    -#> #   Sample_15 <dbl>, Sample_16 <dbl>, Sample_17 <dbl>, Sample_18 <dbl>,
    -#> #   Sample_19 <dbl>, Sample_2 <dbl>, Sample_20 <dbl>, Sample_21 <dbl>,
    -#> #   Sample_22 <dbl>, Sample_23 <dbl>, Sample_24 <dbl>, Sample_25 <dbl>,
    -#> #   Sample_26 <dbl>, Sample_27 <dbl>, Sample_28 <dbl>, Sample_29 <dbl>,
    -#> #   Sample_3 <dbl>, Sample_30 <dbl>, Sample_31 <dbl>, Sample_35 <dbl>,
    -#> #   Sample_36 <dbl>, Sample_4 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>,
    -#> #   Sample_45 <dbl>, Sample_46 <dbl>, Sample_47 <dbl>, Sample_5 <dbl>,
    -#> #   Sample_50 <dbl>, Sample_51 <dbl>, Sample_52 <dbl>, Sample_55 <dbl>,
    -#> #   Sample_56 <dbl>, Sample_57 <dbl>, Sample_58 <dbl>, Sample_59 <dbl>,
    -#> #   Sample_6 <dbl>, Sample_60 <dbl>, Sample_61 <dbl>, Sample_7 <dbl>,
    -#> #   Sample_8 <dbl>, Sample_9 <dbl>
    +
    # Get the abundance tables from the taxmap object
    +taxa_abund <- metacoder_obj$data$taxa_abundance
    +otu_abund <- metacoder_obj$data$otu_abundance
    +
    +# Transposing with one ID (taxon_id)
    +taxa_abund %>% transposer(ids = "taxon_id", header_name = "samples")
    +#> # A tibble: 48 x 176
    +#>    samples     ac    af    ag    ah    ai    aj    ak    al    an    ao
    +#>    <chr>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
    +#>  1 Sample~ 112582 53903  4217  4237    68 46540  1794    11  1524    51
    +#>  2 Sample~  88194 56426   480   750    23 30145    17     7    38     0
    +#>  3 Sample~  74933 39952   557  7138    21 26932    73     5    49     0
    +#>  4 Sample~  80796 41912   629  3234    14 34738   189    12     0     0
    +#>  5 Sample~ 116806 51677  1111  1207    13 62301    47    27   109    11
    +#>  6 Sample~  90122 33032   350     9     0 56274     0    11     0     0
    +#>  7 Sample~ 129778 61153  2346  2882    58 62494    12    24   338   101
    +#>  8 Sample~ 113377 45411   332  1369     3 65815   228    31    16     1
    +#>  9 Sample~ 134396 52332  3202  1560    44 76700    98    43   143    28
    +#> 10 Sample~ 112240 41003  4624   518    54 65317   276    13   300    63
    +#> # ... with 38 more rows, and 165 more variables: aq <dbl>, as <dbl>,
    +#> #   at <dbl>, av <dbl>, aw <dbl>, ay <dbl>, az <dbl>, ba <dbl>, bb <dbl>,
    +#> #   bc <dbl>, bd <dbl>, be <dbl>, bf <dbl>, bg <dbl>, bi <dbl>, bk <dbl>,
    +#> #   bl <dbl>, bm <dbl>, bo <dbl>, br <dbl>, bs <dbl>, bu <dbl>, bv <dbl>,
    +#> #   bx <dbl>, by <dbl>, bz <dbl>, cb <dbl>, cc <dbl>, ce <dbl>, cf <dbl>,
    +#> #   ch <dbl>, ci <dbl>, cj <dbl>, cl <dbl>, co <dbl>, cq <dbl>, cr <dbl>,
    +#> #   cs <dbl>, cu <dbl>, cv <dbl>, cz <dbl>, da <dbl>, dc <dbl>, dd <dbl>,
    +#> #   de <dbl>, df <dbl>, dh <dbl>, dj <dbl>, dl <dbl>, dn <dbl>, do <dbl>,
    +#> #   dq <dbl>, dr <dbl>, dt <dbl>, dx <dbl>, dy <dbl>, dz <dbl>, ea <dbl>,
    +#> #   ec <dbl>, ed <dbl>, ee <dbl>, ef <dbl>, ei <dbl>, ej <dbl>, eo <dbl>,
    +#> #   ep <dbl>, eq <dbl>, es <dbl>, et <dbl>, eu <dbl>, ex <dbl>, ey <dbl>,
    +#> #   fa <dbl>, fe <dbl>, ff <dbl>, fi <dbl>, fj <dbl>, fl <dbl>, fm <dbl>,
    +#> #   fn <dbl>, fp <dbl>, fq <dbl>, fr <dbl>, fs <dbl>, ft <dbl>, fu <dbl>,
    +#> #   fv <dbl>, fx <dbl>, fy <dbl>, fz <dbl>, ga <dbl>, gb <dbl>, gd <dbl>,
    +#> #   ge <dbl>, gf <dbl>, gg <dbl>, gh <dbl>, gj <dbl>, gk <dbl>, gl <dbl>,
    +#> #   ...
    +
    +# Re-Transposing with one ID (taxon_id)
    +taxa_abund %>% 
    +  transposer("taxon_id", "samples") %>% 
    +  transposer("samples", "taxon_id")
    +#> # A tibble: 175 x 49
    +#>    taxon_id Sample_1 Sample_10 Sample_11 Sample_12 Sample_13 Sample_14
    +#>    <chr>       <dbl>     <dbl>     <dbl>     <dbl>     <dbl>     <dbl>
    +#>  1 ac         112582     88194     74933     80796    116806     90122
    +#>  2 af          53903     56426     39952     41912     51677     33032
    +#>  3 ag           4217       480       557       629      1111       350
    +#>  4 ah           4237       750      7138      3234      1207         9
    +#>  5 ai             68        23        21        14        13         0
    +#>  6 aj          46540     30145     26932     34738     62301     56274
    +#>  7 ak           1794        17        73       189        47         0
    +#>  8 al             11         7         5        12        27        11
    +#>  9 an           1524        38        49         0       109         0
    +#> 10 ao             51         0         0         0        11         0
    +#> # ... with 165 more rows, and 42 more variables: Sample_15 <dbl>,
    +#> #   Sample_16 <dbl>, Sample_17 <dbl>, Sample_18 <dbl>, Sample_19 <dbl>,
    +#> #   Sample_2 <dbl>, Sample_20 <dbl>, Sample_21 <dbl>, Sample_22 <dbl>,
    +#> #   Sample_23 <dbl>, Sample_24 <dbl>, Sample_25 <dbl>, Sample_26 <dbl>,
    +#> #   Sample_27 <dbl>, Sample_28 <dbl>, Sample_29 <dbl>, Sample_3 <dbl>,
    +#> #   Sample_30 <dbl>, Sample_31 <dbl>, Sample_35 <dbl>, Sample_36 <dbl>,
    +#> #   Sample_4 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>, Sample_45 <dbl>,
    +#> #   Sample_46 <dbl>, Sample_47 <dbl>, Sample_5 <dbl>, Sample_50 <dbl>,
    +#> #   Sample_51 <dbl>, Sample_52 <dbl>, Sample_55 <dbl>, Sample_56 <dbl>,
    +#> #   Sample_57 <dbl>, Sample_58 <dbl>, Sample_59 <dbl>, Sample_6 <dbl>,
    +#> #   Sample_60 <dbl>, Sample_61 <dbl>, Sample_7 <dbl>, Sample_8 <dbl>,
    +#> #   Sample_9 <dbl>
    +
    +# Transposing with two IDs (taxon_id, otu_id)
    +# The column headers will be a combination of the categorical data that will
    +# be parsed and split back into individual columns if retransposed.
    +otu_abund %>% 
    +  transposer("otu_id", "samples")
    +#> # A tibble: 48 x 1,667
    +#>    samples `ac<_>DQ797054.~ `af<_>EU510171.~ `af<_>New.Clean~
    +#>    <chr>              <dbl>            <dbl>            <dbl>
    +#>  1 Sample~              130                0              108
    +#>  2 Sample~                0                4              106
    +#>  3 Sample~                0               14              152
    +#>  4 Sample~                0               57               71
    +#>  5 Sample~              119                3               34
    +#>  6 Sample~              443                2                1
    +#>  7 Sample~               15                0               74
    +#>  8 Sample~               49               14               49
    +#>  9 Sample~                0                1               12
    +#> 10 Sample~               33                1               55
    +#> # ... with 38 more rows, and 1,663 more variables:
    +#> #   `af<_>New.CleanUp.ReferenceOTU1675` <dbl>,
    +#> #   `af<_>New.CleanUp.ReferenceOTU1778` <dbl>,
    +#> #   `af<_>New.CleanUp.ReferenceOTU2195` <dbl>,
    +#> #   `af<_>New.CleanUp.ReferenceOTU6283` <dbl>,
    +#> #   `af<_>New.ReferenceOTU1018` <dbl>, `af<_>New.ReferenceOTU1460` <dbl>,
    +#> #   `af<_>New.ReferenceOTU1898` <dbl>, `af<_>New.ReferenceOTU662` <dbl>,
    +#> #   `aq<_>EU462203.1.1270` <dbl>, `aq<_>FJ881207.1.1492` <dbl>,
    +#> #   `bd<_>GQ451183.1.1507` <dbl>, `bd<_>New.CleanUp.ReferenceOTU1` <dbl>,
    +#> #   `bd<_>New.ReferenceOTU307` <dbl>, `bv<_>AF371685.1.1445` <dbl>,
    +#> #   `bv<_>EU462407.1.1376` <dbl>, `bv<_>EU469250.1.1356` <dbl>,
    +#> #   `bv<_>EU777569.1.1267` <dbl>, `bv<_>GQ448792.1.1389` <dbl>,
    +#> #   `bv<_>HQ681868.1.1479` <dbl>, `bv<_>New.CleanUp.ReferenceOTU21` <dbl>,
    +#> #   `bv<_>New.CleanUp.ReferenceOTU82` <dbl>,
    +#> #   `bv<_>New.ReferenceOTU648` <dbl>, `cf<_>AF371949.1.1454` <dbl>,
    +#> #   `cf<_>New.CleanUp.ReferenceOTU19053` <dbl>,
    +#> #   `ch<_>New.CleanUp.ReferenceOTU579` <dbl>,
    +#> #   `cq<_>AB506276.1.1515` <dbl>, `cq<_>EU467330.1.1365` <dbl>,
    +#> #   `cq<_>JQ185323.1.1351` <dbl>, `cq<_>JQ187807.1.1343` <dbl>,
    +#> #   `cq<_>KC163104.1.1515` <dbl>, `cq<_>New.CleanUp.ReferenceOTU45` <dbl>,
    +#> #   `dc<_>FJ753766.1.1449` <dbl>, `dc<_>HQ716634.1.1482` <dbl>,
    +#> #   `dc<_>JQ191107.1.1383` <dbl>,
    +#> #   `dc<_>New.CleanUp.ReferenceOTU5376` <dbl>,
    +#> #   `de<_>AB506217.1.1514` <dbl>, `de<_>DQ794395.1.1386` <dbl>,
    +#> #   `de<_>DQ801522.1.1389` <dbl>, `de<_>DQ804804.1.1390` <dbl>,
    +#> #   `de<_>DQ806210.1.1390` <dbl>, `de<_>DQ806419.1.1375` <dbl>,
    +#> #   `de<_>DQ810016.1.1387` <dbl>, `de<_>EF399608.1.1495` <dbl>,
    +#> #   `de<_>EF640147.1.1517` <dbl>, `de<_>EF640148.1.1608` <dbl>,
    +#> #   `de<_>EU462246.1.1393` <dbl>, `de<_>EU462618.1.1379` <dbl>,
    +#> #   `de<_>EU472017.1.1394` <dbl>, `de<_>EU472558.1.1391` <dbl>,
    +#> #   `de<_>EU761737.1.1355` <dbl>, `de<_>EU762031.1.1361` <dbl>,
    +#> #   `de<_>EU768267.1.1370` <dbl>, `de<_>EU774369.1.1254` <dbl>,
    +#> #   `de<_>FJ367054.1.1360` <dbl>, `de<_>FJ368433.1.1378` <dbl>,
    +#> #   `de<_>FJ372296.1.1359` <dbl>, `de<_>FJ678233.1.1439` <dbl>,
    +#> #   `de<_>FJ678914.1.1380` <dbl>, `de<_>FJ681481.1.1448` <dbl>,
    +#> #   `de<_>FJ681993.1.1389` <dbl>, `de<_>FJ681994.1.1392` <dbl>,
    +#> #   `de<_>FJ684811.1.1391` <dbl>, `de<_>FJ880611.1.1492` <dbl>,
    +#> #   `de<_>GQ135595.1.1382` <dbl>, `de<_>HQ716148.1.1427` <dbl>,
    +#> #   `de<_>HQ716567.1.1448` <dbl>, `de<_>HQ775630.1.1451` <dbl>,
    +#> #   `de<_>HQ780641.1.1454` <dbl>, `de<_>HQ781391.1.1449` <dbl>,
    +#> #   `de<_>HQ785245.1.1449` <dbl>, `de<_>HQ790863.1.1455` <dbl>,
    +#> #   `de<_>HQ792930.1.1435` <dbl>, `de<_>HQ808140.1.1436` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU1867` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU2137` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU233` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU292` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU3186` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU4248` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU446` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU451` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU509` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU574` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU66` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU7980` <dbl>,
    +#> #   `de<_>New.CleanUp.ReferenceOTU92` <dbl>,
    +#> #   `de<_>New.ReferenceOTU477` <dbl>, `df<_>AB506215.1.1522` <dbl>,
    +#> #   `df<_>DQ796118.1.1378` <dbl>, `df<_>DQ798544.1.1272` <dbl>,
    +#> #   `df<_>DQ809209.1.1280` <dbl>, `df<_>EF401803.1.1493` <dbl>,
    +#> #   `df<_>EU461642.1.1389` <dbl>, `df<_>EU462752.1.1365` <dbl>,
    +#> #   `df<_>EU771433.1.1280` <dbl>, `df<_>EU772441.1.1390` <dbl>,
    +#> #   `df<_>EU776836.1.1286` <dbl>, `df<_>EU777365.1.1388` <dbl>,
    +#> #   `df<_>EU777419.1.1375` <dbl>, `df<_>EU778354.1.1387` <dbl>, ...
    +
    +# Re-Transposing with two IDs (taxon_id, otu_id)
    +# When you transpose categorical data, the column headers are lost.
    +# To re-transpose you have to supply these headers
    +otu_abund %>% 
    +  transposer("otu_id", "samples") %>% 
    +  transposer("samples", "otu_id", 
    +             separated_categories = c("taxon_id", "otu_id"))
    +#> # A tibble: 1,666 x 50
    +#>    taxon_id otu_id Sample_1 Sample_10 Sample_11 Sample_12 Sample_13
    +#>    <chr>    <chr>     <dbl>     <dbl>     <dbl>     <dbl>     <dbl>
    +#>  1 ac       DQ797~      130         0         0         0       119
    +#>  2 af       EU510~        0         4        14        57         3
    +#>  3 af       New.C~      108       106       152        71        34
    +#>  4 af       New.C~       26         9        52         5         5
    +#>  5 af       New.C~        0         0        15        20        10
    +#>  6 af       New.C~        1         0        12        42         2
    +#>  7 af       New.C~       45        19        17        22         0
    +#>  8 af       New.R~       84        23         6         6         4
    +#>  9 af       New.R~        1         2        25        58         0
    +#> 10 af       New.R~       30        23        80        30         4
    +#> # ... with 1,656 more rows, and 43 more variables: Sample_14 <dbl>,
    +#> #   Sample_15 <dbl>, Sample_16 <dbl>, Sample_17 <dbl>, Sample_18 <dbl>,
    +#> #   Sample_19 <dbl>, Sample_2 <dbl>, Sample_20 <dbl>, Sample_21 <dbl>,
    +#> #   Sample_22 <dbl>, Sample_23 <dbl>, Sample_24 <dbl>, Sample_25 <dbl>,
    +#> #   Sample_26 <dbl>, Sample_27 <dbl>, Sample_28 <dbl>, Sample_29 <dbl>,
    +#> #   Sample_3 <dbl>, Sample_30 <dbl>, Sample_31 <dbl>, Sample_35 <dbl>,
    +#> #   Sample_36 <dbl>, Sample_4 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>,
    +#> #   Sample_45 <dbl>, Sample_46 <dbl>, Sample_47 <dbl>, Sample_5 <dbl>,
    +#> #   Sample_50 <dbl>, Sample_51 <dbl>, Sample_52 <dbl>, Sample_55 <dbl>,
    +#> #   Sample_56 <dbl>, Sample_57 <dbl>, Sample_58 <dbl>, Sample_59 <dbl>,
    +#> #   Sample_6 <dbl>, Sample_60 <dbl>, Sample_61 <dbl>, Sample_7 <dbl>,
    +#> #   Sample_8 <dbl>, Sample_9 <dbl>

    Transforming

    -
    # Transforming to proportions/percentages by COLUMN
    -taxa_abund %>% 
    -  transformer(func = ~./sum(.))
    -#> # A tibble: 175 x 49
    -#>    taxon_id Sample_1 Sample_2 Sample_3 Sample_6 Sample_9 Sample_10
    -#>    <chr>       <dbl>    <dbl>    <dbl>    <dbl>    <dbl>     <dbl>
    -#>  1 ac        1.73e-1  1.75e-1  1.71e-1  1.69e-1  1.71e-1 0.171    
    -#>  2 af        8.27e-2  6.51e-2  8.16e-2  6.78e-2  6.80e-2 0.109    
    -#>  3 ag        6.47e-3  2.31e-2  7.75e-4  5.58e-3  1.21e-3 0.000931 
    -#>  4 ah        6.50e-3  1.44e-3  9.05e-3  9.40e-4  2.18e-3 0.00146  
    -#>  5 ai        1.04e-4  2.70e-5  1.45e-4  1.46e-6  2.59e-5 0.0000446
    -#>  6 aj        7.14e-2  8.46e-2  7.64e-2  9.29e-2  9.87e-2 0.0585   
    -#>  7 ak        2.75e-3  1.47e-4  3.80e-4  9.21e-5  7.60e-5 0.0000330
    -#>  8 al        1.69e-5  8.29e-5  5.47e-5  1.46e-6  3.71e-6 0.0000136
    -#>  9 an        2.34e-3  2.28e-4  2.22e-4  7.31e-6  5.74e-5 0.0000737
    -#> 10 ao        7.83e-5  1.66e-5  9.02e-5  6.14e-4  2.72e-4 0        
    -#> # ... with 165 more rows, and 42 more variables: Sample_13 <dbl>,
    -#> #   Sample_14 <dbl>, Sample_17 <dbl>, Sample_21 <dbl>, Sample_22 <dbl>,
    -#> #   Sample_24 <dbl>, Sample_25 <dbl>, Sample_26 <dbl>, Sample_30 <dbl>,
    -#> #   Sample_50 <dbl>, Sample_59 <dbl>, Sample_60 <dbl>, Sample_61 <dbl>,
    -#> #   Sample_7 <dbl>, Sample_27 <dbl>, Sample_45 <dbl>, Sample_5 <dbl>,
    -#> #   Sample_57 <dbl>, Sample_20 <dbl>, Sample_29 <dbl>, Sample_11 <dbl>,
    -#> #   Sample_12 <dbl>, Sample_15 <dbl>, Sample_16 <dbl>, Sample_18 <dbl>,
    -#> #   Sample_19 <dbl>, Sample_23 <dbl>, Sample_28 <dbl>, Sample_31 <dbl>,
    -#> #   Sample_35 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>, Sample_46 <dbl>,
    -#> #   Sample_47 <dbl>, Sample_51 <dbl>, Sample_55 <dbl>, Sample_56 <dbl>,
    -#> #   Sample_58 <dbl>, Sample_8 <dbl>, Sample_4 <dbl>, Sample_52 <dbl>,
    -#> #   Sample_36 <dbl>
    -
    -# Transforming by ROW is also possible
    -# This function will transpose/retranspose so other information is needed
    -taxa_abund %>% 
    -  transformer(by = "row", 
    -              func = ~./sum(.), 
    -              ids = "taxon_id", 
    -              header_name = "samples", 
    -              separated_categories = c("taxon_id"))
    -#> # A tibble: 175 x 49
    -#>    taxon_id Sample_1 Sample_10 Sample_11 Sample_12 Sample_13 Sample_14
    -#>    <chr>       <dbl>     <dbl>     <dbl>     <dbl>     <dbl>     <dbl>
    -#>  1 ac        0.0241    0.0189    0.0160    0.0173    0.0250  0.0193   
    -#>  2 af        0.0279    0.0292    0.0206    0.0217    0.0267  0.0171   
    -#>  3 ag        0.0325    0.00370   0.00430   0.00485   0.00857 0.00270  
    -#>  4 ah        0.0326    0.00577   0.0549    0.0249    0.00929 0.0000692
    -#>  5 ai        0.00688   0.00233   0.00213   0.00142   0.00132 0        
    -#>  6 aj        0.0191    0.0124    0.0111    0.0143    0.0256  0.0231   
    -#>  7 ak        0.232     0.00220   0.00945   0.0245    0.00608 0        
    -#>  8 al        0.00441   0.00281   0.00201   0.00482   0.0108  0.00441  
    -#>  9 an        0.285     0.00711   0.00917   0         0.0204  0        
    -#> 10 ao        0.00928   0         0         0         0.00200 0        
    -#> # ... with 165 more rows, and 42 more variables: Sample_15 <dbl>,
    -#> #   Sample_16 <dbl>, Sample_17 <dbl>, Sample_18 <dbl>, Sample_19 <dbl>,
    -#> #   Sample_2 <dbl>, Sample_20 <dbl>, Sample_21 <dbl>, Sample_22 <dbl>,
    -#> #   Sample_23 <dbl>, Sample_24 <dbl>, Sample_25 <dbl>, Sample_26 <dbl>,
    -#> #   Sample_27 <dbl>, Sample_28 <dbl>, Sample_29 <dbl>, Sample_3 <dbl>,
    -#> #   Sample_30 <dbl>, Sample_31 <dbl>, Sample_35 <dbl>, Sample_36 <dbl>,
    -#> #   Sample_4 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>, Sample_45 <dbl>,
    -#> #   Sample_46 <dbl>, Sample_47 <dbl>, Sample_5 <dbl>, Sample_50 <dbl>,
    -#> #   Sample_51 <dbl>, Sample_52 <dbl>, Sample_55 <dbl>, Sample_56 <dbl>,
    -#> #   Sample_57 <dbl>, Sample_58 <dbl>, Sample_59 <dbl>, Sample_6 <dbl>,
    -#> #   Sample_60 <dbl>, Sample_61 <dbl>, Sample_7 <dbl>, Sample_8 <dbl>,
    -#> #   Sample_9 <dbl>
    +
    # Transforming to proportions/percentages by COLUMN
    +taxa_abund %>% 
    +  transformer(func = ~./sum(.))
    +#> # A tibble: 175 x 49
    +#>    taxon_id Sample_1 Sample_2 Sample_3 Sample_6 Sample_9 Sample_10
    +#>    <chr>       <dbl>    <dbl>    <dbl>    <dbl>    <dbl>     <dbl>
    +#>  1 ac        1.73e-1  1.75e-1  1.71e-1  1.69e-1  1.71e-1 0.171    
    +#>  2 af        8.27e-2  6.51e-2  8.16e-2  6.78e-2  6.80e-2 0.109    
    +#>  3 ag        6.47e-3  2.31e-2  7.75e-4  5.58e-3  1.21e-3 0.000931 
    +#>  4 ah        6.50e-3  1.44e-3  9.05e-3  9.40e-4  2.18e-3 0.00146  
    +#>  5 ai        1.04e-4  2.70e-5  1.45e-4  1.46e-6  2.59e-5 0.0000446
    +#>  6 aj        7.14e-2  8.46e-2  7.64e-2  9.29e-2  9.87e-2 0.0585   
    +#>  7 ak        2.75e-3  1.47e-4  3.80e-4  9.21e-5  7.60e-5 0.0000330
    +#>  8 al        1.69e-5  8.29e-5  5.47e-5  1.46e-6  3.71e-6 0.0000136
    +#>  9 an        2.34e-3  2.28e-4  2.22e-4  7.31e-6  5.74e-5 0.0000737
    +#> 10 ao        7.83e-5  1.66e-5  9.02e-5  6.14e-4  2.72e-4 0        
    +#> # ... with 165 more rows, and 42 more variables: Sample_13 <dbl>,
    +#> #   Sample_14 <dbl>, Sample_17 <dbl>, Sample_21 <dbl>, Sample_22 <dbl>,
    +#> #   Sample_24 <dbl>, Sample_25 <dbl>, Sample_26 <dbl>, Sample_30 <dbl>,
    +#> #   Sample_50 <dbl>, Sample_59 <dbl>, Sample_60 <dbl>, Sample_61 <dbl>,
    +#> #   Sample_7 <dbl>, Sample_27 <dbl>, Sample_45 <dbl>, Sample_5 <dbl>,
    +#> #   Sample_57 <dbl>, Sample_20 <dbl>, Sample_29 <dbl>, Sample_11 <dbl>,
    +#> #   Sample_12 <dbl>, Sample_15 <dbl>, Sample_16 <dbl>, Sample_18 <dbl>,
    +#> #   Sample_19 <dbl>, Sample_23 <dbl>, Sample_28 <dbl>, Sample_31 <dbl>,
    +#> #   Sample_35 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>, Sample_46 <dbl>,
    +#> #   Sample_47 <dbl>, Sample_51 <dbl>, Sample_55 <dbl>, Sample_56 <dbl>,
    +#> #   Sample_58 <dbl>, Sample_8 <dbl>, Sample_4 <dbl>, Sample_52 <dbl>,
    +#> #   Sample_36 <dbl>
    +
    +# Transforming by ROW is also possible
    +# This function will transpose/retranspose so other information is needed
    +taxa_abund %>% 
    +  transformer(by = "row", 
    +              func = ~./sum(.), 
    +              ids = "taxon_id", 
    +              header_name = "samples", 
    +              separated_categories = c("taxon_id"))
    +#> # A tibble: 175 x 49
    +#>    taxon_id Sample_1 Sample_10 Sample_11 Sample_12 Sample_13 Sample_14
    +#>    <chr>       <dbl>     <dbl>     <dbl>     <dbl>     <dbl>     <dbl>
    +#>  1 ac        0.0241    0.0189    0.0160    0.0173    0.0250  0.0193   
    +#>  2 af        0.0279    0.0292    0.0206    0.0217    0.0267  0.0171   
    +#>  3 ag        0.0325    0.00370   0.00430   0.00485   0.00857 0.00270  
    +#>  4 ah        0.0326    0.00577   0.0549    0.0249    0.00929 0.0000692
    +#>  5 ai        0.00688   0.00233   0.00213   0.00142   0.00132 0        
    +#>  6 aj        0.0191    0.0124    0.0111    0.0143    0.0256  0.0231   
    +#>  7 ak        0.232     0.00220   0.00945   0.0245    0.00608 0        
    +#>  8 al        0.00441   0.00281   0.00201   0.00482   0.0108  0.00441  
    +#>  9 an        0.285     0.00711   0.00917   0         0.0204  0        
    +#> 10 ao        0.00928   0         0         0         0.00200 0        
    +#> # ... with 165 more rows, and 42 more variables: Sample_15 <dbl>,
    +#> #   Sample_16 <dbl>, Sample_17 <dbl>, Sample_18 <dbl>, Sample_19 <dbl>,
    +#> #   Sample_2 <dbl>, Sample_20 <dbl>, Sample_21 <dbl>, Sample_22 <dbl>,
    +#> #   Sample_23 <dbl>, Sample_24 <dbl>, Sample_25 <dbl>, Sample_26 <dbl>,
    +#> #   Sample_27 <dbl>, Sample_28 <dbl>, Sample_29 <dbl>, Sample_3 <dbl>,
    +#> #   Sample_30 <dbl>, Sample_31 <dbl>, Sample_35 <dbl>, Sample_36 <dbl>,
    +#> #   Sample_4 <dbl>, Sample_40 <dbl>, Sample_41 <dbl>, Sample_45 <dbl>,
    +#> #   Sample_46 <dbl>, Sample_47 <dbl>, Sample_5 <dbl>, Sample_50 <dbl>,
    +#> #   Sample_51 <dbl>, Sample_52 <dbl>, Sample_55 <dbl>, Sample_56 <dbl>,
    +#> #   Sample_57 <dbl>, Sample_58 <dbl>, Sample_59 <dbl>, Sample_6 <dbl>,
    +#> #   Sample_60 <dbl>, Sample_61 <dbl>, Sample_7 <dbl>, Sample_8 <dbl>,
    +#> #   Sample_9 <dbl>

    Excel-Like VLookup

    This function was # borrowed from .

    -
    # Get analyzed Data
    -metacoder_obj <- as_MicrobiomeR_format(obj = metacoder_obj, format = "analyzed_format")
    -
    -# Create agglomerated taxmaps for phylum/class
    -phylum_mo <- agglomerate_metacoder(obj = metacoder_obj, rank = "Phylum")
    -class_mo <- agglomerate_metacoder(obj = metacoder_obj, rank = "Class")
    -# Get some observation data
    -phylum_data <- phylum_mo$data$stats_tax_data
    -class_data <- class_mo$data$stats_tax_data
    -
    -# Take the Phylum in the "phylum_data" and cross reference these in the "class_data".
    -# Reutrn the "wilcox_p_value" of the class_data.
    -class_p_value <- vlookup(lookup_vector = phylum_data$Phylum, 
    -                         df = class_data, 
    -                         match_var = "Phylum", 
    -                         return_var = "wilcox_p_value")
    -
    -# Create a new column in the phylum_data.
    -new_data <- phylum_data %>% dplyr::mutate(class_p_value = class_p_value)
    -new_data[c("taxon_id", "Phylum", "Class", "class_p_value", "wilcox_p_value")]
    -#> # A tibble: 13 x 5
    -#>    taxon_id Phylum           Class class_p_value wilcox_p_value
    -#>    <chr>    <fct>            <fct>         <dbl>          <dbl>
    -#>  1 ac       <NA>             <NA>      NaN       NaN           
    -#>  2 af       Firmicutes       <NA>        3.40e-5   0.0000340   
    -#>  3 ag       Proteobacteria   <NA>        3.69e-1   0.369       
    -#>  4 ah       Spirochaetae     <NA>        6.65e-2   0.0665      
    -#>  5 ai       Verrucomicrobia  <NA>        8.12e-3   0.00812     
    -#>  6 aj       Bacteroidetes    <NA>        3.78e-4   0.000378    
    -#>  7 ak       Fibrobacteres    <NA>        3.02e-2   0.0302      
    -#>  8 al       Actinobacteria   <NA>        9.24e-8   0.0000000924
    -#>  9 an       Cyanobacteria    <NA>        6.69e-2   0.0669      
    -#> 10 ao       Elusimicrobia    <NA>        3.94e-1   0.394       
    -#> 11 aq       Saccharibacteria <NA>       NA         0.000895    
    -#> 12 as       Planctomycetes   <NA>        1.48e-3   0.00148     
    -#> 13 at       Tenericutes      <NA>        5.46e-1   0.546
    +
    # Get analyzed Data
    +metacoder_obj <- as_MicrobiomeR_format(obj = metacoder_obj, format = "analyzed_format")
    +
    +# Create agglomerated taxmaps for phylum/class
    +phylum_mo <- agglomerate_taxmap(obj = metacoder_obj, rank = "Phylum")
    +class_mo <- agglomerate_taxmap(obj = metacoder_obj, rank = "Class")
    +# Get some observation data
    +phylum_data <- phylum_mo$data$stats_tax_data
    +class_data <- class_mo$data$stats_tax_data
    +
    +# Take the Phylum in the "phylum_data" and cross reference these in the "class_data".
    +# Reutrn the "wilcox_p_value" of the class_data.
    +class_p_value <- vlookup(lookup_vector = phylum_data$Phylum, 
    +                         df = class_data, 
    +                         match_var = "Phylum", 
    +                         return_var = "wilcox_p_value")
    +
    +# Create a new column in the phylum_data.
    +new_data <- phylum_data %>% dplyr::mutate(class_p_value = class_p_value)
    +new_data[c("taxon_id", "Phylum", "Class", "class_p_value", "wilcox_p_value")]
    +#> # A tibble: 13 x 5
    +#>    taxon_id Phylum           Class class_p_value wilcox_p_value
    +#>    <chr>    <fct>            <fct>         <dbl>          <dbl>
    +#>  1 ac       <NA>             <NA>      NaN       NaN           
    +#>  2 af       Firmicutes       <NA>        3.40e-5   0.0000340   
    +#>  3 ag       Proteobacteria   <NA>        3.69e-1   0.369       
    +#>  4 ah       Spirochaetae     <NA>        6.65e-2   0.0665      
    +#>  5 ai       Verrucomicrobia  <NA>        8.12e-3   0.00812     
    +#>  6 aj       Bacteroidetes    <NA>        3.78e-4   0.000378    
    +#>  7 ak       Fibrobacteres    <NA>        3.02e-2   0.0302      
    +#>  8 al       Actinobacteria   <NA>        9.24e-8   0.0000000924
    +#>  9 an       Cyanobacteria    <NA>        6.69e-2   0.0669      
    +#> 10 ao       Elusimicrobia    <NA>        3.94e-1   0.394       
    +#> 11 aq       Saccharibacteria <NA>       NA         0.000895    
    +#> 12 as       Planctomycetes   <NA>        1.48e-3   0.00148     
    +#> 13 at       Tenericutes      <NA>        5.46e-1   0.546
    @@ -540,7 +543,7 @@

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/index.html b/docs/articles/index.html index 1fe953f..d6ba548 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -145,6 +148,7 @@

    All vignettes

  • Data Wrangling
  • Filtering Data
  • Introduction
  • +
  • MicrobiomeR: An R Package for Simplified and Standardized Microbiome Analysis Workflows (Draft to JOSS)
  • @@ -156,7 +160,7 @@

    All vignettes

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/introduction.html b/docs/articles/introduction.html index dbe4b9a..562a628 100644 --- a/docs/articles/introduction.html +++ b/docs/articles/introduction.html @@ -31,7 +31,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -65,7 +65,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -101,7 +104,7 @@
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/articles/paper.html b/docs/articles/paper.html new file mode 100644 index 0000000..5731468 --- /dev/null +++ b/docs/articles/paper.html @@ -0,0 +1,252 @@ + + + + + + + +MicrobiomeR: An R Package for Simplified and Standardized Microbiome Analysis Workflows (Draft to JOSS) • MicrobiomeR + + + + + + + + + + +
    +
    + + + +
    +
    + + + + +
    +

    +Summary

    +

    The term “microbiome” refers to the microbial community in a given environment. In particular, it has recently risen to prominence in medicine to refer to the human oral, skin, urogenital, and digestive tract commensal bacterial communities. Modern technologies allow for the characterization of microbiome composition by high-throughput sequencing of 16S ribosomal DNA that effectively serves as identifying “bar codes”. Research studies focus on comparing differences in microbiomes between environments or changes within environments over time. To ensure study rigor and reproducibility it is important that data processing be clearly described and standardized. This package aims to unify the processing, analysis, and visualization tools necessary for modern microbiome studies under a transparent and straightforward implementation that facilitates standardization in analysis and reporting.

    +

    Previous open source microbiome packages available for R (R Core Team 2018) (e.g. vegan and microbiome) have been developed, but lack the functionality afforded to more modern tools including phyloseq (McMurdie and Holmes 2013) and metacoder (Foster, Sharpton, and Grünwald 2017). Both of these packages, however, provide different degrees of functionality as it relates to data wrangling, statistical methods, and visualization. Phyloseq, for instance, relies on base R functions such as subset to extract or manipulate data, while metacoder uses a more modern approach like the tidyverse. Additionally, metacoder is built on top of the taxa package and uses a “taxmap object”, which allows for direct manipulation of hierarchical taxonomic data and associated application-specific data (Zachary, Scott, and Niklaus 2018). Phyloseq, on the other hand, provides an excellent means for importing data into R as a “phyloseq object”, which can be used with various proven methods for analysis. In order to bridge the gap, we have developed MicrobiomeR, to provide new tools and a comprehensive workflow based on concepts found in the phyloseq package and newer technologies being developed in the metacoder package.

    +
    +
    +

    +Workflow

    +

    The paradigm for studying the microbiome follows the steps shown in the figure below. MicrobiomeR covers the last four steps of this workflow. Microbiome Workflow

    +

    MicrobiomeR provides users with raw output files from the NIH’s Nephele pipeline. This data was generated by the Illumina MiSeq workflow followed by the Qiime (JG et al. 2010) 16S pipeline for pair ended FASTQ files. To begin a MicrobiomeR workflow, raw data files are imported into R as a phyloseq object, using the create_phyloseq() function. While discouraged, the data can be manipulated directly using any of phyloseq’s methods. Next, the data is converted to a taxmap object using the create_taxmap() function.

    +

    By conceptually modeling MicrobiomeR’s data preprocessing functions after phyloseq, we are able to enhance the useful microbiome analysis capabilities of metacoder and taxa by providing simple “phyloseq-style” preprocessing functions, which are critical for reducing noise within the data. Many of the **_filter()* functions are used for this purpose. Additionally, any of the metacoder or taxa functions can be incorporated into the preprocessing steps as MicrobiomeR primarily operates on taxmap objects.

    +

    After preprocessing the data, statistical analysis can be conducted using MicrobiomeR’s formatting functions (as_*format()), which incorporate metacoder’s calc*() and compare_groups() functions. Furthermore, MicrobiomeR offers a unique permanova() function, which quantifies multivariate community-level differences between groups. Following statistical analysis, alpha and beta diversity can be visualized using the alpha_diversity_plot() and ordination_plot() functions, which are helpful for understanding the intra-sample differences (evenness and richness) and the inter-group differences. Other publication-ready visualizations can also be created using heat_tree_plots(), correlation_plots(), stacked_barplot(), and top_coefficients_barplot().

    +
    +
    +

    +Utilities

    +

    One of the key advantages in using MicrobiomeR is its “phyloseq-style” filtering functions. These functions are heavily dependent upon formatting and validation checkpoints to ensure that the proper data is being manipulated. In Table 1, we describe the “MicrobiomeR formats” used throughout the package and how they are related to phyloseq, metacoder, and each other.

    +
    +

    +Table 1:

    + +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    LevelNameDescriptionData TablesOther Notes
    0PhyloseqFormatA taxmap object that has just been converted from a phyloseq object with the create_phyloseq() function.otu_table tax_data sample_data phy_treeThe observation tables represent the phyloseq::otu_table(), phyloseq::tax_table(), phyloseq::sample_data(), and phyloseq::phy_tree(), data in the original phyloseq object.
    1Raw FormatA taxmap object that has been processed with the as_raw_format()function.phyloseq tables otu_abundance otu_annotationsThe new observation tables are just name conversions of the otu_table and tax_data table from the “phyloseq_format”.
    2BasicFormatA taxmap object that has been processed with the as_basic_format() function.raw tables taxa_abundance otu_proportions taxa_proportionsThis format is defined by observation data that has been processed with the metacoder::calc_*_() functions.
    3AnalyzedFormatA taxmap object that has been processed with the as_analyzed_format() function..basic tables statistical_data stats_tax_dataThis format is defined by observation data that has been processed with the metacoder::compare_groups() function.
    +

    Validation is performed internally by most of the preprocessing, analysis, and formatting functions, but it can also be done directly by using the *is_*_format()* functions. Furthermore, it is encouraged to explore the taxmap objects in order to view observation and taxonomy data. Other MicrobiomeR utilities include project management tools for creating and organizing output directories for plots, a set of color palette functions based on grDevices::colorRampPalette(), and a taxonomic data parsing function called parse_taxonomy_silva_128() used to import data annotated by the SILVA (C et al. 2013) database as a phyloseq object.

    +
    +
    +
    +

    +Acknowledgments

    +

    The data in this R package was generated by the University of Mississippi Medical Center’s Genomics Core and further analyzed using the Nephele platform from the National Institute of Allergy and Infectious Diseases (NIAID) Office of Cyber Infrastructure and Computational Biology (OCICB) in Bethesda, MD.

    +

    MicrobiomeR is currently being used to analyze microbiome data in a study conducted by Xiao Zhang, and enabled by Dr. Eric Vallender.

    +
    +
    +

    +References

    +
    +
    +

    C, Quast, Pruesse E, Yilmaz P, Gerken J, Schweer T, Yarza P, Peplies J, and Glöckner FO. 2013. “The Silva Ribosomal Rna Gene Database Project: Improved Data Processing and Web-Based Tools.” Nucleic Acids Research, no. 41: D590–D596.

    +
    +
    +

    Foster, Zachary, Thomas Sharpton, and Niklaus Grünwald. 2017. “Metacoder: An R Package for Visualization and Manipulation of Community Taxonomic Diversity Data.” PLOS Computational Biology 13 (2). Public Library of Science: 1–15. doi:10.1371/journal.pcbi.1005404.

    +
    +
    +

    JG, Caporaso, Kuczynski J, Stombaugh J, Bittinger K, Bushman FD, Costello EK, Fierer N, et al. 2010. “QIIME Allows Analysis of High-Throughput Community Sequencing Data.” Nature Methods 7: 335–36. qiime.org.

    +
    +
    +

    McMurdie, Paul J., and Susan Holmes. 2013. “Phyloseq: An R Package for Reproducible Interactive Analysis and Graphics of Microbiome Census Data.” PLoS ONE 8 (4): e61217. http://dx.plos.org/10.1371/journal.pone.0061217.

    +
    +
    +

    R Core Team. 2018. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.

    +
    +
    +

    Zachary, Foster, Chamberlain Scott, and Grunwald Niklaus. 2018. Taxa: An R Package Implementing Data Standards and Methods for Taxonomic Data. F1000Research. Vol. 7. doi:10.12688/f1000research.14013.1.

    +
    +
    +
    +
    + + + +
    + + + +
    + + + + + diff --git a/docs/authors.html b/docs/authors.html index 3001364..ea8cdae 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -156,7 +159,7 @@

    Authors

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/index.html b/docs/index.html index 405269e..9517bfe 100644 --- a/docs/index.html +++ b/docs/index.html @@ -32,7 +32,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -66,7 +66,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -109,8 +112,8 @@

    Installation

    We are currently not on CRAN or Bioconductor:

    -
    library(devtools) # Load the devtools package
    -install_github("vallenderlab/MicrobiomeR") # Install the package
    +
    library(devtools) # Load the devtools package
    +install_github("vallenderlab/MicrobiomeR") # Install the package

    @@ -201,7 +204,7 @@

    Dev status

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/news/index.html b/docs/news/index.html index 3b97ea2..21f2920 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -135,17 +138,58 @@

    Changelog

    Source: NEWS.md -
    +
    +

    +MicrobiomeR 0.5.1

    + +
    +

    -MicrobiomeR 0.4.1

    +MicrobiomeR 0.5.0 +
      +
    • Added the JOSS paper and draft vignette
    • +
    • Changed correlation plots
    • +
    • Removed color from background
    • +
    • Removed hard coded plot limits
    • +
    • Added “1:1” line and Average lines
    • +
    • Added a trans parameter to transform the x and y axis
    • +
    • Changed function names
    • +
    • From create_metacoder to create_taxmap +
    • +
    • From agglomerate_metacoder to agglomerate_taxmap +
    • +
    • From melt_metacoder to melt_taxmap +
    • +
    • Bugs
    • +
    • Fixed output_dir bug where error should have been a warning
    • +
    • Fixed correlation plot bug where treatments were on the wrong axis.
    • +
    • Fixed output message for heat tree plots.
    • +
    • Fixed build-check Notes and Warnings
    • +
    +
    +
    +

    +MicrobiomeR 0.4.1

    • Fixed wilcoxon pvalue in analysis vignette.
    • Updated default color palette for stacked_barplot function.
    -
    +

    -MicrobiomeR 0.4.0

    +MicrobiomeR 0.4.0

    Renamed functions

    @@ -174,19 +218,18 @@

    -
    +

    -MicrobiomeR 0.3.1

    +MicrobiomeR 0.3.1
    • Added code coverage.
    -
    +

    -MicrobiomeR 0.3.0

    -
      -
    • Changed function names +MicrobiomeR 0.3.0
        +
      • Changed function names
      • From get_treatment_matrix to treatment_matrix
      • From get_output_dir to output_dir @@ -204,26 +247,21 @@

      • From object_handler to create_metacoder
      -
    • -
    -
    +

    -MicrobiomeR 0.2.4

    -
      -
    • Added new tests +MicrobiomeR 0.2.4
        +
      • Added new tests
      • Correlation plot tests
      • Heat tree tests
      • Metacoder Formatting tests
      • Phyloseq tests
      -
    • -
    -
    +

    -MicrobiomeR 0.2.3

    +MicrobiomeR 0.2.3

    Documentation Updates

    @@ -239,43 +277,34 @@

    -
    +

    -MicrobiomeR 0.2.2

    +MicrobiomeR 0.2.2

    Functional Changes

      -
    • Added support for multiple treatments for some plots -
        +
      • Added support for multiple treatments for some plots
      • get_heat_tree_plots now produces a metacoder::heat_tree_matrix.
      • correlation_plot now produces multiple plots for data with more that 2 treatments.
      • Added the get_treatment_matrix function
      • Added the get_correlation_data function
      • -
      -
    • Updated analysis vignette to demonstrate more than 2 treatment groups.
    • -
    • Updated internal data files. -
        +
      • Updated internal data files.
      • Added new metadata file with 3 treatment groups (nephele_metadata3.txt).
      • Formatted Treatment Group metadata.
      • -
      -
    • -
    • Updated public datasets. -
        +
      • Updated public datasets.
      • Removed Greengenes datasets.
      • Added Silva data with 3 treatment groups.
      • -
      -
    • Added the color-palettes vignette.
    -
    +

    -MicrobiomeR 0.2.1

    +MicrobiomeR 0.2.1

    Features Added

    @@ -292,24 +321,20 @@

    -
    +

    -MicrobiomeR 0.2.0

    +MicrobiomeR 0.2.0

    Documentation Updates

      -
    • Added vignettes to package and pkgdown config. -
        +
      • Added vignettes to package and pkgdown config.
      • About
      • Introduction
      • Data Wrangling
      • Filtering
      • Analysis
      • -
      -
    • -
    • Added reference sections to pkgdown config corresponding to @family tag. -
        +
      • Added reference sections to pkgdown config corresponding to @family tag.
      • Import
      • Formatting
      • Validation
      • @@ -317,8 +342,6 @@

      • Visualization
      • Color Palettes
      -
    • -

    @@ -333,33 +356,33 @@

    -
    +

    -MicrobiomeR 0.1.3

    +MicrobiomeR 0.1.3
    • Added custom css for pkgdown.
    • Added more sections including authors and vignettes to _pkgdown.yml.
    • Fixed @importFrom sections for crayon.
    -
    +

    -MicrobiomeR 0.1.2

    +MicrobiomeR 0.1.2
    • Added ordination.R for ordination plots.
    • Added tests for ordination plots.
    -
    +

    -MicrobiomeR 0.1.1

    +MicrobiomeR 0.1.1
    • Added loggging and better warning messages.
    -
    +

    -MicrobiomeR 0.1.0

    +MicrobiomeR 0.1.0
    • Changed to a semantic versioning scheme.
    • Added barplot.R file of stacked barplot functions.
    • @@ -368,16 +391,16 @@

    • Added simple tests for stacked_barplot and alpha_diversity_plot.
    -
    +

    -MicrobiomeR 0.0.9.2

    +MicrobiomeR 0.0.9.2
    • Fixes to heat tree plots
    -
    +

    -MicrobiomeR 0.0.9.1

    +MicrobiomeR 0.0.9.1
    • Added barplot.R file of stacked barplot functions.
    @@ -388,21 +411,23 @@

    @@ -415,7 +440,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index af2c06b..7c3576c 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,6 +1,6 @@ -pandoc: '2.5' -pkgdown: 1.3.0.9000 -pkgdown_sha: fa9b7502e80401db4b410086b0a8f6ab444f0c66 +pandoc: 1.19.2.1 +pkgdown: 1.3.0 +pkgdown_sha: ~ articles: about: about.html analysis: analysis.html @@ -8,4 +8,8 @@ articles: data-wrangling: data-wrangling.html filtering: filtering.html introduction: introduction.html + paper: paper.html +urls: + reference: https://microbiomer.vallenderlab.science//reference + article: https://microbiomer.vallenderlab.science//articles diff --git a/docs/reference/MicrobiomeR.html b/docs/reference/MicrobiomeR.html index 307ec62..083241d 100644 --- a/docs/reference/MicrobiomeR.html +++ b/docs/reference/MicrobiomeR.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1
    @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -188,7 +191,7 @@

    Author

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/MicrobiomeR_Formats.html b/docs/reference/MicrobiomeR_Formats.html index dada626..6cf5b4f 100644 --- a/docs/reference/MicrobiomeR_Formats.html +++ b/docs/reference/MicrobiomeR_Formats.html @@ -83,7 +83,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -117,7 +117,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -189,8 +192,7 @@

    See a as_basic_format, as_custom_format, as_phyloseq_format, - as_raw_format, - melt_metacoder, + as_raw_format, melt_taxmap, treatment_matrix

    @@ -211,7 +213,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/MicrobiomeR_Workflow.html b/docs/reference/MicrobiomeR_Workflow.html index 80fcdee..3e28780 100644 --- a/docs/reference/MicrobiomeR_Workflow.html +++ b/docs/reference/MicrobiomeR_Workflow.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -192,7 +195,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/agglomerate_taxmap.html b/docs/reference/agglomerate_taxmap.html new file mode 100644 index 0000000..9ca11dc --- /dev/null +++ b/docs/reference/agglomerate_taxmap.html @@ -0,0 +1,238 @@ + + + + + + + + +Agglomerate taxmap Objects — agglomerate_taxmap • MicrobiomeR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    A function similar to the phyloseq::tax_glom function, +that assembles abundance data at a specified rank. This removes subtaxa and reassigns the +values at the specified rank.

    + +
    + +
    agglomerate_taxmap(obj, rank, validated = FALSE)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    obj

    A Taxmap object.

    rank

    The rank that will be agllomerated to.

    validated

    This parameter provides a way to override validation steps. Use carefully. Default: FALSE

    + +

    Value

    + +

    A taxmap object that has been agglomerated at the specified rank.

    + +

    Details

    + +

    This function helps analyzing taxonomic data at intermediate ranks by agglomerating the observation data +and the taxmap object.

    + +

    See also

    + + + + +

    Examples

    +
    # NOT RUN {
    +if(interactive()){
    +# This example uses data that are no longer available in the MicrobiomeR package,
    +# however, they can be easily generated with \code{\link{MicrobiomeR}{as_basic_format}}.
    +library(MicrobiomeR)
    +basic_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "basic_format")
    +phylum_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Phylum")
    +class_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Class")
    +order_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Order")
    + }
    +# }
    +
    + +
    + + +
    + + + + + + diff --git a/docs/reference/alpha_diversity_measures.html b/docs/reference/alpha_diversity_measures.html index ef4250d..b622f30 100644 --- a/docs/reference/alpha_diversity_measures.html +++ b/docs/reference/alpha_diversity_measures.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    group @@ -200,7 +203,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/alpha_diversity_plot.html b/docs/reference/alpha_diversity_plot.html index 2ae0474..3988d3a 100644 --- a/docs/reference/alpha_diversity_plot.html +++ b/docs/reference/alpha_diversity_plot.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -158,7 +161,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    measure @@ -200,26 +203,30 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    Other Visualizations: correlation_data, correlation_plots, correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -228,7 +235,9 @@

    Examp if (interactive()) { library(MicrobiomeR) data <- analyzed_silva - plot <- alpha_diversity_plot(obj = data, measure = "shannon", select_otu_table = "otu_proportions") + plot <- alpha_diversity_plot(obj = data, + measure = "shannon", + select_otu_table = "otu_proportions") plot } # } @@ -256,7 +265,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/as_MicrobiomeR_format.html b/docs/reference/as_MicrobiomeR_format.html index 064e582..f6de1c7 100644 --- a/docs/reference/as_MicrobiomeR_format.html +++ b/docs/reference/as_MicrobiomeR_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    As MicrobiomeR Format

    -

    Converts a metacoder object to the specified format.

    +

    Converts a Taxmap object to the specified format.

    @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    format @@ -167,7 +170,7 @@

    Arg

    Value

    -

    A Taxmap/metacoder object in the specified format.

    +

    A Taxmap object in the specified format.

    Details

    @@ -175,14 +178,13 @@

    Details

    See also

    -
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/as_analyzed_format.html b/docs/reference/as_analyzed_format.html index a71ae86..70e951c 100644 --- a/docs/reference/as_analyzed_format.html +++ b/docs/reference/as_analyzed_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    As Analyzed MicrobiomeR Format

    -

    Converts a metacoder object to the analyzed_format.

    +

    Converts a Taxmap object to the analyzed_format.

    @@ -154,7 +157,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    cols @@ -180,7 +183,7 @@

    Arg

    Value

    -

    A Taxmap/metacoder object in the "analyzed_format".

    +

    A Taxmap object in the "analyzed_format".

    Details

    @@ -196,8 +199,7 @@

    See a as_basic_format, as_custom_format, as_phyloseq_format, - as_raw_format, - melt_metacoder, + as_raw_format, melt_taxmap, treatment_matrix

    @@ -223,7 +225,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/as_basic_format.html b/docs/reference/as_basic_format.html index fc4b61c..d8f26be 100644 --- a/docs/reference/as_basic_format.html +++ b/docs/reference/as_basic_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    As Basic MicrobiomeR Format

    -

    Converts a metacoder object to the basic_format.

    +

    Converts a Taxmap object to the basic_format.

    @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    cols @@ -166,7 +169,7 @@

    Arg

    Value

    -

    A Taxmap/metacoder object in the "basic_format".

    +

    A Taxmap object in the "basic_format".

    Details

    @@ -181,8 +184,7 @@

    See a as_analyzed_format, as_custom_format, as_phyloseq_format, - as_raw_format, - melt_metacoder, + as_raw_format, melt_taxmap, treatment_matrix

    @@ -208,7 +210,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/as_custom_format.html b/docs/reference/as_custom_format.html index e58f8fb..9542815 100644 --- a/docs/reference/as_custom_format.html +++ b/docs/reference/as_custom_format.html @@ -34,7 +34,7 @@ - @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -142,7 +145,7 @@

    As Custom MicrobiomeR Format

    -

    A function for formatting metacoder objects in the MicrobiomeR format. This function +

    A function for formatting Taxmap objects in the MicrobiomeR format. This function attempts to give more customization than the as_*_format functions.

    @@ -154,7 +157,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    format @@ -173,22 +176,21 @@

    Arg

    Value

    -

    A metacoder object that we have tried to format with all of our heart.

    +

    A Taxmap object that we have tried to format with all of our heart.

    Details

    -

    This function is meant to be more helpful for customizing the metacoder object.

    +

    This function is meant to be more helpful for customizing the Taxmap object.

    See also

    -
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/as_phyloseq_format.html b/docs/reference/as_phyloseq_format.html index de58da2..29bd2b5 100644 --- a/docs/reference/as_phyloseq_format.html +++ b/docs/reference/as_phyloseq_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    As Phyloseq MicrobiomeR Format

    -

    Converts the metacoder object to the phyloseq_format.

    +

    Converts the Taxmap object to the phyloseq_format.

    @@ -154,7 +157,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    otu_table @@ -176,7 +179,7 @@

    Arg

    Value

    -

    A Taxmap/metacoder object in the phyloseq_format.

    +

    A Taxmap object in the phyloseq_format.

    Details

    @@ -184,14 +187,13 @@

    Details

    See also

    -
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/as_raw_format.html b/docs/reference/as_raw_format.html index 75bdcec..1e6bc8c 100644 --- a/docs/reference/as_raw_format.html +++ b/docs/reference/as_raw_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    As Raw MicrobiomeR Format

    -

    Converts a metacoder object to the raw_format.

    +

    Converts a Taxmap object to the raw_format.

    @@ -152,13 +155,13 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    Value

    -

    A Taxmap/metacoder object in the "raw_format".

    +

    A Taxmap object in the "raw_format".

    Details

    @@ -174,8 +177,7 @@

    See a as_basic_format, as_custom_format, as_phyloseq_format, - melt_metacoder, - treatment_matrix

    + melt_taxmap, treatment_matrix

    @@ -200,7 +202,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/combination_palette.html b/docs/reference/combination_palette.html index 0239219..658e9c9 100644 --- a/docs/reference/combination_palette.html +++ b/docs/reference/combination_palette.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -189,8 +192,13 @@

    Examp if(interactive()){ # Below is the code for the viridis_magma_palette function. # It's a good example of how to use the combination_palette function. -viridis_magma_palette <- function(viridis_number = 800, viridis_range = 300:viridis_number, viridis_rev = TRUE, - magma_number = 500, magma_range = 0:magma_number, magma_rev = FALSE, ...) { +viridis_magma_palette <- function(viridis_number = 800, + viridis_range = 300:viridis_number, + viridis_rev = TRUE, + magma_number = 500, + magma_range = 0:magma_number, + magma_rev = FALSE, + ...) { if (!missing(...)){ v_args = list(n=viridis_number, ...) m_args = list(n=magma_number, ...) @@ -237,7 +245,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/convert_proportions.html b/docs/reference/convert_proportions.html new file mode 100644 index 0000000..ab0bdd6 --- /dev/null +++ b/docs/reference/convert_proportions.html @@ -0,0 +1,200 @@ + + + + + + + + +Convert Proportions — convert_proportions • MicrobiomeR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Convert Proportions

    + +
    + +
    convert_proportions(melted_df, tax_level)
    + +

    Arguments

    + + + + + + + + + + +
    melted_df

    A "melted" dataframe from the metacoder object's data.

    tax_level

    The taxonomic level, Default: 'Phylum'

    + +

    See also

    + +

    Other Data Manipulators: metacoder_comp_func_1, + transformer, transposer, + vlookup

    + + +
    + +
    + + +
    + + + + + + diff --git a/docs/reference/correlation_data.html b/docs/reference/correlation_data.html index a59698e..0cda1b1 100644 --- a/docs/reference/correlation_data.html +++ b/docs/reference/correlation_data.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -153,7 +156,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    primary_rank @@ -179,7 +182,7 @@

    Details

    See also

    -
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/correlation_plot.html b/docs/reference/correlation_plot.html index 9e336a3..dd3d642 100644 --- a/docs/reference/correlation_plot.html +++ b/docs/reference/correlation_plot.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -146,14 +149,14 @@

    Correlation Plot

    correlation_plot(obj, primary_rank, secondary_rank = TRUE,
    -  wp_value = 0.05, pal_func = NULL)
    + wp_value = 0.05, pal_func = NULL, trans = "logit")

    Arguments

    - + @@ -172,6 +175,12 @@

    Arg

    + + + +
    obj

    An object to be converted to a metacoder object with create_metacoder.

    An object to be converted to a Taxmap object with create_taxmap.

    primary_rankpal_func

    A palette function that returns grDevices::colorRampPalette.

    trans

    Either the name of a transformation object, or the object itself given to scale_continuous. +Built-in transformations include "asn", "atanh", "boxcox", "exp", "identity", "log", "log10", "log1p", +"log2", "logit", "probability", "probit", "reciprocal", "reverse" and "sqrt".

    Value

    @@ -184,7 +193,7 @@

    Details

    See also

    -
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/correlation_plots.html b/docs/reference/correlation_plots.html index e5d8f4e..abd8df2 100644 --- a/docs/reference/correlation_plots.html +++ b/docs/reference/correlation_plots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    primary_ranks @@ -184,13 +187,15 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -231,7 +236,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/cov_filter.html b/docs/reference/cov_filter.html index 2dbc889..fd39d26 100644 --- a/docs/reference/cov_filter.html +++ b/docs/reference/cov_filter.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -154,7 +157,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    coefficient_of_variation @@ -179,7 +182,7 @@

    See a @@ -193,10 +196,10 @@

    Examp library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -263,7 +266,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/create_phyloseq.html b/docs/reference/create_phyloseq.html index a8535f3..9876766 100644 --- a/docs/reference/create_phyloseq.html +++ b/docs/reference/create_phyloseq.html @@ -68,7 +68,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -102,7 +102,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -217,7 +220,7 @@

    See a +

    Other Data Importers: create_taxmap

    Examples

    @@ -231,7 +234,10 @@

    Examp parse_func <- parse_parse_taxonomy_silva_128 } # Create a phyloseq object from the data files. -phy_obj <- create_phyloseq(biom_file = biom_file, tree_file = tree_file, metadata_file = md_file, parse_func = parse_func) +phy_obj <- create_phyloseq(biom_file = biom_file, + tree_file = tree_file, + metadata_file = md_file, + parse_func = parse_func) # }
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/create_pub_table.html b/docs/reference/create_pub_table.html index ef9ae1d..46bd769 100644 --- a/docs/reference/create_pub_table.html +++ b/docs/reference/create_pub_table.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@

  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -191,7 +194,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/create_taxmap.html b/docs/reference/create_taxmap.html new file mode 100644 index 0000000..391509a --- /dev/null +++ b/docs/reference/create_taxmap.html @@ -0,0 +1,224 @@ + + + + + + + + +Get Taxmap Object — create_taxmap • MicrobiomeR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    A function that handles the conversion of objects to Taxmap (taxa::taxmap) objects.

    + +
    + +
    create_taxmap(obj)
    + +

    Arguments

    + + + + + + +
    obj

    An object that contains the data being analyzed. Can be one of the following:

    +
    Phyloseq Object

    An object generated from the phyloseq package.

    +
    Taxmap Object

    An object generated from the metacoder or taxa package.

    +
    RData file

    An RData file generated from the base::save function. Can have an extension of .RData or .rda.

    +
    + +

    Value

    + +

    The output generated is a taxa::taxmap object.

    + +

    Details

    + +

    This function is used to convert data to metacoder/taxmap objects for microbiome analysis. +This function is used at the beginning of every other function to support multiple types of input +for the obj parameter in those functions.

    + +

    See also

    + +

    parse_phyloseq

    +

    fileutils

    +

    Other Data Importers: create_phyloseq

    + + +

    Examples

    +
    # NOT RUN {
    +if(interactive()){
    + library(MicrobiomeR)
    + phy_obj <- MicrobiomeR::phyloseq_silva_2
    + mc_obj <- create_taxmap(phy_obj)
    + }
    +# }
    +
    + +
    + + +
    + + + + + + diff --git a/docs/reference/get_alpha_diversity_measures.html b/docs/reference/get_alpha_diversity_measures.html index 74bd09e..7bd2a9b 100644 --- a/docs/reference/get_alpha_diversity_measures.html +++ b/docs/reference/get_alpha_diversity_measures.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.3.1 + 0.5.0 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    group @@ -200,7 +203,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/get_color_palette.html b/docs/reference/get_color_palette.html index ec4409c..518e741 100644 --- a/docs/reference/get_color_palette.html +++ b/docs/reference/get_color_palette.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -227,7 +230,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/heat_tree_parameters.html b/docs/reference/heat_tree_parameters.html index ee76b7f..7af6f59 100644 --- a/docs/reference/heat_tree_parameters.html +++ b/docs/reference/heat_tree_parameters.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    A metacoder object.

    +

    A Taxmap object.

    title @@ -168,7 +171,7 @@

    Arg output is displayed. However, this function acts as a default list of parameters. The memebers of the default list will be overridden by the dot parameters. Any variable in obj$data$stats_tax_data can be used to manipulate the heat tree parameters. Function calls from the taxa package must -be done explicitely on the metacoder object.

    +be done explicitely on the Taxmap object.

    @@ -187,13 +190,15 @@

    See a correlation_plots, correlation_plot, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -217,7 +222,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/heat_tree_plots.html b/docs/reference/heat_tree_plots.html index 2abdc88..7165603 100644 --- a/docs/reference/heat_tree_plots.html +++ b/docs/reference/heat_tree_plots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -145,19 +148,24 @@

    Get Heat Tree Plots

    -
    heat_tree_plots(obj, rank_list = NULL, ...)
    +
    heat_tree_plots(obj, rank_list = NULL, title = TRUE, ...)

    Arguments

    - + + + + + - - - - @@ -232,15 +229,15 @@

    - + - + - + - + - + @@ -354,9 +351,9 @@

    agglomerate_metacoder()

    +

    agglomerate_taxmap()

    -

    + - + - + + + + + @@ -514,11 +517,17 @@

    melt_metacoder() convert_proportions() stacked_barplot() stacked_barplots()

    +

    stacked_barplot()

    + + + + @@ -603,7 +612,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/is_analyzed_format.html b/docs/reference/is_analyzed_format.html index e67ba51..05016d8 100644 --- a/docs/reference/is_analyzed_format.html +++ b/docs/reference/is_analyzed_format.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg

  • - +
    obj

    An object to be converted to a metacoder object with create_metacoder.

    An object to be converted to a Taxmap object with create_taxmap.

    rank_list

    A vector of ranks used to generate heat_trees. Default: NULL

    title

    Can be a logical, NULL, or a string. The string can utilize {rank} to dynamically +display the rank in the title via glue.

    ...

    Any of the heat_tree parameters can be used to change the way the heat_tree @@ -173,7 +181,7 @@

    Value

    See also

    @@ -225,7 +235,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/index.html b/docs/reference/index.html index 0c2870c..c6b3164 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -62,7 +62,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -96,7 +96,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -158,13 +161,7 @@

    create_metacoder()

    -

  • Get Metacoder Object

    -

    parse_taxonomy_default() parse_taxonomy_greengenes() parse_taxonomy_silva_128() parse_taxonomy_qiime()

    +

    parse_taxonomy_silva_128()

    Parse elements of a taxonomy vector

    -

    MicrobiomeR_Formats

    +

    melt_taxmap()

    The MicrobiomeR Formats

    Melt Taxmap

    -

    melt_metacoder() convert_proportions() stacked_barplot() stacked_barplots()

    +

    MicrobiomeR_Formats

    Stacked Barplot

    The MicrobiomeR Formats

    @@ -330,19 +327,19 @@

    otu_id_filter()

    Filter OTU Ids from Metacoder Objects

    Filter OTU Ids from Taxmap Objects

    sample_id_filter()

    Filter Samples Ids from Metacoder Objects

    Filter Samples Ids from Taxmap Objects

    taxon_id_filter()

    Filter Taxon Ids from Metacoder Objects

    Filter Taxon Ids from Taxmap Objects

    Agglomerate Metacoder Objects

    Agglomerate taxmap Objects

    @@ -392,15 +389,15 @@

    metacoder_comp_func_1()

    +

    convert_proportions()

    Metacoder Comparison Function #1

    Convert Proportions

    -

    melt_metacoder() convert_proportions() stacked_barplot() stacked_barplots()

    +

    metacoder_comp_func_1()

    Stacked Barplot

    Metacoder Comparison Function #1

    @@ -472,11 +469,17 @@

    ordination_plot() ordination_plots()

    +

    ordination_plot()

    Ordination Plot

    +

    ordination_plots()

    +

    Ordination Plots

    plot_limits()

    Stacked Barplot

    +

    stacked_barplots()

    +

    Stacked Barplots

    top_coefficients_barplot()

    obj

    A Taxmap/metacoder object.

    A Taxmap object.

    @@ -211,7 +214,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/is_basic_format.html b/docs/reference/is_basic_format.html index 2745441..7fefef8 100644 --- a/docs/reference/is_basic_format.html +++ b/docs/reference/is_basic_format.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    @@ -211,7 +214,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/is_phyloseq_format.html b/docs/reference/is_phyloseq_format.html index 9842e26..6829733 100644 --- a/docs/reference/is_phyloseq_format.html +++ b/docs/reference/is_phyloseq_format.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    @@ -211,7 +214,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/is_raw_format.html b/docs/reference/is_raw_format.html index ff17cd2..244be26 100644 --- a/docs/reference/is_raw_format.html +++ b/docs/reference/is_raw_format.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    @@ -211,7 +214,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/melt_taxmap.html b/docs/reference/melt_taxmap.html new file mode 100644 index 0000000..27cd75c --- /dev/null +++ b/docs/reference/melt_taxmap.html @@ -0,0 +1,201 @@ + + + + + + + + +Melt Taxmap — melt_taxmap • MicrobiomeR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Melt Taxmap

    + +
    + +
    melt_taxmap(obj)
    + +

    Arguments

    + + + + + + +
    obj

    An object to be converted to a taxmap object with create_taxmap.

    + +

    See also

    + + + + +
    + +
    + + +
    + + + + + + diff --git a/docs/reference/metacoder_comp_func_1.html b/docs/reference/metacoder_comp_func_1.html index e0d0787..632c1f8 100644 --- a/docs/reference/metacoder_comp_func_1.html +++ b/docs/reference/metacoder_comp_func_1.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -173,7 +176,7 @@

    See a

    dip.test

    bimodality_coefficient

    -

    Other Data Manipulators: melt_metacoder, +

    Other Data Manipulators: convert_proportions, transformer, transposer, vlookup

    @@ -200,7 +203,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/order_metacoder_data.html b/docs/reference/order_metacoder_data.html index c7f3620..fe9488e 100644 --- a/docs/reference/order_metacoder_data.html +++ b/docs/reference/order_metacoder_data.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    Order Metacoder Observation Data

    -

    A function for changing the order of the observation data in a metacoder object

    +

    A function for changing the order of the observation data in a Taxmap object

    @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a Taxmap object with create_taxmap.

    @@ -198,7 +201,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/ordination_plot.html b/docs/reference/ordination_plot.html index 7227196..5d2a301 100644 --- a/docs/reference/ordination_plot.html +++ b/docs/reference/ordination_plot.html @@ -34,8 +34,7 @@ - + @@ -66,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -143,23 +145,18 @@

    Ordination Plot

    This function allows for ordination (which helps us to distinguish beta diversity relationships) to be plotted as well as for the corresponding data to be returned.

    -

    Generate plots for a list of ordination methods and distances.

    ordination_plot(obj, method = "PCoA", distance = "wunifrac",
    -  color = "TreatmentGroup", title = NULL, only_data = FALSE)
    -
    -ordination_plots(obj, methods = c("PCoA", "NMDS"),
    -  distances = c("wunifrac", "unifrac", "bray"),
    -  color = "TreatmentGroup", select_otu_table = "otu_proportions")
    + color = "TreatmentGroup", title = NULL, only_data = FALSE)

    Arguments

    - + @@ -181,24 +178,11 @@

    Arg

    - - - - - - - - - - - -
    obj

    An object to be converted to a metacoder object with create_metacoder.

    An object to be converted to a taxmap object with create_taxmap.

    methodonly_data

    Allows for only ordination data to be generated, Default: FALSE

    methods

    A list of ordination methods, Default: 'c("PCoA", "NMDS")'

    distances

    A list of distance methods, Default: 'c("wunifrac", "unifrac", "bray")'

    obj

    An object to be converted to a metacoder object with create_metacoder.

    Value

    By default, it returns an ordination plot.

    -

    Returns a melted dataframe.

    See also

    @@ -209,25 +193,15 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, plot_limits, - save_alpha_diversity_plots, - save_correlation_plots, - save_heat_tree_plots, - save_ordination_plots, - save_stacked_barplots, - top_coefficients_barplot

    -

    Other Visualizations: alpha_diversity_plot, - correlation_data, - correlation_plots, - correlation_plot, - heat_tree_parameters, - heat_tree_plots, - melt_metacoder, plot_limits, + ordination_plots, + plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -263,7 +237,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/ordination_plots.html b/docs/reference/ordination_plots.html new file mode 100644 index 0000000..77d4df5 --- /dev/null +++ b/docs/reference/ordination_plots.html @@ -0,0 +1,232 @@ + + + + + + + + +Ordination Plots — ordination_plots • MicrobiomeR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Generate plots for a list of ordination methods and distances.

    + +
    + +
    ordination_plots(obj, methods = c("PCoA", "NMDS"),
    +  distances = c("wunifrac", "unifrac", "bray"),
    +  color = "TreatmentGroup", select_otu_table = "otu_proportions")
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    obj

    An object to be converted to a metacoder object with create_taxmap.

    methods

    A list of ordination methods, Default: 'c("PCoA", "NMDS")'

    distances

    A list of distance methods, Default: 'c("wunifrac", "unifrac", "bray")'

    color

    Choose the group or factor of which colors will be mapped to, Default: 'TreatmentGroup'

    select_otu_table

    The data table to use in the observation data. Default: "otu_proportions"

    + +

    Value

    + +

    Returns a melted dataframe.

    + +

    See also

    + + + + +
    + +
    + + +
    + + + + + + diff --git a/docs/reference/otu_id_filter.html b/docs/reference/otu_id_filter.html index 851ff41..a34b048 100644 --- a/docs/reference/otu_id_filter.html +++ b/docs/reference/otu_id_filter.html @@ -6,7 +6,7 @@ -Filter OTU Ids from Metacoder Objects — otu_id_filter • MicrobiomeR +Filter OTU Ids from Taxmap Objects — otu_id_filter • MicrobiomeR @@ -32,7 +32,7 @@ - + @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -135,7 +138,7 @@
    @@ -155,7 +158,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    .f_transform @@ -181,7 +184,7 @@

    Arg

    Value

    -

    Returns a metacoder object with otu_ids that pass the filters.

    +

    Returns a taxmap object with otu_ids that pass the filters.

    Details

    @@ -207,8 +210,11 @@

    Examp library(MicrobiomeR) otu_proportion_filter <- function(obj, otu_percentage = 0.00005, validated = FALSE) { mo_clone <- obj$clone() - mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, valid_formats = c("raw_format", "basic_format"), - force_format = TRUE, validated = validated, min_or_max = min) + mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, + valid_formats = c("raw_format", "basic_format"), + force_format = TRUE, + validated = validated, + min_or_max = min) # Filter OTU ids mo_clone <- otu_id_filter(obj = mo_clone, .f_transform = ~./sum(.), @@ -242,7 +248,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/otu_prevalence_filter.html b/docs/reference/otu_prevalence_filter.html index d0bcb3e..76125d0 100644 --- a/docs/reference/otu_prevalence_filter.html +++ b/docs/reference/otu_prevalence_filter.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -153,7 +156,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    minimum_abundance @@ -185,7 +188,7 @@

    See a

    calc_prop_samples

    filter

    filter_taxa

    -

    Other Advanced Metacoder Filters: agglomerate_metacoder, +

    Other Advanced Metacoder Filters: agglomerate_taxmap, cov_filter, otu_proportion_filter, taxa_prevalence_filter

    @@ -198,10 +201,10 @@

    Examp library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -250,7 +253,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/otu_proportion_filter.html b/docs/reference/otu_proportion_filter.html index 6307ad5..5f1e90d 100644 --- a/docs/reference/otu_proportion_filter.html +++ b/docs/reference/otu_proportion_filter.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -154,7 +157,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    otu_percentage @@ -178,7 +181,7 @@

    Details

    See also

    @@ -192,10 +195,10 @@

    Examp library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -241,7 +244,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/output_dir.html b/docs/reference/output_dir.html index 5511655..8135cca 100644 --- a/docs/reference/output_dir.html +++ b/docs/reference/output_dir.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -243,7 +246,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/parse_taxonomy_silva_128.html b/docs/reference/parse_taxonomy_silva_128.html index db3623f..8526e6c 100644 --- a/docs/reference/parse_taxonomy_silva_128.html +++ b/docs/reference/parse_taxonomy_silva_128.html @@ -100,7 +100,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -134,7 +134,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -215,10 +218,7 @@

    Parse elements of a taxonomy vector

    -
    parse_taxonomy_default(char.vec)
    -parse_taxonomy_greengenes(char.vec)
    -parse_taxonomy_silva_128(char.vec)
    -parse_taxonomy_qiime(char.vec)
    +
    parse_taxonomy_silva_128(char.vec)

    Arguments

    @@ -258,7 +258,8 @@

    See a

    Examples

    # NOT RUN {
    - > taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales", "f__Staphylococcaceae")
    + > taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales",
    + "f__Staphylococcaceae")
      > parse_taxonomy_default(taxvec1)
      > parse_taxonomy_greengenes(taxvec1)
      > taxvec2 = c("Root;k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Staphylococcaceae")
    @@ -292,7 +293,7 @@ 

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/permanova.html b/docs/reference/permanova.html index 997675f..bf3221d 100644 --- a/docs/reference/permanova.html +++ b/docs/reference/permanova.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg

  • - + @@ -205,7 +208,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/phyloseq_silva_2.html b/docs/reference/phyloseq_silva_2.html index f85e144..f65700f 100644 --- a/docs/reference/phyloseq_silva_2.html +++ b/docs/reference/phyloseq_silva_2.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -184,7 +187,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/phyloseq_silva_3.html b/docs/reference/phyloseq_silva_3.html index aedd7f7..95f9521 100644 --- a/docs/reference/phyloseq_silva_3.html +++ b/docs/reference/phyloseq_silva_3.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -184,7 +187,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/pick_new_outgroup.html b/docs/reference/pick_new_outgroup.html index 1169c4c..e128285 100644 --- a/docs/reference/pick_new_outgroup.html +++ b/docs/reference/pick_new_outgroup.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -195,7 +198,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html index fea6fc7..eef23c4 100644 --- a/docs/reference/pipe.html +++ b/docs/reference/pipe.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -163,7 +166,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/plot_limits.html b/docs/reference/plot_limits.html index 046adc3..9db4f73 100644 --- a/docs/reference/plot_limits.html +++ b/docs/reference/plot_limits.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -172,13 +175,15 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -202,7 +207,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/raw_silva_2.html b/docs/reference/raw_silva_2.html index 5c31d0e..87de514 100644 --- a/docs/reference/raw_silva_2.html +++ b/docs/reference/raw_silva_2.html @@ -67,7 +67,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -101,7 +101,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -192,7 +195,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/raw_silva_3.html b/docs/reference/raw_silva_3.html index d3e6a13..96bc215 100644 --- a/docs/reference/raw_silva_3.html +++ b/docs/reference/raw_silva_3.html @@ -67,7 +67,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -101,7 +101,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -192,7 +195,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/root_by_longest_edge.html b/docs/reference/root_by_longest_edge.html index db64c3d..4d0628e 100644 --- a/docs/reference/root_by_longest_edge.html +++ b/docs/reference/root_by_longest_edge.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -194,7 +197,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/root_phyloseq_tree.html b/docs/reference/root_phyloseq_tree.html index 81e331f..b483ac0 100644 --- a/docs/reference/root_phyloseq_tree.html +++ b/docs/reference/root_phyloseq_tree.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -221,7 +224,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/sample_id_filter.html b/docs/reference/sample_id_filter.html index e3a59f7..cd7b954 100644 --- a/docs/reference/sample_id_filter.html +++ b/docs/reference/sample_id_filter.html @@ -6,7 +6,7 @@ -Filter Samples Ids from Metacoder Objects — sample_id_filter • MicrobiomeR +Filter Samples Ids from Taxmap Objects — sample_id_filter • MicrobiomeR @@ -32,7 +32,7 @@ - + @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -135,7 +138,7 @@
    @@ -155,7 +158,7 @@

    Arg

  • - + @@ -181,7 +184,7 @@

    Arg

    Value

    -

    Returns a metacoder object with samples that pass the filters.

    +

    Returns a Taxmap object with samples that pass the filters.

    Details

    @@ -206,10 +209,10 @@

    Examp library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_silva_2, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -249,7 +252,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/save_alpha_diversity_plots.html b/docs/reference/save_alpha_diversity_plots.html index 26afbe0..a5f8d00 100644 --- a/docs/reference/save_alpha_diversity_plots.html +++ b/docs/reference/save_alpha_diversity_plots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -188,12 +191,14 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -233,7 +238,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/save_barplot.html b/docs/reference/save_barplot.html index ac05e77..8a5d0be 100644 --- a/docs/reference/save_barplot.html +++ b/docs/reference/save_barplot.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.2.2 + 0.5.0 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -163,14 +166,12 @@

    Arg

    See also

    Other Visualizations: alpha_diversity_plot, + correlation_data, + correlation_plots, correlation_plot, - get_correlation_data, - get_correlation_plots, - get_heat_tree_parameters, - get_heat_tree_plots, - get_plot_limits, - melt_metacoder, - ordination_plot, + heat_tree_parameters, + heat_tree_plots, melt_taxmap, + ordination_plot, plot_limits, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, diff --git a/docs/reference/save_correlation_plots.html b/docs/reference/save_correlation_plots.html index 2872722..1577edc 100644 --- a/docs/reference/save_correlation_plots.html +++ b/docs/reference/save_correlation_plots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1

    @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -188,12 +191,14 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_heat_tree_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -233,7 +238,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/save_heat_tree_plots.html b/docs/reference/save_heat_tree_plots.html index 576a3d2..f3d8f31 100644 --- a/docs/reference/save_heat_tree_plots.html +++ b/docs/reference/save_heat_tree_plots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -188,12 +191,14 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_ordination_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -233,7 +238,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/save_ordination_plots.html b/docs/reference/save_ordination_plots.html index 8d5d3b1..5a90a98 100644 --- a/docs/reference/save_ordination_plots.html +++ b/docs/reference/save_ordination_plots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -188,12 +191,14 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_stacked_barplots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -226,7 +231,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/save_stacked_barplots.html b/docs/reference/save_stacked_barplots.html index 3f2d728..f4bd3a4 100644 --- a/docs/reference/save_stacked_barplots.html +++ b/docs/reference/save_stacked_barplots.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -188,12 +191,14 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, + stacked_barplots, + stacked_barplot, top_coefficients_barplot

    @@ -233,7 +238,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/save_top_coefficients_barplot.html b/docs/reference/save_top_coefficients_barplot.html index 71a344c..5c91eec 100644 --- a/docs/reference/save_top_coefficients_barplot.html +++ b/docs/reference/save_top_coefficients_barplot.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -199,7 +202,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/scico_palette.html b/docs/reference/scico_palette.html index 88fe657..184a74b 100644 --- a/docs/reference/scico_palette.html +++ b/docs/reference/scico_palette.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -217,7 +220,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/stacked_barplot.html b/docs/reference/stacked_barplot.html index b4c651a..1964389 100644 --- a/docs/reference/stacked_barplot.html +++ b/docs/reference/stacked_barplot.html @@ -6,7 +6,7 @@ -Stacked Barplot — melt_metacoder • MicrobiomeR +Stacked Barplot — stacked_barplot • MicrobiomeR @@ -32,7 +32,7 @@ - + @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -147,27 +150,16 @@

    Stacked Barplot

    -
    melt_metacoder(obj)
    -
    -convert_proportions(melted_df, tax_level)
    -
    -stacked_barplot(obj, tax_level = "Phylum", fill = "Phylum",
    +    
    stacked_barplot(obj, tax_level = "Phylum", fill = "Phylum",
       xlabel = "Samples", faceted = FALSE, title = NULL,
    -  palette_values = NULL)
    -
    -stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order"),
    -  group = "TreatmentGroup", select_otu_table = "otu_proportions")
    + palette_values = NULL)

    Arguments

  • obj

    An object to be converted to a metacoder object with create_metacoder.

    An object to be converted to a taxmap object with create_taxmap.

    distance_method
    obj

    A Taxmap/metacoder object.

    A Taxmap object.

    .f_transform
    - - - - - + @@ -193,10 +185,6 @@

    Arg

    - - - -
    obj

    An object to be converted to a metacoder object with create_metacoder.

    melted_df

    A "melted" dataframe from the metacoder object's data.

    An object to be converted to a taxmap object with create_taxmap.

    tax_levelpalette_values

    A list of the colors to input to be mapped to the plot palette, Default: 'NULL'

    tax_levels

    The taxonomic levels, Default: 'c("Phylum", "Class", "Order")'

    Value

    @@ -205,42 +193,20 @@

    Value

    See also

    -
    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/stacked_barplots.html b/docs/reference/stacked_barplots.html new file mode 100644 index 0000000..ecfda32 --- /dev/null +++ b/docs/reference/stacked_barplots.html @@ -0,0 +1,212 @@ + + + + + + + + +Stacked Barplots — stacked_barplots • MicrobiomeR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Stacked Barplots

    + +
    + +
    stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order"))
    + +

    Arguments

    + + + + + + + + + + +
    obj

    An object to be converted to a taxmap object with create_taxmap.

    tax_levels

    The taxonomic levels, Default: 'c("Phylum", "Class", "Order")'

    + +

    See also

    + + + + +
    + +
    + + +
    + + + + + + diff --git a/docs/reference/taxa_prevalence_filter.html b/docs/reference/taxa_prevalence_filter.html index 54c31b6..8fd13a7 100644 --- a/docs/reference/taxa_prevalence_filter.html +++ b/docs/reference/taxa_prevalence_filter.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -153,7 +156,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    rank @@ -189,7 +192,7 @@

    See a

    calc_prop_samples

    filter

    filter_taxa

    -

    Other Advanced Metacoder Filters: agglomerate_metacoder, +

    Other Advanced Metacoder Filters: agglomerate_taxmap, cov_filter, otu_prevalence_filter, otu_proportion_filter

    @@ -202,10 +205,10 @@

    Examp library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -264,7 +267,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/taxon_id_filter.html b/docs/reference/taxon_id_filter.html index 2edf80f..cf3eabc 100644 --- a/docs/reference/taxon_id_filter.html +++ b/docs/reference/taxon_id_filter.html @@ -6,7 +6,7 @@ -Filter Taxon Ids from Metacoder Objects — taxon_id_filter • MicrobiomeR +Filter Taxon Ids from Taxmap Objects — taxon_id_filter • MicrobiomeR @@ -32,7 +32,7 @@ - + @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -135,7 +138,7 @@
    @@ -155,7 +158,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    .f_transform @@ -181,7 +184,7 @@

    Arg

    Value

    -

    Returns a metacoder object with taxon_ids that pass the filters.

    +

    Returns a Taxmap object with taxon_ids that pass the filters.

    Details

    @@ -205,10 +208,10 @@

    Examp library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -248,7 +251,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/top_coefficients_barplot.html b/docs/reference/top_coefficients_barplot.html index f1090e3..594a4cc 100644 --- a/docs/reference/top_coefficients_barplot.html +++ b/docs/reference/top_coefficients_barplot.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -173,13 +176,15 @@

    See a correlation_plot, heat_tree_parameters, heat_tree_plots, - melt_metacoder, + ordination_plots, ordination_plot, plot_limits, save_alpha_diversity_plots, save_correlation_plots, save_heat_tree_plots, save_ordination_plots, - save_stacked_barplots

    + save_stacked_barplots, + stacked_barplots, + stacked_barplot

    Examples

    @@ -213,7 +218,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/transformer.html b/docs/reference/transformer.html index 9f9e808..4928108 100644 --- a/docs/reference/transformer.html +++ b/docs/reference/transformer.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -206,7 +209,7 @@

    See a @@ -249,7 +252,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/transposer.html b/docs/reference/transposer.html index 4842591..c6bef13 100644 --- a/docs/reference/transposer.html +++ b/docs/reference/transposer.html @@ -66,7 +66,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -100,7 +100,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -193,7 +196,7 @@

    See a

    select_all, select, reexports, sym, one_of

    gather, unite, spread, separate

    str_detect, str_count

    -

    Other Data Manipulators: melt_metacoder, +

    Other Data Manipulators: convert_proportions, metacoder_comp_func_1, transformer, vlookup

    @@ -236,7 +239,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/treatment_matrix.html b/docs/reference/treatment_matrix.html index c461dd3..43fd666 100644 --- a/docs/reference/treatment_matrix.html +++ b/docs/reference/treatment_matrix.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -152,7 +155,7 @@

    Arg obj -

    An object to be converted to a metacoder object with create_metacoder.

    +

    An object to be converted to a taxmap object with create_taxmap.

    @@ -172,7 +175,7 @@

    See a as_basic_format, as_custom_format, as_phyloseq_format, - as_raw_format, melt_metacoder

    + as_raw_format, melt_taxmap

    Examples

    @@ -205,7 +208,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/validate_MicrobiomeR_format.html b/docs/reference/validate_MicrobiomeR_format.html index b78e826..ef0c2d8 100644 --- a/docs/reference/validate_MicrobiomeR_format.html +++ b/docs/reference/validate_MicrobiomeR_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    Validate MicrobiomeR Format

    -

    This funciton validates that taxmap/metacoder objects are in a valid format MicrobiomeR format.

    +

    This funciton validates that Taxmap objects are in a valid format MicrobiomeR format.

    @@ -153,7 +156,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    validated @@ -181,7 +184,7 @@

    Arg

    Value

    -

    If the object is validated, a Taxmap/metacoder object.

    +

    If the object is validated, a Taxmap object.

    Details

    @@ -221,7 +224,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/viridis_magma_palette.html b/docs/reference/viridis_magma_palette.html index 2e1e096..066bf60 100644 --- a/docs/reference/viridis_magma_palette.html +++ b/docs/reference/viridis_magma_palette.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -245,7 +248,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/viridis_palette.html b/docs/reference/viridis_palette.html index 3db142c..ab2f1c8 100644 --- a/docs/reference/viridis_palette.html +++ b/docs/reference/viridis_palette.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -217,7 +220,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/vlookup.html b/docs/reference/vlookup.html index 378bee7..72aec3c 100644 --- a/docs/reference/vlookup.html +++ b/docs/reference/vlookup.html @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -179,7 +182,7 @@

    Details

    See also

    -

    Other Data Manipulators: melt_metacoder, +

    @@ -214,7 +217,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/reference/which_format.html b/docs/reference/which_format.html index 7a90aa9..4de7b68 100644 --- a/docs/reference/which_format.html +++ b/docs/reference/which_format.html @@ -34,7 +34,7 @@ - + @@ -65,7 +65,7 @@ MicrobiomeR - 0.4.1 + 0.5.1 @@ -99,7 +99,10 @@
  • - Reference + Functions +
  • +
  • + Publication
  • Changelog @@ -141,7 +144,7 @@

    Which MicrobiomeR Format

    -

    A function for looking at a metacoder object and returning the identified MicrobiomeR format.

    +

    A function for looking at a Taxmap object and returning the identified MicrobiomeR format.

    @@ -152,7 +155,7 @@

    Arg obj -

    A Taxmap/metacoder object.

    +

    A Taxmap object.

    @@ -208,7 +211,7 @@

    Contents

    -

    Site built with pkgdown 1.3.0.9000.

    +

    Site built with pkgdown 1.3.0.

    diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..e68bed7 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,234 @@ + + + + https://microbiomer.vallenderlab.science//index.html + + + https://microbiomer.vallenderlab.science//reference/agglomerate_taxmap.html + + + https://microbiomer.vallenderlab.science//reference/alpha_diversity_measures.html + + + https://microbiomer.vallenderlab.science//reference/alpha_diversity_plot.html + + + https://microbiomer.vallenderlab.science//reference/as_analyzed_format.html + + + https://microbiomer.vallenderlab.science//reference/as_basic_format.html + + + https://microbiomer.vallenderlab.science//reference/as_custom_format.html + + + https://microbiomer.vallenderlab.science//reference/as_MicrobiomeR_format.html + + + https://microbiomer.vallenderlab.science//reference/as_phyloseq_format.html + + + https://microbiomer.vallenderlab.science//reference/as_raw_format.html + + + https://microbiomer.vallenderlab.science//reference/combination_palette.html + + + https://microbiomer.vallenderlab.science//reference/convert_proportions.html + + + https://microbiomer.vallenderlab.science//reference/correlation_data.html + + + https://microbiomer.vallenderlab.science//reference/correlation_plot.html + + + https://microbiomer.vallenderlab.science//reference/correlation_plots.html + + + https://microbiomer.vallenderlab.science//reference/cov_filter.html + + + https://microbiomer.vallenderlab.science//reference/create_phyloseq.html + + + https://microbiomer.vallenderlab.science//reference/create_pub_table.html + + + https://microbiomer.vallenderlab.science//reference/create_taxmap.html + + + https://microbiomer.vallenderlab.science//reference/get_color_palette.html + + + https://microbiomer.vallenderlab.science//reference/heat_tree_parameters.html + + + https://microbiomer.vallenderlab.science//reference/heat_tree_plots.html + + + https://microbiomer.vallenderlab.science//reference/is_analyzed_format.html + + + https://microbiomer.vallenderlab.science//reference/is_basic_format.html + + + https://microbiomer.vallenderlab.science//reference/is_phyloseq_format.html + + + https://microbiomer.vallenderlab.science//reference/is_raw_format.html + + + https://microbiomer.vallenderlab.science//reference/melt_taxmap.html + + + https://microbiomer.vallenderlab.science//reference/metacoder_comp_func_1.html + + + https://microbiomer.vallenderlab.science//reference/MicrobiomeR.html + + + https://microbiomer.vallenderlab.science//reference/MicrobiomeR_Formats.html + + + https://microbiomer.vallenderlab.science//reference/MicrobiomeR_Workflow.html + + + https://microbiomer.vallenderlab.science//reference/order_metacoder_data.html + + + https://microbiomer.vallenderlab.science//reference/ordination_plot.html + + + https://microbiomer.vallenderlab.science//reference/ordination_plots.html + + + https://microbiomer.vallenderlab.science//reference/otu_id_filter.html + + + https://microbiomer.vallenderlab.science//reference/otu_prevalence_filter.html + + + https://microbiomer.vallenderlab.science//reference/otu_proportion_filter.html + + + https://microbiomer.vallenderlab.science//reference/output_dir.html + + + https://microbiomer.vallenderlab.science//reference/parse_taxonomy_silva_128.html + + + https://microbiomer.vallenderlab.science//reference/permanova.html + + + https://microbiomer.vallenderlab.science//reference/phyloseq_silva_2.html + + + https://microbiomer.vallenderlab.science//reference/phyloseq_silva_3.html + + + https://microbiomer.vallenderlab.science//reference/pick_new_outgroup.html + + + https://microbiomer.vallenderlab.science//reference/pipe.html + + + https://microbiomer.vallenderlab.science//reference/plot_limits.html + + + https://microbiomer.vallenderlab.science//reference/raw_silva_2.html + + + https://microbiomer.vallenderlab.science//reference/raw_silva_3.html + + + https://microbiomer.vallenderlab.science//reference/root_by_longest_edge.html + + + https://microbiomer.vallenderlab.science//reference/root_phyloseq_tree.html + + + https://microbiomer.vallenderlab.science//reference/sample_id_filter.html + + + https://microbiomer.vallenderlab.science//reference/save_alpha_diversity_plots.html + + + https://microbiomer.vallenderlab.science//reference/save_correlation_plots.html + + + https://microbiomer.vallenderlab.science//reference/save_heat_tree_plots.html + + + https://microbiomer.vallenderlab.science//reference/save_ordination_plots.html + + + https://microbiomer.vallenderlab.science//reference/save_stacked_barplots.html + + + https://microbiomer.vallenderlab.science//reference/save_top_coefficients_barplot.html + + + https://microbiomer.vallenderlab.science//reference/scico_palette.html + + + https://microbiomer.vallenderlab.science//reference/stacked_barplot.html + + + https://microbiomer.vallenderlab.science//reference/stacked_barplots.html + + + https://microbiomer.vallenderlab.science//reference/taxa_prevalence_filter.html + + + https://microbiomer.vallenderlab.science//reference/taxon_id_filter.html + + + https://microbiomer.vallenderlab.science//reference/top_coefficients_barplot.html + + + https://microbiomer.vallenderlab.science//reference/transformer.html + + + https://microbiomer.vallenderlab.science//reference/transposer.html + + + https://microbiomer.vallenderlab.science//reference/treatment_matrix.html + + + https://microbiomer.vallenderlab.science//reference/validate_MicrobiomeR_format.html + + + https://microbiomer.vallenderlab.science//reference/viridis_magma_palette.html + + + https://microbiomer.vallenderlab.science//reference/viridis_palette.html + + + https://microbiomer.vallenderlab.science//reference/vlookup.html + + + https://microbiomer.vallenderlab.science//reference/which_format.html + + + https://microbiomer.vallenderlab.science//articles/about.html + + + https://microbiomer.vallenderlab.science//articles/analysis.html + + + https://microbiomer.vallenderlab.science//articles/color-palettes.html + + + https://microbiomer.vallenderlab.science//articles/data-wrangling.html + + + https://microbiomer.vallenderlab.science//articles/filtering.html + + + https://microbiomer.vallenderlab.science//articles/introduction.html + + + https://microbiomer.vallenderlab.science//articles/paper.html + + diff --git a/inst/paper/Microbiome-Workflow.png b/inst/paper/Microbiome-Workflow.png new file mode 100644 index 0000000..2a9e2bd Binary files /dev/null and b/inst/paper/Microbiome-Workflow.png differ diff --git a/inst/paper/paper.bib b/inst/paper/paper.bib new file mode 100644 index 0000000..0244236 --- /dev/null +++ b/inst/paper/paper.bib @@ -0,0 +1,73 @@ +@Manual{r-core, + title = {R: A Language and Environment for Statistical Computing}, + author = {{R Core Team}}, + organization = {R Foundation for Statistical Computing}, + address = {Vienna, Austria}, + year = {2018}, + url = {https://www.R-project.org/}, +} + +@Article{phyloseq, + author = {Paul J. McMurdie and Susan Holmes}, + journal = {PLoS ONE}, + pages = {e61217}, + title = {phyloseq: An R package for reproducible interactive analysis and graphics of microbiome census data}, + volume = {8}, + number = {4}, + year = {2013}, + url = {http://dx.plos.org/10.1371/journal.pone.0061217}, +} + +@Article{metacoder, + title = {Metacoder: An R package for visualization and manipulation of community taxonomic diversity data.}, + author = {Zachary Foster and Thomas Sharpton and Niklaus Grünwald}, + journal = {PLOS Computational Biology}, + publisher = {Public Library of Science}, + year = {2017}, + month = {02}, + volume = {13}, + pages = {1-15}, + number = {2}, + doi = {10.1371/journal.pcbi.1005404}, + url = {http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005404}, +} + +@Manual{taxa, + title = {Taxa: An R package implementing data standards and methods for taxonomic data.}, + author = {Foster Zachary and Chamberlain Scott and Grunwald Niklaus}, + journal = {F1000Research}, + year = {2018}, + volume = {7}, + number = {272}, + doi = {10.12688/f1000research.14013.1}, + url = {https://f1000research.com/articles/7-272/v2}, +} + +@Article{qiime, + title = {QIIME allows analysis of high-throughput community sequencing data.}, + author = {Caporaso JG and Kuczynski J and Stombaugh J and Bittinger K and Bushman FD and Costello EK and Fierer N + and Gonzalez Pena A and Goodrich JK and Gordon JI and Huttley GA and Kelley ST and Knights D + and Koenig JE and Ley RE and Lozupone CA and McDonald D and Muegge BD and Pirrung M and Reeder J + and Sevinsky JR and Turnbaugh PJ and Walters WA and Widmann J and Yatsunenko T and Zaneveld J + and Knight R}, + journal = {Nature Methods}, + year = {2010}, + volume = {7}, + pages = {335-336}, + url = {qiime.org}, +} + +@Article{silva_1, + title = {The SILVA ribosomal RNA gene database project: improved data processing and web-based tools.}, + author = {Quast C and Pruesse E and Yilmaz P and Gerken J and Schweer T and Yarza P and Peplies J and Glöckner FO}, + journal = {Nucleic Acids Research}, + year = {2013}, + issue = {41}, + pages = {D590-D596}, +} + +@Article{silva_2, + title = {The SILVA and “All-species Living Tree Project (LTP)” taxonomic frameworks.}, + author = {Yilmaz P and Parfrey LW and Yarza P and Gerken J and Pruesse E and Quast C + and Schweer T and Peplies J and Ludwig W and Glöckner FO} +} diff --git a/inst/paper/paper.md b/inst/paper/paper.md new file mode 100644 index 0000000..077fa70 --- /dev/null +++ b/inst/paper/paper.md @@ -0,0 +1,65 @@ +--- +title: 'MicrobiomeR: An R Package for Simplified and Standardized Microbiome Analysis Workflows' +tags: + - R + - bioinformatics + - microbiome + - taxonomy +authors: + - name: Robert A Gilmore + orcid: 0000-0001-8096-0180 + affiliation: 1 + - name: Shaurita Hutchins + orcid: 0000-0002-7687-0059 + affiliation: 1 + - name: Xiao Zhang + orcid: 0000-0001-5710-6496 + affiliation: 1 + - name: Eric Vallender + orcid: 0000-0003-3506-0540 + affiliation: 1 +affiliations: + - name: Department of Neurobiology, University of Mississippi Medical Center, Jackson, MS 39216, USA + index: 1 +date: 18 February 2019 +bibliography: paper.bib +--- + +# Summary + +The term “microbiome” refers to the microbial community in a given environment. In particular, it has recently risen to prominence in medicine to refer to the human oral, skin, urogenital, and digestive tract commensal bacterial communities. Modern technologies allow for the characterization of microbiome composition by high-throughput sequencing of 16S ribosomal DNA that effectively serves as identifying “bar codes”. Research studies focus on comparing differences in microbiomes between environments or changes within environments over time. To ensure study rigor and reproducibility it is important that data processing be clearly described and standardized. This package aims to unify the processing, analysis, and visualization tools necessary for modern microbiome studies under a transparent and straightforward implementation that facilitates standardization in analysis and reporting. + +Previous open source microbiome packages available for R [@r-core] (e.g. **vegan** and **microbiome**) have been developed, but lack the functionality afforded to more modern tools including **phyloseq** [@phyloseq] and **metacoder** [@metacoder]. Both of these packages, however, provide different degrees of functionality as it relates to data wrangling, statistical methods, and visualization. Phyloseq, for instance, relies on **base** R functions such as _subset_ to extract or manipulate data, while metacoder uses a more modern approach like the **tidyverse**. Additionally, metacoder is built on top of the **taxa** package and uses a _“taxmap object”_, which allows for direct manipulation of hierarchical taxonomic data and associated application-specific data [@taxa]. Phyloseq, on the other hand, provides an excellent means for importing data into R as a _“phyloseq object”_, which can be used with various proven methods for analysis. In order to bridge the gap, we have developed **MicrobiomeR**, to provide new tools and a comprehensive workflow based on concepts found in the phyloseq package and newer technologies being developed in the metacoder package. + +# Workflow + +The paradigm for studying the microbiome follows the steps shown in the figure below. MicrobiomeR covers the last four steps of this workflow. +![Microbiome Workflow](Microbiome-Workflow.png) + +MicrobiomeR provides users with raw output files from the NIH’s Nephele pipeline. This data was generated by the Illumina MiSeq workflow followed by the **Qiime** [@qiime] 16S pipeline for pair ended FASTQ files. To begin a MicrobiomeR workflow, raw data files are imported into R as a phyloseq object, using the *create_phyloseq()* function. While discouraged, the data can be manipulated directly using any of phyloseq’s methods. Next, the data is converted to a taxmap object using the *create_taxmap()* function. + +By conceptually modeling MicrobiomeR’s data preprocessing functions after phyloseq, we are able to enhance the useful microbiome analysis capabilities of metacoder and taxa by providing simple “phyloseq-style” preprocessing functions, which are critical for reducing noise within the data. Many of the **_filter()* functions are used for this purpose. Additionally, any of the metacoder or taxa functions can be incorporated into the preprocessing steps as MicrobiomeR primarily operates on taxmap objects. + +After preprocessing the data, statistical analysis can be conducted using MicrobiomeR’s formatting functions (*as_\*_format()*), which incorporate metacoder’s *calc_\*()* and *compare_groups()* functions. Furthermore, MicrobiomeR offers a unique _permanova()_ function, which quantifies multivariate community-level differences between groups. Following statistical analysis, alpha and beta diversity can be visualized using the *alpha_diversity_plot()* and *ordination_plot()* functions, which are helpful for understanding the intra-sample differences (evenness and richness) and the inter-group differences. Other publication-ready visualizations can also be created using *heat_tree_plots()*, *correlation_plots()*, *stacked_barplot()*, and *top_coefficients_barplot()*. + +# Utilities + +One of the key advantages in using MicrobiomeR is its “phyloseq-style” filtering functions. These functions are heavily dependent upon formatting and validation checkpoints to ensure that the proper data is being manipulated. In Table 1, we describe the “MicrobiomeR formats” used throughout the package and how they are related to phyloseq, metacoder, and each other. + +### Table 1: +| Level | Name | Description | Data Tables | Other Notes | +|:-----:|:--------------:|:--------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| 0 | PhyloseqFormat | A taxmap object that has just been converted from a phyloseq object with the create_phyloseq() function. | otu_table tax_data sample_data phy_tree | The observation tables represent the phyloseq::otu_table(), phyloseq::tax_table(), phyloseq::sample_data(), and phyloseq::phy_tree(), data in the original phyloseq object. | +| 1 | Raw Format | A taxmap object that has been processed with the as_raw_format()function. | phyloseq tables otu_abundance otu_annotations | The new observation tables are just name conversions of the otu_table and tax_data table from the "phyloseq_format”. | +| 2 | BasicFormat | A taxmap object that has been processed with the as_basic_format() function. | raw tables taxa_abundance otu_proportions taxa_proportions | This format is defined by observation data that has been processed with the metacoder::calc_*_() functions. | +| 3 | AnalyzedFormat | A taxmap object that has been processed with the as_analyzed_format() function.. | basic tables statistical_data stats_tax_data | This format is defined by observation data that has been processed with the metacoder::compare_groups() function. | + +Validation is performed internally by most of the preprocessing, analysis, and formatting functions, but it can also be done directly by using the *is_\*_format()* functions. Furthermore, it is encouraged to explore the taxmap objects in order to view observation and taxonomy data. Other MicrobiomeR utilities include project management tools for creating and organizing output directories for plots, a set of color palette functions based on *grDevices::colorRampPalette()*, and a taxonomic data parsing function called *parse_taxonomy_silva_128()* used to import data annotated by the SILVA [@silva_1] database as a phyloseq object. + +# Acknowledgments + +The data in this R package was generated by the University of Mississippi Medical Center’s Genomics Core and further analyzed using the Nephele platform from the National Institute of Allergy and Infectious Diseases (NIAID) Office of Cyber Infrastructure and Computational Biology (OCICB) in Bethesda, MD. + +MicrobiomeR is currently being used to analyze microbiome data in a study conducted by Xiao Zhang, and enabled by Dr. Eric Vallender. + +# References diff --git a/man/MicrobiomeR_Formats.Rd b/man/MicrobiomeR_Formats.Rd index e9643d0..6233770 100644 --- a/man/MicrobiomeR_Formats.Rd +++ b/man/MicrobiomeR_Formats.Rd @@ -31,8 +31,7 @@ Other Formatting: \code{\link{as_MicrobiomeR_format}}, \code{\link{as_basic_format}}, \code{\link{as_custom_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, - \code{\link{melt_metacoder}}, + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/agglomerate_metacoder.Rd b/man/agglomerate_taxmap.Rd similarity index 77% rename from man/agglomerate_metacoder.Rd rename to man/agglomerate_taxmap.Rd index 151930c..f7a280d 100644 --- a/man/agglomerate_metacoder.Rd +++ b/man/agglomerate_taxmap.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/metacoder.R -\name{agglomerate_metacoder} -\alias{agglomerate_metacoder} -\title{Agglomerate Metacoder Objects} +\name{agglomerate_taxmap} +\alias{agglomerate_taxmap} +\title{Agglomerate taxmap Objects} \usage{ -agglomerate_metacoder(obj, rank, validated = FALSE) +agglomerate_taxmap(obj, rank, validated = FALSE) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{rank}{The rank that will be agllomerated to.} @@ -32,9 +32,9 @@ if(interactive()){ # however, they can be easily generated with \\code{\\link{MicrobiomeR}{as_basic_format}}. library(MicrobiomeR) basic_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "basic_format") -phylum_obj <- agglomerate_metacoder(obj = basic_silva, rank = "Phylum") -class_obj <- agglomerate_metacoder(obj = basic_silva, rank = "Class") -order_obj <- agglomerate_metacoder(obj = basic_silva, rank = "Order") +phylum_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Phylum") +class_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Class") +order_obj <- agglomerate_taxmap(obj = basic_silva, rank = "Order") } } } diff --git a/man/alpha_diversity_measures.Rd b/man/alpha_diversity_measures.Rd index 73983d9..32ce77f 100644 --- a/man/alpha_diversity_measures.Rd +++ b/man/alpha_diversity_measures.Rd @@ -7,7 +7,7 @@ alpha_diversity_measures(obj, group = "TreatmentGroup") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{group}{The "TreatmentGroup" or similar grouping from your metadata to denote sample groups, Default: 'TreatmentGroup'} } diff --git a/man/alpha_diversity_plot.Rd b/man/alpha_diversity_plot.Rd index b7251f5..bc1dc03 100644 --- a/man/alpha_diversity_plot.Rd +++ b/man/alpha_diversity_plot.Rd @@ -14,7 +14,7 @@ alpha_diversity_plots(obj, measures = c("shannon", "simpson", select_otu_table = "otu_proportions") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{measure}{Select an alpha diversity measure such as shannon, gini simpson, and inverse simpson, Default: 'shannon'} @@ -43,7 +43,9 @@ We prefer to use \code{shannon} as it is better for data generated using the QUI if (interactive()) { library(MicrobiomeR) data <- analyzed_silva - plot <- alpha_diversity_plot(obj = data, measure = "shannon", select_otu_table = "otu_proportions") + plot <- alpha_diversity_plot(obj = data, + measure = "shannon", + select_otu_table = "otu_proportions") plot } } @@ -56,13 +58,15 @@ Other Visualizations: \code{\link{correlation_data}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} Other Visualizations: \code{\link{correlation_data}}, @@ -70,13 +74,15 @@ Other Visualizations: \code{\link{correlation_data}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/as_MicrobiomeR_format.Rd b/man/as_MicrobiomeR_format.Rd index b53abea..14aae66 100644 --- a/man/as_MicrobiomeR_format.Rd +++ b/man/as_MicrobiomeR_format.Rd @@ -7,7 +7,7 @@ as_MicrobiomeR_format(obj, format, ...) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{format}{The name of the format to convert the object to.} @@ -15,24 +15,23 @@ as_MicrobiomeR_format(obj, format, ...) by the format parameter.} } \value{ -A Taxmap/metacoder object in the specified format. +A Taxmap object in the specified format. } \description{ -Converts a metacoder object to the specified format. +Converts a Taxmap object to the specified format. } \details{ See the \link{MicrobiomeR_Formats} documentation. } \seealso{ -\code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{as_raw_format}}, \code{\link[MicrobiomeR]{as_basic_format}}, \code{\link[MicrobiomeR]{as_analyzed_format}}, \code{\link[MicrobiomeR]{as_phyloseq_format}}, \code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{order_metacoder_data}} +\code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{as_raw_format}}, \code{\link[MicrobiomeR]{as_basic_format}}, \code{\link[MicrobiomeR]{as_analyzed_format}}, \code{\link[MicrobiomeR]{as_phyloseq_format}}, \code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{order_metacoder_data}} Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_analyzed_format}}, \code{\link{as_basic_format}}, \code{\link{as_custom_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, - \code{\link{melt_metacoder}}, + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/as_analyzed_format.Rd b/man/as_analyzed_format.Rd index fb39a03..5c786f0 100644 --- a/man/as_analyzed_format.Rd +++ b/man/as_analyzed_format.Rd @@ -9,7 +9,7 @@ as_analyzed_format(obj, cols = NULL, groups = NULL, comp_func = metacoder_comp_func_1) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{cols}{Column names used for \code{\link[metacoder]{calc_taxon_abund}}. Default: NULL} @@ -22,10 +22,10 @@ as_analyzed_format(obj, cols = NULL, groups = NULL, \item{comp_func}{A Comparison based function used in \code{\link[metacoder]{compare_groups}}. Default: NULL} } \value{ -A Taxmap/metacoder object in the "analyzed_format". +A Taxmap object in the "analyzed_format". } \description{ -Converts a metacoder object to the analyzed_format. +Converts a Taxmap object to the analyzed_format. } \details{ See the \link{MicrobiomeR_Formats} documentation. @@ -42,8 +42,7 @@ Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_basic_format}}, \code{\link{as_custom_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, - \code{\link{melt_metacoder}}, + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/as_basic_format.Rd b/man/as_basic_format.Rd index fa0490c..3b4ac61 100644 --- a/man/as_basic_format.Rd +++ b/man/as_basic_format.Rd @@ -7,17 +7,17 @@ as_basic_format(obj, cols = NULL, out_names = NULL) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{cols}{Column names used for \code{\link[metacoder]{calc_taxon_abund}}. Default: NULL} \item{out_names}{Column names of the output used for \code{\link[metacoder]{calc_obs_props}}. Default: NULL} } \value{ -A Taxmap/metacoder object in the "basic_format". +A Taxmap object in the "basic_format". } \description{ -Converts a metacoder object to the basic_format. +Converts a Taxmap object to the basic_format. } \details{ See the \link{MicrobiomeR_Formats} documentation. @@ -32,8 +32,7 @@ Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_analyzed_format}}, \code{\link{as_custom_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, - \code{\link{melt_metacoder}}, + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/as_custom_format.Rd b/man/as_custom_format.Rd index 7b12526..2a338d9 100644 --- a/man/as_custom_format.Rd +++ b/man/as_custom_format.Rd @@ -7,7 +7,7 @@ as_custom_format(obj, format, change_name_list = NULL, ...) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{format}{The name of the format to convert the object to.} @@ -17,25 +17,24 @@ values that are used to change the names of the table. Default: NULL} \item{...}{An optional list of parameters to use in the as_*_format function specified} } \value{ -A metacoder object that we have tried to format with all of our heart. +A Taxmap object that we have tried to format with all of our heart. } \description{ -A function for formatting metacoder objects in the MicrobiomeR format. This function +A function for formatting Taxmap objects in the MicrobiomeR format. This function attempts to give more customization than the as_*_format functions. } \details{ -This function is meant to be more helpful for customizing the metacoder object. +This function is meant to be more helpful for customizing the Taxmap object. } \seealso{ -\code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{order_metacoder_data}}, \code{\link[MicrobiomeR]{as_MicrobiomeR_format}} +\code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{which_format}}, \code{\link[MicrobiomeR]{order_metacoder_data}}, \code{\link[MicrobiomeR]{as_MicrobiomeR_format}} Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_MicrobiomeR_format}}, \code{\link{as_analyzed_format}}, \code{\link{as_basic_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, - \code{\link{melt_metacoder}}, + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/as_phyloseq_format.Rd b/man/as_phyloseq_format.Rd index c3dfd0f..6d46255 100644 --- a/man/as_phyloseq_format.Rd +++ b/man/as_phyloseq_format.Rd @@ -9,7 +9,7 @@ as_phyloseq_format(obj, otu_table = "otu_abundance", phy_tree = "phy_tree") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{otu_table}{The name of the observation table with OTU data. Default: NULL} @@ -20,24 +20,23 @@ as_phyloseq_format(obj, otu_table = "otu_abundance", \item{phy_tree}{The name of the observation data with the phylogenetic tree. Default: NULL} } \value{ -A Taxmap/metacoder object in the phyloseq_format. +A Taxmap object in the phyloseq_format. } \description{ -Converts the metacoder object to the phyloseq_format. +Converts the Taxmap object to the phyloseq_format. } \details{ See the \link{MicrobiomeR_Formats} documentation. } \seealso{ -\code{\link[MicrobiomeR]{create_metacoder}},\code{\link[MicrobiomeR]{order_metacoder_data}} +\code{\link[MicrobiomeR]{create_taxmap}},\code{\link[MicrobiomeR]{order_metacoder_data}} Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_MicrobiomeR_format}}, \code{\link{as_analyzed_format}}, \code{\link{as_basic_format}}, \code{\link{as_custom_format}}, - \code{\link{as_raw_format}}, - \code{\link{melt_metacoder}}, + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/as_raw_format.Rd b/man/as_raw_format.Rd index 0035b30..54e84dc 100644 --- a/man/as_raw_format.Rd +++ b/man/as_raw_format.Rd @@ -7,13 +7,13 @@ as_raw_format(obj) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} } \value{ -A Taxmap/metacoder object in the "raw_format". +A Taxmap object in the "raw_format". } \description{ -Converts a metacoder object to the raw_format. +Converts a Taxmap object to the raw_format. } \details{ See the \link{MicrobiomeR_Formats} documentation. @@ -28,7 +28,6 @@ Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_basic_format}}, \code{\link{as_custom_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{melt_metacoder}}, - \code{\link{treatment_matrix}} + \code{\link{melt_taxmap}}, \code{\link{treatment_matrix}} } \concept{Formatting} diff --git a/man/combination_palette.Rd b/man/combination_palette.Rd index 8b69d0d..f8c5db6 100644 --- a/man/combination_palette.Rd +++ b/man/combination_palette.Rd @@ -35,8 +35,13 @@ the ability to subset and reverse the palettes that are supplied. if(interactive()){ # Below is the code for the viridis_magma_palette function. # It's a good example of how to use the combination_palette function. -viridis_magma_palette <- function(viridis_number = 800, viridis_range = 300:viridis_number, viridis_rev = TRUE, - magma_number = 500, magma_range = 0:magma_number, magma_rev = FALSE, ...) { +viridis_magma_palette <- function(viridis_number = 800, + viridis_range = 300:viridis_number, + viridis_rev = TRUE, + magma_number = 500, + magma_range = 0:magma_number, + magma_rev = FALSE, + ...) { if (!missing(...)){ v_args = list(n=viridis_number, ...) m_args = list(n=magma_number, ...) diff --git a/man/convert_proportions.Rd b/man/convert_proportions.Rd new file mode 100644 index 0000000..3d5d19c --- /dev/null +++ b/man/convert_proportions.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/barplot.R +\name{convert_proportions} +\alias{convert_proportions} +\title{Convert Proportions} +\usage{ +convert_proportions(melted_df, tax_level) +} +\arguments{ +\item{melted_df}{A "melted" dataframe from the metacoder object's data.} + +\item{tax_level}{The taxonomic level, Default: 'Phylum'} +} +\description{ +Convert Proportions +} +\seealso{ +Other Data Manipulators: \code{\link{metacoder_comp_func_1}}, + \code{\link{transformer}}, \code{\link{transposer}}, + \code{\link{vlookup}} +} +\concept{Data Manipulators} diff --git a/man/correlation_data.Rd b/man/correlation_data.Rd index 3218209..6a78c82 100644 --- a/man/correlation_data.Rd +++ b/man/correlation_data.Rd @@ -8,7 +8,7 @@ correlation_data(obj, primary_rank, secondary_rank = TRUE, wp_value = 0.05) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{primary_rank}{A primary rank used to label the points.} @@ -33,7 +33,7 @@ if(interactive()){ } } \seealso{ -\code{\link[MicrobiomeR]{agglomerate_metacoder}}, \code{\link[MicrobiomeR]{vlookup}} +\code{\link[MicrobiomeR]{agglomerate_taxmap}}, \code{\link[MicrobiomeR]{vlookup}} \code{\link[dplyr]{tidyeval}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr]{filter}}, \code{\link[dplyr]{arrange}} @@ -44,13 +44,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/correlation_plot.Rd b/man/correlation_plot.Rd index 8b8eeba..5ec4038 100644 --- a/man/correlation_plot.Rd +++ b/man/correlation_plot.Rd @@ -5,10 +5,10 @@ \title{Correlation Plot} \usage{ correlation_plot(obj, primary_rank, secondary_rank = TRUE, - wp_value = 0.05, pal_func = NULL) + wp_value = 0.05, pal_func = NULL, trans = "logit") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{primary_rank}{The primary rank used to label the points.} @@ -18,6 +18,10 @@ the number of supertaxon ranks above the primary rank or the name of a supertaxo \item{wp_value}{The Wilcoxian P-Value used to represent significant points. Default: 0.05} \item{pal_func}{A palette function that returns grDevices::colorRampPalette.} + +\item{trans}{Either the name of a transformation object, or the object itself given to \code{\link[ggplot2]{scale_continuous}}. +Built-in transformations include "asn", "atanh", "boxcox", "exp", "identity", "log", "log10", "log1p", +"log2", "logit", "probability", "probit", "reciprocal", "reverse" and "sqrt".} } \value{ A 1:1 correlation plot built with ggplot2. @@ -40,7 +44,7 @@ correlation_plot(analyzed_silva, primary_rank = "Class", secondary_rank = "Phylu } } \seealso{ -\code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{correlation_data}}, \code{\link[MicrobiomeR]{plot_limits}}, \code{\link[MicrobiomeR]{get_color_palette}} +\code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{correlation_data}}, \code{\link[MicrobiomeR]{plot_limits}}, \code{\link[MicrobiomeR]{get_color_palette}} \code{\link[ggplot2]{ggplot}}, \code{\link[ggplot2]{aes}}, \code{\link[ggplot2]{geom_polygon}}, \code{\link[ggplot2]{geom_point}}, \code{\link[ggplot2]{labs}}, \code{\link[ggplot2]{scale_continuous}}, \code{\link[ggplot2]{scale_manual}}, \code{\link[ggplot2]{guide_legend}}, \code{\link[ggplot2]{geom_abline}} @@ -53,13 +57,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plots}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/correlation_plots.Rd b/man/correlation_plots.Rd index b295207..c70ae12 100644 --- a/man/correlation_plots.Rd +++ b/man/correlation_plots.Rd @@ -7,7 +7,7 @@ correlation_plots(obj, primary_ranks, secondary_ranks = TRUE, ...) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{primary_ranks}{A vector of primary ranks used to label the points.} @@ -45,13 +45,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/cov_filter.Rd b/man/cov_filter.Rd index ab8aa30..29b9151 100644 --- a/man/cov_filter.Rd +++ b/man/cov_filter.Rd @@ -7,7 +7,7 @@ cov_filter(obj, coefficient_of_variation, validated = FALSE) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{coefficient_of_variation}{The maximum CoV that an OTU can have.} @@ -32,10 +32,10 @@ library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -84,7 +84,7 @@ metacoder_obj <- cov_filter(obj = metacoder_obj, \code{\link[dplyr:summarise_all]{summarise_if}} -Other Advanced Metacoder Filters: \code{\link{agglomerate_metacoder}}, +Other Advanced Metacoder Filters: \code{\link{agglomerate_taxmap}}, \code{\link{otu_prevalence_filter}}, \code{\link{otu_proportion_filter}}, \code{\link{taxa_prevalence_filter}} diff --git a/man/create_phyloseq.Rd b/man/create_phyloseq.Rd index 603b9ab..a5655b2 100644 --- a/man/create_phyloseq.Rd +++ b/man/create_phyloseq.Rd @@ -61,7 +61,10 @@ md_file <- system.file("extdata", "nephele_metadata2.txt", package = "Microbiome parse_func <- parse_parse_taxonomy_silva_128 } # Create a phyloseq object from the data files. -phy_obj <- create_phyloseq(biom_file = biom_file, tree_file = tree_file, metadata_file = md_file, parse_func = parse_func) +phy_obj <- create_phyloseq(biom_file = biom_file, + tree_file = tree_file, + metadata_file = md_file, + parse_func = parse_func) } } \seealso{ @@ -71,6 +74,6 @@ phy_obj <- create_phyloseq(biom_file = biom_file, tree_file = tree_file, metadat \code{\link[MicrobiomeR]{root_by_longest_edge}} -Other Data Importers: \code{\link{create_metacoder}} +Other Data Importers: \code{\link{create_taxmap}} } \concept{Data Importers} diff --git a/man/create_metacoder.Rd b/man/create_taxmap.Rd similarity index 82% rename from man/create_metacoder.Rd rename to man/create_taxmap.Rd index 1c2bcf5..e184a1d 100644 --- a/man/create_metacoder.Rd +++ b/man/create_taxmap.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.R -\name{create_metacoder} -\alias{create_metacoder} -\title{Get Metacoder Object} +\name{create_taxmap} +\alias{create_taxmap} +\title{Get Taxmap Object} \usage{ -create_metacoder(obj) +create_taxmap(obj) } \arguments{ \item{obj}{An object that contains the data being analyzed. Can be one of the following: @@ -18,7 +18,7 @@ create_metacoder(obj) The output generated is a \strong{taxa::taxmap} object. } \description{ -A function that handles the conversion of objects to metacoder (\strong{taxa::taxmap}) objects. +A function that handles the conversion of objects to Taxmap (\strong{taxa::taxmap}) objects. } \details{ This function is used to convert data to metacoder/taxmap objects for \emph{microbiome} analysis. @@ -30,7 +30,7 @@ for the obj parameter in those functions. if(interactive()){ library(MicrobiomeR) phy_obj <- MicrobiomeR::phyloseq_silva_2 - mc_obj <- create_metacoder(phy_obj) + mc_obj <- create_taxmap(phy_obj) } } } diff --git a/man/heat_tree_parameters.Rd b/man/heat_tree_parameters.Rd index f851936..8d321fc 100644 --- a/man/heat_tree_parameters.Rd +++ b/man/heat_tree_parameters.Rd @@ -7,7 +7,7 @@ heat_tree_parameters(obj, title, treatment_no, ...) } \arguments{ -\item{obj}{A metacoder object.} +\item{obj}{A Taxmap object.} \item{title}{The title used in the heat_tree plot.} @@ -17,7 +17,7 @@ heat_tree_parameters(obj, title, treatment_no, ...) output is displayed. However, this function acts as a default list of parameters. The memebers of the default list will be overridden by the dot parameters. Any variable in obj$data$stats_tax_data can be used to manipulate the heat tree parameters. Function calls from the taxa package must -be done explicitely on the metacoder object.} +be done explicitely on the Taxmap object.} } \value{ A list used with do.call and the metacoder::heat_tree function. @@ -39,13 +39,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plots}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/heat_tree_plots.Rd b/man/heat_tree_plots.Rd index c01691b..e84e54b 100644 --- a/man/heat_tree_plots.Rd +++ b/man/heat_tree_plots.Rd @@ -4,13 +4,16 @@ \alias{heat_tree_plots} \title{Get Heat Tree Plots} \usage{ -heat_tree_plots(obj, rank_list = NULL, ...) +heat_tree_plots(obj, rank_list = NULL, title = TRUE, ...) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{rank_list}{A vector of ranks used to generate heat_trees. Default: NULL} +\item{title}{Can be a logical, NULL, or a string. The string can utilize \code{{rank}} to dynamically +display the rank in the title via \code{\link[glue]{glue}}.} + \item{...}{Any of the \code{\link[metacoder]{heat_tree}} parameters can be used to change the way the heat_tree output is displayed. Please see the \code{\link[MicrobiomeR]{heat_tree_parameters}} documentation for further explanation.} @@ -36,7 +39,7 @@ h_trees$Class \seealso{ \code{\link[metacoder]{heat_tree}} -\code{\link[MicrobiomeR]{create_metacoder}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{heat_tree_parameters}} +\code{\link[MicrobiomeR]{create_taxmap}}, \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}}, \code{\link[MicrobiomeR]{heat_tree_parameters}} \code{\link[taxa]{filter_obs}} @@ -49,13 +52,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plots}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/is_analyzed_format.Rd b/man/is_analyzed_format.Rd index b2d66b9..1f53362 100644 --- a/man/is_analyzed_format.Rd +++ b/man/is_analyzed_format.Rd @@ -7,7 +7,7 @@ is_analyzed_format(obj) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} } \value{ A logical (TRUE/FALSE). diff --git a/man/is_basic_format.Rd b/man/is_basic_format.Rd index 04df203..d0c186f 100644 --- a/man/is_basic_format.Rd +++ b/man/is_basic_format.Rd @@ -7,7 +7,7 @@ is_basic_format(obj) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} } \value{ A logical (TRUE/FALSE). diff --git a/man/is_phyloseq_format.Rd b/man/is_phyloseq_format.Rd index 4c2659b..9179c92 100644 --- a/man/is_phyloseq_format.Rd +++ b/man/is_phyloseq_format.Rd @@ -7,7 +7,7 @@ is_phyloseq_format(obj) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} } \value{ A logical (TRUE/FALSE). diff --git a/man/is_raw_format.Rd b/man/is_raw_format.Rd index cff19a0..1d3e873 100644 --- a/man/is_raw_format.Rd +++ b/man/is_raw_format.Rd @@ -7,7 +7,7 @@ is_raw_format(obj) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} } \value{ A logical (TRUE/FALSE). diff --git a/man/melt_taxmap.Rd b/man/melt_taxmap.Rd new file mode 100644 index 0000000..816269c --- /dev/null +++ b/man/melt_taxmap.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/barplot.R +\name{melt_taxmap} +\alias{melt_taxmap} +\title{Melt Taxmap} +\usage{ +melt_taxmap(obj) +} +\arguments{ +\item{obj}{An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} +} +\description{ +Melt Taxmap +} +\seealso{ +Other Formatting: \code{\link{MicrobiomeR_Formats}}, + \code{\link{as_MicrobiomeR_format}}, + \code{\link{as_analyzed_format}}, + \code{\link{as_basic_format}}, + \code{\link{as_custom_format}}, + \code{\link{as_phyloseq_format}}, + \code{\link{as_raw_format}}, + \code{\link{treatment_matrix}} +} +\concept{Formatting} diff --git a/man/metacoder_comp_func_1.Rd b/man/metacoder_comp_func_1.Rd index afd7e74..ff1f1fd 100644 --- a/man/metacoder_comp_func_1.Rd +++ b/man/metacoder_comp_func_1.Rd @@ -26,7 +26,7 @@ every combination of treatment groups. \code{\link[modes]{bimodality_coefficient}} -Other Data Manipulators: \code{\link{melt_metacoder}}, +Other Data Manipulators: \code{\link{convert_proportions}}, \code{\link{transformer}}, \code{\link{transposer}}, \code{\link{vlookup}} } diff --git a/man/order_metacoder_data.Rd b/man/order_metacoder_data.Rd index fdc83cc..7dd3aff 100644 --- a/man/order_metacoder_data.Rd +++ b/man/order_metacoder_data.Rd @@ -7,13 +7,13 @@ order_metacoder_data(obj) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} } \value{ A taxmap object with observation data in the proper order for downstream analysis. } \description{ -A function for changing the order of the observation data in a metacoder object +A function for changing the order of the observation data in a Taxmap object } \details{ Changes the order of the observation tables in \strong{metacoder_object$data} to diff --git a/man/ordination_plot.Rd b/man/ordination_plot.Rd index 7b7229c..fc1c631 100644 --- a/man/ordination_plot.Rd +++ b/man/ordination_plot.Rd @@ -2,18 +2,13 @@ % Please edit documentation in R/ordination.R \name{ordination_plot} \alias{ordination_plot} -\alias{ordination_plots} \title{Ordination Plot} \usage{ ordination_plot(obj, method = "PCoA", distance = "wunifrac", color = "TreatmentGroup", title = NULL, only_data = FALSE) - -ordination_plots(obj, methods = c("PCoA", "NMDS"), - distances = c("wunifrac", "unifrac", "bray"), - color = "TreatmentGroup", select_otu_table = "otu_proportions") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{method}{Choose an ordination method from 'PCoA', 'CCA', 'NMDS' or 'DPCoA', Default: 'PCoA'} @@ -24,22 +19,12 @@ ordination_plots(obj, methods = c("PCoA", "NMDS"), \item{title}{The title of the plot, Default: NULL} \item{only_data}{Allows for only ordination data to be generated, Default: FALSE} - -\item{methods}{A list of ordination methods, Default: 'c("PCoA", "NMDS")'} - -\item{distances}{A list of distance methods, Default: 'c("wunifrac", "unifrac", "bray")'} - -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} } \value{ By default, it returns an ordination plot. - -Returns a melted dataframe. } \description{ This function allows for ordination (which helps us to distinguish beta diversity relationships) to be plotted as well as for the corresponding data to be returned. - -Generate plots for a list of ordination methods and distances. } \examples{ \dontrun{ @@ -61,26 +46,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, \code{\link{plot_limits}}, - \code{\link{save_alpha_diversity_plots}}, - \code{\link{save_correlation_plots}}, - \code{\link{save_heat_tree_plots}}, - \code{\link{save_ordination_plots}}, - \code{\link{save_stacked_barplots}}, - \code{\link{top_coefficients_barplot}} - -Other Visualizations: \code{\link{alpha_diversity_plot}}, - \code{\link{correlation_data}}, - \code{\link{correlation_plots}}, - \code{\link{correlation_plot}}, - \code{\link{heat_tree_parameters}}, - \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, \code{\link{plot_limits}}, + \code{\link{ordination_plots}}, + \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/ordination_plots.Rd b/man/ordination_plots.Rd new file mode 100644 index 0000000..b4ffe33 --- /dev/null +++ b/man/ordination_plots.Rd @@ -0,0 +1,45 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ordination.R +\name{ordination_plots} +\alias{ordination_plots} +\title{Ordination Plots} +\usage{ +ordination_plots(obj, methods = c("PCoA", "NMDS"), + distances = c("wunifrac", "unifrac", "bray"), + color = "TreatmentGroup", select_otu_table = "otu_proportions") +} +\arguments{ +\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_taxmap}}.} + +\item{methods}{A list of ordination methods, Default: 'c("PCoA", "NMDS")'} + +\item{distances}{A list of distance methods, Default: 'c("wunifrac", "unifrac", "bray")'} + +\item{color}{Choose the group or factor of which colors will be mapped to, Default: 'TreatmentGroup'} + +\item{select_otu_table}{The data table to use in the observation data. Default: "otu_proportions"} +} +\value{ +Returns a melted dataframe. +} +\description{ +Generate plots for a list of ordination methods and distances. +} +\seealso{ +Other Visualizations: \code{\link{alpha_diversity_plot}}, + \code{\link{correlation_data}}, + \code{\link{correlation_plots}}, + \code{\link{correlation_plot}}, + \code{\link{heat_tree_parameters}}, + \code{\link{heat_tree_plots}}, + \code{\link{ordination_plot}}, \code{\link{plot_limits}}, + \code{\link{save_alpha_diversity_plots}}, + \code{\link{save_correlation_plots}}, + \code{\link{save_heat_tree_plots}}, + \code{\link{save_ordination_plots}}, + \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, + \code{\link{top_coefficients_barplot}} +} +\concept{Visualizations} diff --git a/man/otu_id_filter.Rd b/man/otu_id_filter.Rd index 5d0745c..4597870 100644 --- a/man/otu_id_filter.Rd +++ b/man/otu_id_filter.Rd @@ -2,13 +2,13 @@ % Please edit documentation in R/metacoder.R \name{otu_id_filter} \alias{otu_id_filter} -\title{Filter OTU Ids from Metacoder Objects} +\title{Filter OTU Ids from Taxmap Objects} \usage{ otu_id_filter(obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ...) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{.f_transform}{A function used for transforming the data. Default: NULL} @@ -21,7 +21,7 @@ otu_id_filter(obj, .f_transform = NULL, .f_filter = NULL, \item{...}{An optional list of parameters to use in the .f_filter function specified} } \value{ -Returns a metacoder object with otu_ids that pass the filters. +Returns a taxmap object with otu_ids that pass the filters. } \description{ This function provides a flexible way to filter unwanted otu_ids from the taxmap object and from the @@ -41,8 +41,11 @@ if(interactive()){ library(MicrobiomeR) otu_proportion_filter <- function(obj, otu_percentage = 0.00005, validated = FALSE) { mo_clone <- obj$clone() - mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, valid_formats = c("raw_format", "basic_format"), - force_format = TRUE, validated = validated, min_or_max = min) + mo_clone <- validate_MicrobiomeR_format(obj = mo_clone, + valid_formats = c("raw_format", "basic_format"), + force_format = TRUE, + validated = validated, + min_or_max = min) # Filter OTU ids mo_clone <- otu_id_filter(obj = mo_clone, .f_transform = ~./sum(.), diff --git a/man/otu_prevalence_filter.Rd b/man/otu_prevalence_filter.Rd index 8591096..1c5d577 100644 --- a/man/otu_prevalence_filter.Rd +++ b/man/otu_prevalence_filter.Rd @@ -8,7 +8,7 @@ otu_prevalence_filter(obj, minimum_abundance = 5, rel_sample_percentage = 0.5, validated = FALSE) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{minimum_abundance}{The minimum abundance needed per observation per sample. Default: 5} @@ -34,10 +34,10 @@ library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -72,7 +72,7 @@ metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, validated = TRUE) \code{\link[taxa]{filter_taxa}} -Other Advanced Metacoder Filters: \code{\link{agglomerate_metacoder}}, +Other Advanced Metacoder Filters: \code{\link{agglomerate_taxmap}}, \code{\link{cov_filter}}, \code{\link{otu_proportion_filter}}, \code{\link{taxa_prevalence_filter}} diff --git a/man/otu_proportion_filter.Rd b/man/otu_proportion_filter.Rd index ad16041..79f189c 100644 --- a/man/otu_proportion_filter.Rd +++ b/man/otu_proportion_filter.Rd @@ -7,7 +7,7 @@ otu_proportion_filter(obj, otu_percentage = 5e-05, validated = FALSE) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{otu_percentage}{The minimum percentage used to compare against the proportional OTU mean. Default: 5e-05} @@ -32,10 +32,10 @@ library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -61,7 +61,7 @@ metacoder_obj <- otu_proportion_filter( \seealso{ \code{\link[MicrobiomeR]{validate_MicrobiomeR_format}},\code{\link[MicrobiomeR]{otu_id_filter}} -Other Advanced Metacoder Filters: \code{\link{agglomerate_metacoder}}, +Other Advanced Metacoder Filters: \code{\link{agglomerate_taxmap}}, \code{\link{cov_filter}}, \code{\link{otu_prevalence_filter}}, \code{\link{taxa_prevalence_filter}} diff --git a/man/parse_taxonomy_silva_128.Rd b/man/parse_taxonomy_silva_128.Rd index 90c5b0a..0892e81 100644 --- a/man/parse_taxonomy_silva_128.Rd +++ b/man/parse_taxonomy_silva_128.Rd @@ -4,10 +4,7 @@ \alias{parse_taxonomy_silva_128} \title{Parse elements of a taxonomy vector} \usage{ -parse_taxonomy_default(char.vec) -parse_taxonomy_greengenes(char.vec) parse_taxonomy_silva_128(char.vec) -parse_taxonomy_qiime(char.vec) } \arguments{ \item{char.vec}{(Required). A single character vector of taxonomic @@ -69,7 +66,8 @@ then please comment on the GitHub PR to encourage merging this feature. \examples{ \dontrun{ - > taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales", "f__Staphylococcaceae") + > taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales", + "f__Staphylococcaceae") > parse_taxonomy_default(taxvec1) > parse_taxonomy_greengenes(taxvec1) > taxvec2 = c("Root;k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Staphylococcaceae") diff --git a/man/permanova.Rd b/man/permanova.Rd index 773fa10..0505d4e 100644 --- a/man/permanova.Rd +++ b/man/permanova.Rd @@ -7,7 +7,7 @@ permanova(obj, distance_method = "bray", group = "TreatmentGroup") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{distance_method}{Use a desired distance method, Default: 'bray'} diff --git a/man/plot_limits.Rd b/man/plot_limits.Rd index 75556e0..96f5d62 100644 --- a/man/plot_limits.Rd +++ b/man/plot_limits.Rd @@ -24,13 +24,15 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/sample_id_filter.Rd b/man/sample_id_filter.Rd index f2b5e09..51a5cb4 100644 --- a/man/sample_id_filter.Rd +++ b/man/sample_id_filter.Rd @@ -2,13 +2,13 @@ % Please edit documentation in R/metacoder.R \name{sample_id_filter} \alias{sample_id_filter} -\title{Filter Samples Ids from Metacoder Objects} +\title{Filter Samples Ids from Taxmap Objects} \usage{ sample_id_filter(obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ...) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{.f_transform}{A function used for transforming the data. Default: NULL} @@ -21,7 +21,7 @@ sample_id_filter(obj, .f_transform = NULL, .f_filter = NULL, \item{...}{An optional list of parameters to use in the .f_filter function specified} } \value{ -Returns a metacoder object with samples that pass the filters. +Returns a Taxmap object with samples that pass the filters. } \description{ This function provides a flexible way to filter unwanted samples from the @@ -40,10 +40,10 @@ if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_silva_2, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", diff --git a/man/save_alpha_diversity_plots.Rd b/man/save_alpha_diversity_plots.Rd index 2df1753..b487cf0 100644 --- a/man/save_alpha_diversity_plots.Rd +++ b/man/save_alpha_diversity_plots.Rd @@ -50,12 +50,14 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/save_correlation_plots.Rd b/man/save_correlation_plots.Rd index 923c555..3fb1272 100644 --- a/man/save_correlation_plots.Rd +++ b/man/save_correlation_plots.Rd @@ -50,12 +50,14 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/save_heat_tree_plots.Rd b/man/save_heat_tree_plots.Rd index 09efb45..34c360b 100644 --- a/man/save_heat_tree_plots.Rd +++ b/man/save_heat_tree_plots.Rd @@ -50,12 +50,14 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/save_ordination_plots.Rd b/man/save_ordination_plots.Rd index 46a37d9..a226e12 100644 --- a/man/save_ordination_plots.Rd +++ b/man/save_ordination_plots.Rd @@ -43,12 +43,14 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/save_stacked_barplots.Rd b/man/save_stacked_barplots.Rd index 1ae7561..ed09a49 100644 --- a/man/save_stacked_barplots.Rd +++ b/man/save_stacked_barplots.Rd @@ -50,12 +50,14 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}}, \code{\link{top_coefficients_barplot}} } \concept{Visualizations} diff --git a/man/stacked_barplot.Rd b/man/stacked_barplot.Rd index b0992b0..1bc4e1d 100644 --- a/man/stacked_barplot.Rd +++ b/man/stacked_barplot.Rd @@ -1,27 +1,15 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/barplot.R -\name{melt_metacoder} -\alias{melt_metacoder} -\alias{convert_proportions} +\name{stacked_barplot} \alias{stacked_barplot} -\alias{stacked_barplots} \title{Stacked Barplot} \usage{ -melt_metacoder(obj) - -convert_proportions(melted_df, tax_level) - stacked_barplot(obj, tax_level = "Phylum", fill = "Phylum", xlabel = "Samples", faceted = FALSE, title = NULL, palette_values = NULL) - -stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order"), - group = "TreatmentGroup", select_otu_table = "otu_proportions") } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} - -\item{melted_df}{A "melted" dataframe from the metacoder object's data.} +\item{obj}{An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} \item{tax_level}{The taxonomic level, Default: 'Phylum'} @@ -34,8 +22,6 @@ stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order"), \item{title}{The title or name of the plot.} \item{palette_values}{A list of the colors to input to be mapped to the plot palette, Default: 'NULL'} - -\item{tax_levels}{The taxonomic levels, Default: 'c("Phylum", "Class", "Order")'} } \value{ Returns a stacked barplot. @@ -57,47 +43,20 @@ if (interactive()) { } } \seealso{ -Other Formatting: \code{\link{MicrobiomeR_Formats}}, - \code{\link{as_MicrobiomeR_format}}, - \code{\link{as_analyzed_format}}, - \code{\link{as_basic_format}}, - \code{\link{as_custom_format}}, - \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, - \code{\link{treatment_matrix}} - -Other Data Manipulators: \code{\link{metacoder_comp_func_1}}, - \code{\link{transformer}}, \code{\link{transposer}}, - \code{\link{vlookup}} - -Other Visualizations: \code{\link{alpha_diversity_plot}}, - \code{\link{correlation_data}}, - \code{\link{correlation_plots}}, - \code{\link{correlation_plot}}, - \code{\link{heat_tree_parameters}}, - \code{\link{heat_tree_plots}}, - \code{\link{ordination_plot}}, \code{\link{plot_limits}}, - \code{\link{save_alpha_diversity_plots}}, - \code{\link{save_correlation_plots}}, - \code{\link{save_heat_tree_plots}}, - \code{\link{save_ordination_plots}}, - \code{\link{save_stacked_barplots}}, - \code{\link{top_coefficients_barplot}} - Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_data}}, \code{\link{correlation_plots}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, \code{\link{top_coefficients_barplot}} } -\concept{Data Manipulators} -\concept{Formatting} \concept{Visualizations} diff --git a/man/stacked_barplots.Rd b/man/stacked_barplots.Rd new file mode 100644 index 0000000..7f8dc26 --- /dev/null +++ b/man/stacked_barplots.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/barplot.R +\name{stacked_barplots} +\alias{stacked_barplots} +\title{Stacked Barplots} +\usage{ +stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order")) +} +\arguments{ +\item{obj}{An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} + +\item{tax_levels}{The taxonomic levels, Default: 'c("Phylum", "Class", "Order")'} +} +\description{ +Stacked Barplots +} +\seealso{ +Other Visualizations: \code{\link{alpha_diversity_plot}}, + \code{\link{correlation_data}}, + \code{\link{correlation_plots}}, + \code{\link{correlation_plot}}, + \code{\link{heat_tree_parameters}}, + \code{\link{heat_tree_plots}}, + \code{\link{ordination_plots}}, + \code{\link{ordination_plot}}, \code{\link{plot_limits}}, + \code{\link{save_alpha_diversity_plots}}, + \code{\link{save_correlation_plots}}, + \code{\link{save_heat_tree_plots}}, + \code{\link{save_ordination_plots}}, + \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplot}}, + \code{\link{top_coefficients_barplot}} +} +\concept{Visualizations} diff --git a/man/taxa_prevalence_filter.Rd b/man/taxa_prevalence_filter.Rd index 7ffcf0c..8c5f68e 100644 --- a/man/taxa_prevalence_filter.Rd +++ b/man/taxa_prevalence_filter.Rd @@ -8,7 +8,7 @@ taxa_prevalence_filter(obj, rank, minimum_abundance = 5, rel_sample_percentage = 0.5, validated = FALSE) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{rank}{The rank being analyzed for prevalence across samples.} @@ -36,10 +36,10 @@ library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", @@ -84,7 +84,7 @@ metacoder_obj <- taxa_prevalence_filter( \code{\link[taxa]{filter_taxa}} -Other Advanced Metacoder Filters: \code{\link{agglomerate_metacoder}}, +Other Advanced Metacoder Filters: \code{\link{agglomerate_taxmap}}, \code{\link{cov_filter}}, \code{\link{otu_prevalence_filter}}, \code{\link{otu_proportion_filter}} diff --git a/man/taxon_id_filter.Rd b/man/taxon_id_filter.Rd index 7b7bb0c..647fc33 100644 --- a/man/taxon_id_filter.Rd +++ b/man/taxon_id_filter.Rd @@ -2,13 +2,13 @@ % Please edit documentation in R/metacoder.R \name{taxon_id_filter} \alias{taxon_id_filter} -\title{Filter Taxon Ids from Metacoder Objects} +\title{Filter Taxon Ids from Taxmap Objects} \usage{ taxon_id_filter(obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ...) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{.f_transform}{A function used for transforming the data. Default: NULL} @@ -21,7 +21,7 @@ taxon_id_filter(obj, .f_transform = NULL, .f_filter = NULL, \item{...}{An optional list of parameters to use in the .f_filter function specified} } \value{ -Returns a metacoder object with taxon_ids that pass the filters. +Returns a Taxmap object with taxon_ids that pass the filters. } \description{ This function provides a flexible way to filter unwanted taxon_ids from the taxmap object and from the @@ -39,10 +39,10 @@ if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) -# Convert Phyloseq object to metacoder object +# Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", diff --git a/man/top_coefficients_barplot.Rd b/man/top_coefficients_barplot.Rd index e911a55..c03e430 100644 --- a/man/top_coefficients_barplot.Rd +++ b/man/top_coefficients_barplot.Rd @@ -36,12 +36,14 @@ Other Visualizations: \code{\link{alpha_diversity_plot}}, \code{\link{correlation_plot}}, \code{\link{heat_tree_parameters}}, \code{\link{heat_tree_plots}}, - \code{\link{melt_metacoder}}, + \code{\link{ordination_plots}}, \code{\link{ordination_plot}}, \code{\link{plot_limits}}, \code{\link{save_alpha_diversity_plots}}, \code{\link{save_correlation_plots}}, \code{\link{save_heat_tree_plots}}, \code{\link{save_ordination_plots}}, - \code{\link{save_stacked_barplots}} + \code{\link{save_stacked_barplots}}, + \code{\link{stacked_barplots}}, + \code{\link{stacked_barplot}} } \concept{Visualizations} diff --git a/man/transformer.Rd b/man/transformer.Rd index 2b742f9..b7a49d5 100644 --- a/man/transformer.Rd +++ b/man/transformer.Rd @@ -62,7 +62,7 @@ if(interactive()){ \code{\link[dplyr]{select_all}}, \code{\link[dplyr]{select}} \code{\link[purrr]{modify}} -Other Data Manipulators: \code{\link{melt_metacoder}}, +Other Data Manipulators: \code{\link{convert_proportions}}, \code{\link{metacoder_comp_func_1}}, \code{\link{transposer}}, \code{\link{vlookup}} } diff --git a/man/transposer.Rd b/man/transposer.Rd index 5a855d9..435190e 100644 --- a/man/transposer.Rd +++ b/man/transposer.Rd @@ -56,7 +56,7 @@ if(interactive()){ \code{\link[stringr]{str_detect}}, \code{\link[stringr]{str_count}} -Other Data Manipulators: \code{\link{melt_metacoder}}, +Other Data Manipulators: \code{\link{convert_proportions}}, \code{\link{metacoder_comp_func_1}}, \code{\link{transformer}}, \code{\link{vlookup}} } diff --git a/man/treatment_matrix.Rd b/man/treatment_matrix.Rd index 68ccc79..04f18fa 100644 --- a/man/treatment_matrix.Rd +++ b/man/treatment_matrix.Rd @@ -7,7 +7,7 @@ treatment_matrix(obj) } \arguments{ -\item{obj}{An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.} +\item{obj}{An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.} } \value{ A matrix with each column representing a comparison to be made. @@ -32,6 +32,6 @@ Other Formatting: \code{\link{MicrobiomeR_Formats}}, \code{\link{as_basic_format}}, \code{\link{as_custom_format}}, \code{\link{as_phyloseq_format}}, - \code{\link{as_raw_format}}, \code{\link{melt_metacoder}} + \code{\link{as_raw_format}}, \code{\link{melt_taxmap}} } \concept{Formatting} diff --git a/man/validate_MicrobiomeR_format.Rd b/man/validate_MicrobiomeR_format.Rd index ce86ff4..5e7dcda 100644 --- a/man/validate_MicrobiomeR_format.Rd +++ b/man/validate_MicrobiomeR_format.Rd @@ -8,7 +8,7 @@ validate_MicrobiomeR_format(obj, validated = FALSE, valid_formats, force_format = FALSE, min_or_max = base::max, ...) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} \item{validated}{This parameter provides a way to override validation steps. Use carefully. Default: FALSE} @@ -23,10 +23,10 @@ level format, while max will choose the highest level format. Default: base::ma \item{...}{An optional list of parameters to use in \code{\link[MicrobiomeR]{as_MicrobiomeR_format}}.} } \value{ -If the object is validated, a Taxmap/metacoder object. +If the object is validated, a Taxmap object. } \description{ -This funciton validates that taxmap/metacoder objects are in a valid format MicrobiomeR format. +This funciton validates that Taxmap objects are in a valid format MicrobiomeR format. } \details{ This function can provide a way to check if a taxmap object has undergone a diff --git a/man/vlookup.Rd b/man/vlookup.Rd index 35baee7..0116039 100644 --- a/man/vlookup.Rd +++ b/man/vlookup.Rd @@ -33,7 +33,7 @@ if(interactive()){ } } \seealso{ -Other Data Manipulators: \code{\link{melt_metacoder}}, +Other Data Manipulators: \code{\link{convert_proportions}}, \code{\link{metacoder_comp_func_1}}, \code{\link{transformer}}, \code{\link{transposer}} } diff --git a/man/which_format.Rd b/man/which_format.Rd index 0d1bafa..fe3a72d 100644 --- a/man/which_format.Rd +++ b/man/which_format.Rd @@ -7,13 +7,13 @@ which_format(obj) } \arguments{ -\item{obj}{A Taxmap/metacoder object.} +\item{obj}{A Taxmap object.} } \value{ If the format is verified it returns a character string denoting the identified format. } \description{ -A function for looking at a metacoder object and returning the identified MicrobiomeR format. +A function for looking at a Taxmap object and returning the identified MicrobiomeR format. } \details{ This function is used to get basic information about the format of the taxmap object diff --git a/tests/testthat/test-metacoder-formatting.R b/tests/testthat/test-metacoder-formatting.R index a05aa4b..bc442f9 100644 --- a/tests/testthat/test-metacoder-formatting.R +++ b/tests/testthat/test-metacoder-formatting.R @@ -4,21 +4,21 @@ library(testthat) context("Testing of metacoder formatting functions") test_that("which_format works", { - expect_equal(which_format(create_metacoder(phyloseq_silva_2)), "phyloseq_format") + expect_equal(which_format(create_taxmap(phyloseq_silva_2)), "phyloseq_format") expect_equal(which_format(raw_silva_2), "raw_format") expect_equal(which_format(as_basic_format(raw_silva_2)), "basic_format") expect_equal(which_format(as_analyzed_format(raw_silva_2)), "analyzed_format") }) test_that("as_*_format works", { - expect_true(is_raw_format(as_raw_format(create_metacoder(phyloseq_silva_2)))) + expect_true(is_raw_format(as_raw_format(create_taxmap(phyloseq_silva_2)))) }) test_that("is_*_format works", { - expect_true(is_phyloseq_format(create_metacoder(phyloseq_silva_2))) + expect_true(is_phyloseq_format(create_taxmap(phyloseq_silva_2))) expect_false(is_phyloseq_format(raw_silva_2)) expect_true(is_raw_format(raw_silva_2)) - expect_false(is_raw_format(create_metacoder(phyloseq_silva_2))) + expect_false(is_raw_format(create_taxmap(phyloseq_silva_2))) expect_true(is_basic_format(as_basic_format(raw_silva_2))) expect_false(is_basic_format(raw_silva_2)) expect_true(is_analyzed_format(as_analyzed_format(raw_silva_2))) diff --git a/tests/testthat/test-metacoder.R b/tests/testthat/test-metacoder.R index 25dd932..163a368 100644 --- a/tests/testthat/test-metacoder.R +++ b/tests/testthat/test-metacoder.R @@ -20,8 +20,8 @@ test_that("basic otu_id_filter works", { expect_is(otu_id_filter(obj = raw_silva_2, .f_transform = ~./sum(.), .f_filter = ~mean(.), .f_condition = ~.> 0.00005), "Taxmap") }) -test_that("basic agglomerate_metacoder works", { - expect_false(any(unique(taxon_ranks(agglomerate_metacoder(raw_silva_2, "Phylum"))) %in% c("Class", "Order", "Family", "Genus", "Species"))) +test_that("basic agglomerate_taxmap works", { + expect_false(any(unique(taxon_ranks(agglomerate_taxmap(raw_silva_2, "Phylum"))) %in% c("Class", "Order", "Family", "Genus", "Species"))) }) test_that("basic otu_proportion_filter works", { diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index f126b9e..5ccbed8 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -9,7 +9,7 @@ basic_silva <- as_MicrobiomeR_format(raw_silva_2, format = "basic_format") test_that("output_dir function works", { expect_true(!dir.exists(output_dir(start_path="output", experiment="test", mkdir=FALSE))) expect_true(dir.exists(output_dir(start_path="output", experiment="test", mkdir=TRUE))) - expect_error(output_dir(start_path="output", experiment="test", mkdir=TRUE, overwrite=FALSE), paste0("The directory ", getwd(), "/output/test/", format(Sys.time(), "%Y-%m-%d_%s"), " already exists. And you don't want to overwrite the directory.")) + expect_warning(output_dir(start_path="output", experiment="test", mkdir=TRUE, overwrite=FALSE), paste0("The directory ", getwd(), "/output/test/", format(Sys.time(), "%Y-%m-%d_%s"), " already exists. And you don't want to overwrite the directory.")) expect_equal(output_dir(start_path="output", experiment="test", mkdir=FALSE), paste0(getwd(), "/output/test/", format(Sys.time(), "%Y-%m-%d_%s"))) expect_equal(output_dir(start_path="output", experiment="test", mkdir=FALSE, end_path = "cool"), paste0(getwd(), "/output/test/cool")) expect_equal(output_dir(mkdir=FALSE, plot_type = "cool"), paste0(getwd(), "/cool")) @@ -18,9 +18,9 @@ test_that("output_dir function works", { }) test_that("object handler works", { - expect_true(!is.null(create_metacoder(phyloseq_silva_2))) - expect_error(create_metacoder(obj = "data/raw_silva_2.rda"), "object 'metacoder_object' not found") - expect_error(create_metacoder(obj = NULL), "Please use a metacoder/phyloseq object or an rdata file.") + expect_true(!is.null(create_taxmap(phyloseq_silva_2))) + expect_error(create_taxmap(obj = "data/raw_silva_2.rda"), "object 'metacoder_object' not found") + expect_error(create_taxmap(obj = NULL), "Please use a metacoder/phyloseq object or an rdata file.") }) diff --git a/vignettes/Microbiome-Workflow.png b/vignettes/Microbiome-Workflow.png new file mode 100644 index 0000000..2a9e2bd Binary files /dev/null and b/vignettes/Microbiome-Workflow.png differ diff --git a/vignettes/about.Rmd b/vignettes/about.Rmd index 6a7c57e..fc985c0 100644 --- a/vignettes/about.Rmd +++ b/vignettes/about.Rmd @@ -12,6 +12,10 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) +library(dplyr) +if (requireNamespace("htmltools", quietly = TRUE)) { + htmlwidgets::setWidgetIdSeed(42) +} ``` The `MicrobiomeR` package was developed at the University of Mississippi Medical Center @@ -23,12 +27,9 @@ This package is associated with a microbiome study (article to be submitted soon ```{r, echo=FALSE, warning=FALSE} # set seed for reproducible widget id -if (requireNamespace("htmltools", quietly = TRUE)) { - htmlwidgets::setWidgetIdSeed(42) -} -library(leaflet) -leaflet() %>% - setView(lng = -90.1730625, lat = 32.3308125, zoom = 11) %>% - addTiles() %>% - addMarkers(lng = -90.1730625, lat = 32.3308125, popup = "UMMC's Guyton Research Complex") + +leaflet::leaflet() %>% + leaflet::setView(lng = -90.1730625, lat = 32.3308125, zoom = 11) %>% + leaflet::addTiles() %>% + leaflet::addMarkers(lng = -90.1730625, lat = 32.3308125, popup = "UMMC's Guyton Research Complex") ``` diff --git a/vignettes/analysis.Rmd b/vignettes/analysis.Rmd index d2dd7f1..8228ed5 100644 --- a/vignettes/analysis.Rmd +++ b/vignettes/analysis.Rmd @@ -45,7 +45,7 @@ raw_metacoder <- as_MicrobiomeR_format(obj = phy_obj, format = "raw_format") After importing data and formatting it, data should be filtered to reduce noise and if desired, to subset data. ```{r message=FALSE, warning=FALSE} -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder, taxon_names == "Archaea", subtaxa = TRUE, @@ -215,7 +215,7 @@ phy_obj <- create_phyloseq(biom_file = biom_file, # Get the taxmap object in the raw format raw_metacoder <- as_MicrobiomeR_format(obj = phy_obj, format = "raw_format") -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder, taxon_names == "Archaea", subtaxa = TRUE, diff --git a/vignettes/filtering.Rmd b/vignettes/filtering.Rmd index 2edb900..7c4f98c 100644 --- a/vignettes/filtering.Rmd +++ b/vignettes/filtering.Rmd @@ -45,7 +45,7 @@ such as `metacoder::filter_ambiguous_taxa()`, `taxa::filter_taxa()`, and `taxa:: can almost always be used in your workflow. ```{r message=FALSE, warning=FALSE} -# Remove Archaea from the metacoder object +# Remove Archaea from the taxmap object metacoder_obj <- taxa::filter_taxa(obj = raw_metacoder, taxon_names == "Archaea", subtaxa = TRUE, @@ -83,7 +83,7 @@ filtering functions mentioned above, they wrap common metacoder and taxa functio the tools found in the phyloseq package. Below I've mentioned some of them and how they relate to the phyloseq package: -* `agglomerate_metacoder()` is equivalent to `phyloseq::tax_glom()`. +* `agglomerate_taxmap()` is equivalent to `phyloseq::tax_glom()`. * `otu_proportion_filter()` is seen in the first step in phyloseq's [preprocessing](http://joey711.github.io/phyloseq/preprocess.html#preprocessing) vignette. * `Prevalence Filtering` functions filter observations by thier prevelance across samples. * (Unsupervised) `otu_prevelance_filter()` is seen in phyloseq's [prevalence @@ -130,7 +130,7 @@ metacoder_obj <- cov_filter(obj = metacoder_obj, As mentioned previously taxmap filtering can be done in any way that fits your needs with the `taxa` and `metacoder` packages. However, MicrobiomeR also provides some utility based function for filtering/manipulating your _observation_ data by hand. Observation data can be accessed within -the metacoder object. Make sure you don't manipulate existing data inside of your taxmap object +the taxmap object. Make sure you don't manipulate existing data inside of your taxmap object unless you're absolutely sure you know what you're doing. ## Transposing @@ -189,8 +189,8 @@ This function was # borrowed from \url{https://www.r-bloggers.com/an-r-vlookup-n metacoder_obj <- as_MicrobiomeR_format(obj = metacoder_obj, format = "analyzed_format") # Create agglomerated taxmaps for phylum/class -phylum_mo <- agglomerate_metacoder(obj = metacoder_obj, rank = "Phylum") -class_mo <- agglomerate_metacoder(obj = metacoder_obj, rank = "Class") +phylum_mo <- agglomerate_taxmap(obj = metacoder_obj, rank = "Phylum") +class_mo <- agglomerate_taxmap(obj = metacoder_obj, rank = "Class") # Get some observation data phylum_data <- phylum_mo$data$stats_tax_data class_data <- class_mo$data$stats_tax_data diff --git a/vignettes/paper.Rmd b/vignettes/paper.Rmd new file mode 100644 index 0000000..6cac108 --- /dev/null +++ b/vignettes/paper.Rmd @@ -0,0 +1,55 @@ +--- +title: "MicrobiomeR: An R Package for Simplified and Standardized Microbiome Analysis Workflows (Draft to JOSS)" +author: +- Robert A Gilmore +- Shaurita Hutchins +- Xiao Zhang +- Eric Vallender +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Paper} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} + title: 'MicrobiomeR: An R Package for Simplified and Standardized Microbiome Analysis Workflows' +bibliography: paper.bib +--- + +# Summary + +The term “microbiome” refers to the microbial community in a given environment. In particular, it has recently risen to prominence in medicine to refer to the human oral, skin, urogenital, and digestive tract commensal bacterial communities. Modern technologies allow for the characterization of microbiome composition by high-throughput sequencing of 16S ribosomal DNA that effectively serves as identifying “bar codes”. Research studies focus on comparing differences in microbiomes between environments or changes within environments over time. To ensure study rigor and reproducibility it is important that data processing be clearly described and standardized. This package aims to unify the processing, analysis, and visualization tools necessary for modern microbiome studies under a transparent and straightforward implementation that facilitates standardization in analysis and reporting. + +Previous open source microbiome packages available for R [@r-core] (e.g. **vegan** and **microbiome**) have been developed, but lack the functionality afforded to more modern tools including **phyloseq** [@phyloseq] and **metacoder** [@metacoder]. Both of these packages, however, provide different degrees of functionality as it relates to data wrangling, statistical methods, and visualization. Phyloseq, for instance, relies on **base** R functions such as _subset_ to extract or manipulate data, while metacoder uses a more modern approach like the **tidyverse**. Additionally, metacoder is built on top of the **taxa** package and uses a _“taxmap object”_, which allows for direct manipulation of hierarchical taxonomic data and associated application-specific data [@taxa]. Phyloseq, on the other hand, provides an excellent means for importing data into R as a _“phyloseq object”_, which can be used with various proven methods for analysis. In order to bridge the gap, we have developed **MicrobiomeR**, to provide new tools and a comprehensive workflow based on concepts found in the phyloseq package and newer technologies being developed in the metacoder package. + +# Workflow + +The paradigm for studying the microbiome follows the steps shown in the figure below. MicrobiomeR covers the last four steps of this workflow. +![Microbiome Workflow](Microbiome-Workflow.png) + +MicrobiomeR provides users with raw output files from the NIH’s Nephele pipeline. This data was generated by the Illumina MiSeq workflow followed by the **Qiime** [@qiime] 16S pipeline for pair ended FASTQ files. To begin a MicrobiomeR workflow, raw data files are imported into R as a phyloseq object, using the *create_phyloseq()* function. While discouraged, the data can be manipulated directly using any of phyloseq’s methods. Next, the data is converted to a taxmap object using the *create_taxmap()* function. + +By conceptually modeling MicrobiomeR’s data preprocessing functions after phyloseq, we are able to enhance the useful microbiome analysis capabilities of metacoder and taxa by providing simple “phyloseq-style” preprocessing functions, which are critical for reducing noise within the data. Many of the **_filter()* functions are used for this purpose. Additionally, any of the metacoder or taxa functions can be incorporated into the preprocessing steps as MicrobiomeR primarily operates on taxmap objects. + +After preprocessing the data, statistical analysis can be conducted using MicrobiomeR’s formatting functions (*as_\*_format()*), which incorporate metacoder’s *calc_\*()* and *compare_groups()* functions. Furthermore, MicrobiomeR offers a unique _permanova()_ function, which quantifies multivariate community-level differences between groups. Following statistical analysis, alpha and beta diversity can be visualized using the *alpha_diversity_plot()* and *ordination_plot()* functions, which are helpful for understanding the intra-sample differences (evenness and richness) and the inter-group differences. Other publication-ready visualizations can also be created using *heat_tree_plots()*, *correlation_plots()*, *stacked_barplot()*, and *top_coefficients_barplot()*. + +# Utilities + +One of the key advantages in using MicrobiomeR is its “phyloseq-style” filtering functions. These functions are heavily dependent upon formatting and validation checkpoints to ensure that the proper data is being manipulated. In Table 1, we describe the “MicrobiomeR formats” used throughout the package and how they are related to phyloseq, metacoder, and each other. + +### Table 1: +| Level | Name | Description | Data Tables | Other Notes | +|:-----:|:--------------:|:--------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| 0 | PhyloseqFormat | A taxmap object that has just been converted from a phyloseq object with the create_phyloseq() function. | otu_table tax_data sample_data phy_tree | The observation tables represent the phyloseq::otu_table(), phyloseq::tax_table(), phyloseq::sample_data(), and phyloseq::phy_tree(), data in the original phyloseq object. | +| 1 | Raw Format | A taxmap object that has been processed with the as_raw_format()function. | phyloseq tables otu_abundance otu_annotations | The new observation tables are just name conversions of the otu_table and tax_data table from the "phyloseq_format”. | +| 2 | BasicFormat | A taxmap object that has been processed with the as_basic_format() function. | raw tables taxa_abundance otu_proportions taxa_proportions | This format is defined by observation data that has been processed with the metacoder::calc_*_() functions. | +| 3 | AnalyzedFormat | A taxmap object that has been processed with the as_analyzed_format() function.. | basic tables statistical_data stats_tax_data | This format is defined by observation data that has been processed with the metacoder::compare_groups() function. | + +Validation is performed internally by most of the preprocessing, analysis, and formatting functions, but it can also be done directly by using the *is_\*_format()* functions. Furthermore, it is encouraged to explore the taxmap objects in order to view observation and taxonomy data. Other MicrobiomeR utilities include project management tools for creating and organizing output directories for plots, a set of color palette functions based on *grDevices::colorRampPalette()*, and a taxonomic data parsing function called *parse_taxonomy_silva_128()* used to import data annotated by the SILVA [@silva_1] database as a phyloseq object. + +# Acknowledgments + +The data in this R package was generated by the University of Mississippi Medical Center’s Genomics Core and further analyzed using the Nephele platform from the National Institute of Allergy and Infectious Diseases (NIAID) Office of Cyber Infrastructure and Computational Biology (OCICB) in Bethesda, MD. + +MicrobiomeR is currently being used to analyze microbiome data in a study conducted by Xiao Zhang, and enabled by Dr. Eric Vallender. + +# References diff --git a/vignettes/paper.bib b/vignettes/paper.bib new file mode 100644 index 0000000..0244236 --- /dev/null +++ b/vignettes/paper.bib @@ -0,0 +1,73 @@ +@Manual{r-core, + title = {R: A Language and Environment for Statistical Computing}, + author = {{R Core Team}}, + organization = {R Foundation for Statistical Computing}, + address = {Vienna, Austria}, + year = {2018}, + url = {https://www.R-project.org/}, +} + +@Article{phyloseq, + author = {Paul J. McMurdie and Susan Holmes}, + journal = {PLoS ONE}, + pages = {e61217}, + title = {phyloseq: An R package for reproducible interactive analysis and graphics of microbiome census data}, + volume = {8}, + number = {4}, + year = {2013}, + url = {http://dx.plos.org/10.1371/journal.pone.0061217}, +} + +@Article{metacoder, + title = {Metacoder: An R package for visualization and manipulation of community taxonomic diversity data.}, + author = {Zachary Foster and Thomas Sharpton and Niklaus Grünwald}, + journal = {PLOS Computational Biology}, + publisher = {Public Library of Science}, + year = {2017}, + month = {02}, + volume = {13}, + pages = {1-15}, + number = {2}, + doi = {10.1371/journal.pcbi.1005404}, + url = {http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005404}, +} + +@Manual{taxa, + title = {Taxa: An R package implementing data standards and methods for taxonomic data.}, + author = {Foster Zachary and Chamberlain Scott and Grunwald Niklaus}, + journal = {F1000Research}, + year = {2018}, + volume = {7}, + number = {272}, + doi = {10.12688/f1000research.14013.1}, + url = {https://f1000research.com/articles/7-272/v2}, +} + +@Article{qiime, + title = {QIIME allows analysis of high-throughput community sequencing data.}, + author = {Caporaso JG and Kuczynski J and Stombaugh J and Bittinger K and Bushman FD and Costello EK and Fierer N + and Gonzalez Pena A and Goodrich JK and Gordon JI and Huttley GA and Kelley ST and Knights D + and Koenig JE and Ley RE and Lozupone CA and McDonald D and Muegge BD and Pirrung M and Reeder J + and Sevinsky JR and Turnbaugh PJ and Walters WA and Widmann J and Yatsunenko T and Zaneveld J + and Knight R}, + journal = {Nature Methods}, + year = {2010}, + volume = {7}, + pages = {335-336}, + url = {qiime.org}, +} + +@Article{silva_1, + title = {The SILVA ribosomal RNA gene database project: improved data processing and web-based tools.}, + author = {Quast C and Pruesse E and Yilmaz P and Gerken J and Schweer T and Yarza P and Peplies J and Glöckner FO}, + journal = {Nucleic Acids Research}, + year = {2013}, + issue = {41}, + pages = {D590-D596}, +} + +@Article{silva_2, + title = {The SILVA and “All-species Living Tree Project (LTP)” taxonomic frameworks.}, + author = {Yilmaz P and Parfrey LW and Yarza P and Gerken J and Pruesse E and Quast C + and Schweer T and Peplies J and Ludwig W and Glöckner FO} +}