| Title: | Analyze Microbiome Data |
|---|---|
| Description: | An R package for microbiome analysis combining functions from phyloseq, metacodeR, and microbiome into an easy to use and full featured microbiome analysis package. |
| Authors: | Robert Gilmore [aut, cre], Shaurita Hutchins [aut] |
| Maintainer: | Shaurita Hutchins <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.8.0 |
| Built: | 2026-10-05 13:02:32 UTC |
| Source: | https://github.com/vallenderlab/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)agglomerate_taxmap(obj, rank, validated = FALSE)
obj |
A Taxmap object. |
rank |
The rank that will be agglomerated to. |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
This function helps analyzing taxonomic data at intermediate ranks by agglomerating the observation data and the taxmap object.
A taxmap object that has been agglomerated at the specified rank.
Other Advanced Metacoder Filters:
cov_filter(),
otu_prevalence_filter(),
otu_proportion_filter(),
taxa_prevalence_filter()
## 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") } ## End(Not run)## 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") } ## End(Not run)
This function generates various alpha diversity measures include Shannon, Fisher, Coverage, GiniSimpson, and InverseSimpson.
alpha_diversity_measures(obj, group = "TreatmentGroup")alpha_diversity_measures(obj, group = "TreatmentGroup")
obj |
An object to be converted to a Taxmap object with |
group |
The "TreatmentGroup" or similar grouping from your metadata to denote sample groups, Default: 'TreatmentGroup' |
Returns a list of alpha diversity measures with metadata.
View alpha,meta to learn more about generating diversity measures with the microbiome package.
## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva measures <- alpha_diversity_measures(data) measures$Shannon } ## End(Not run)## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva measures <- alpha_diversity_measures(data) measures$Shannon } ## End(Not run)
Plot the alpha diversity using a violin plot. alpha_diversity_plots generates plots for all alpha diversity measures.
alpha_diversity_plot( obj, measure = "Shannon", group = "TreatmentGroup", select_otu_table = NULL, title = NULL ) alpha_diversity_plots( obj, measures = c("Shannon", "GiniSimpson", "InverseSimpson"), group = "TreatmentGroup" )alpha_diversity_plot( obj, measure = "Shannon", group = "TreatmentGroup", select_otu_table = NULL, title = NULL ) alpha_diversity_plots( obj, measures = c("Shannon", "GiniSimpson", "InverseSimpson"), group = "TreatmentGroup" )
obj |
An object to be converted to a Taxmap object with |
measure |
Select an alpha diversity measure such as Shannon, Fisher, Coverage, GiniSimpson, and InverseSimpson, Default: 'Shannon' |
group |
The "TreatmentGroup" or similar grouping or column from your metadata to denote sample groups, Default: 'TreatmentGroup' |
select_otu_table |
DEPRECATED. Choose an otu table to analyze, Default: 'otu_proportions' |
title |
The title of the plot, Default: NULL |
measures |
A list of alpha diversity measures such as Shannon, Fisher, Coverage, GiniSimpson, and InverseSimpson, Default: 'c("Shannon", "GiniSimpson", "InverseSimpson")' |
Alpha diversity helps to determine the species richness (the number of different species in a sample) or evenness (similar abundance level).
We prefer to use Shannon as it is better for data generated using the QIIME pipeline.
Returns an alpha diversity plot.
Returns a melted dataframe.
alpha_diversity_measures, diversity, ggviolin
Other Visualizations:
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
Other Visualizations:
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva plot <- alpha_diversity_plot(obj = data, measure = "Shannon") plot } ## End(Not run)## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva plot <- alpha_diversity_plot(obj = data, measure = "Shannon") plot } ## End(Not run)
Converts a Taxmap object to the analyzed_format.
as_analyzed_format( obj, cols = NULL, groups = NULL, combinations = NULL, out_names = NULL, comp_func = metacoder_comp_func_1 )as_analyzed_format( obj, cols = NULL, groups = NULL, combinations = NULL, out_names = NULL, comp_func = metacoder_comp_func_1 )
obj |
An object to be converted to a Taxmap object with |
cols |
Column names used for |
groups |
Group names used for |
combinations |
Combinations of treatments used in |
out_names |
Column names of the output used for |
comp_func |
A Comparison based function used in |
See the MicrobiomeR_Formats documentation.
A Taxmap object in the "analyzed_format".
is_phyloseq_format, is_raw_format, is_basic_format, is_analyzed_format, as_raw_format, as_basic_format, order_metacoder_data
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_basic_format(),
as_custom_format(),
as_phyloseq_format(),
as_raw_format(),
melt_taxmap(),
treatment_matrix()
Converts a Taxmap object to the basic_format.
as_basic_format(obj, cols = NULL, out_names = NULL)as_basic_format(obj, cols = NULL, out_names = NULL)
obj |
An object to be converted to a Taxmap object with |
cols |
Column names used for |
out_names |
Column names of the output used for |
See the MicrobiomeR_Formats documentation.
A Taxmap object in the "basic_format".
is_phyloseq_format, is_raw_format, is_basic_format, as_raw_format, order_metacoder_data
calc_taxon_abund, calc_obs_props
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_analyzed_format(),
as_custom_format(),
as_phyloseq_format(),
as_raw_format(),
melt_taxmap(),
treatment_matrix()
A function for formatting Taxmap objects in the MicrobiomeR format. This function attempts to give more customization than the as_*_format functions.
as_custom_format(obj, format, change_name_list = NULL, ...)as_custom_format(obj, format, change_name_list = NULL, ...)
obj |
An object to be converted to a Taxmap object with |
format |
The name of the format to convert the object to. |
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 |
... |
An optional list of parameters to use in the as_*_format function specified |
This function is meant to be more helpful for customizing the Taxmap object.
A Taxmap object that we have tried to format with all of our heart.
create_taxmap, which_format, order_metacoder_data, as_MicrobiomeR_format
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_analyzed_format(),
as_basic_format(),
as_phyloseq_format(),
as_raw_format(),
melt_taxmap(),
treatment_matrix()
Converts a Taxmap object to the specified format.
as_MicrobiomeR_format(obj, format, ...)as_MicrobiomeR_format(obj, format, ...)
obj |
An object to be converted to a Taxmap object with |
format |
The name of the format to convert the object to. |
... |
An optional list of parameters to use in the as_*_format function specified by the format parameter. |
See the MicrobiomeR_Formats documentation.
A Taxmap object in the specified format.
which_format, as_raw_format, as_basic_format, as_analyzed_format, as_phyloseq_format, create_taxmap, order_metacoder_data
Other Formatting:
MicrobiomeR_Formats,
as_analyzed_format(),
as_basic_format(),
as_custom_format(),
as_phyloseq_format(),
as_raw_format(),
melt_taxmap(),
treatment_matrix()
Converts the Taxmap object to the phyloseq_format.
as_phyloseq_format( obj, otu_table = "otu_abundance", tax_data = "otu_annotations", sample_data = "sample_data", phy_tree = "phy_tree" )as_phyloseq_format( obj, otu_table = "otu_abundance", tax_data = "otu_annotations", sample_data = "sample_data", phy_tree = "phy_tree" )
obj |
An object to be converted to a Taxmap object with |
otu_table |
The name of the observation table with OTU data. Default: NULL |
tax_data |
The name of the observation table with taxonomic annotations. Default: NULL |
sample_data |
The name of the observation table with metadata. Default: NULL |
phy_tree |
The name of the observation data with the phylogenetic tree. Default: NULL |
See the MicrobiomeR_Formats documentation.
A Taxmap object in the phyloseq_format.
create_taxmap,order_metacoder_data
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_analyzed_format(),
as_basic_format(),
as_custom_format(),
as_raw_format(),
melt_taxmap(),
treatment_matrix()
Converts a Taxmap object to the raw_format.
as_raw_format(obj)as_raw_format(obj)
obj |
An object to be converted to a Taxmap object with |
See the MicrobiomeR_Formats documentation.
A Taxmap object in the "raw_format".
is_phyloseq_format, is_raw_format, order_metacoder_data
@importFrom crayon silver red green
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_analyzed_format(),
as_basic_format(),
as_custom_format(),
as_phyloseq_format(),
melt_taxmap(),
treatment_matrix()
This function uses dynamic arguments (...) in order to combine multiple color palettes together.
combination_palette(...)combination_palette(...)
... |
You can use any name for your arguments, but the values must be a named list. The list can only have 4 named members:
You can add as many parameters you want in order to combine as many color palettes as you want. |
This function allows you to combine a varying number of color palettes and gives you the ability to subset and reverse the palettes that are supplied.
The output of this function is another function (grDevoces::colorRampPalette), which takes a number to generate an interpolated color palette as a character vector.
Other Color Palettes:
get_color_palette(),
scico_palette(),
viridis_magma_palette(),
viridis_palette()
## Not run: 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, ...) { 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) } 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) } } ## End(Not run)## Not run: 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, ...) { 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) } 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) } } ## End(Not run)
Convert Proportions
convert_proportions(melted_df, tax_level)convert_proportions(melted_df, tax_level)
melted_df |
A "melted" dataframe from the metacoder object's data. |
tax_level |
The taxonomic level, Default: 'Phylum' |
Other Data Manipulators:
metacoder_comp_func_1(),
transformer(),
transposer(),
vlookup()
Get the correlation plot data comparing all of the treatment groups.
correlation_data(obj, primary_rank, secondary_rank = TRUE, wp_value = 0.05)correlation_data(obj, primary_rank, secondary_rank = TRUE, wp_value = 0.05)
obj |
An object to be converted to a Taxmap object with |
primary_rank |
A primary rank used to label the points. |
secondary_rank |
The secondary rank used to color the points, Default: TRUE |
wp_value |
The wilcoxon p-value cutoff/threshold, Default: 0.05 |
DETAILS
Data for the correlation plots.
data mask programming,
mutate, filter, arrange
Other Visualizations:
alpha_diversity_plot(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
Create a correlation plot from a metacoder/taxmap object.
correlation_plot( obj, primary_rank, secondary_rank = TRUE, wp_value = 0.05, pal_func = NULL, trans = "logit" )correlation_plot( obj, primary_rank, secondary_rank = TRUE, wp_value = 0.05, pal_func = NULL, trans = "logit" )
obj |
An object to be converted to a Taxmap object with |
primary_rank |
The primary rank used to label the points. |
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 |
wp_value |
The Wilcoxian P-Value used to represent significant points. Default: 0.05 |
pal_func |
A palette function that returns grDevices::colorRampPalette. |
trans |
Either the name of a transformation object, or the object itself given to |
Correlation plots help to better explain the heat tree findings.
A 1:1 correlation plot built with ggplot2.
create_taxmap, validate_MicrobiomeR_format, correlation_data, plot_limits, get_color_palette
ggplot, aes, geom_polygon, geom_point, labs, scale_continuous, scale_manual, guide_legend, geom_abline
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") correlation_plot(analyzed_silva, primary_rank = "Class", secondary_rank = "Phylum") } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") correlation_plot(analyzed_silva, primary_rank = "Class", secondary_rank = "Phylum") } ## End(Not run)
This function allows the user to create a list of multiple correlation plots.
correlation_plots(obj, primary_ranks, secondary_ranks = TRUE, ...)correlation_plots(obj, primary_ranks, secondary_ranks = TRUE, ...)
obj |
An object to be converted to a Taxmap object with |
primary_ranks |
A vector of primary ranks used to label the points. |
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 |
... |
An optional list of parameters to use in the correlation_plot function. |
This function makes it easier to generate multiple correlation plots at once.
A list object containing correlation plots. A pairwise comparison returns a nested list.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") corr_plots <- correlation_plots(analyzed_silva, primary_ranks = c("Phylum", "Class", "Order"), secondary_ranks = c("Phylum", "Class", "Order", "Family", "Genus")) # Show a plot corr_plots$Class$Phylum } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") corr_plots <- correlation_plots(analyzed_silva, primary_ranks = c("Phylum", "Class", "Order"), secondary_ranks = c("Phylum", "Class", "Order", "Family", "Genus")) # Show a plot corr_plots$Class$Phylum } ## End(Not run)
This function filters OTUs that have a variance higher than the specified CoV.
cov_filter(obj, coefficient_of_variation, validated = FALSE)cov_filter(obj, coefficient_of_variation, validated = FALSE)
obj |
A Taxmap object. |
coefficient_of_variation |
The maximum CoV that an OTU can have. |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
This function helps remove OTUs that have an unusually high variance using the coefficient of variation.
Returns a taxmap object that contains otu_ids that have passed the above filter.
validate_MicrobiomeR_format, otu_id_filter
Other Advanced Metacoder Filters:
agglomerate_taxmap(),
otu_prevalence_filter(),
otu_proportion_filter(),
taxa_prevalence_filter()
## Not run: if(interactive()){ # Use the cov_filter towards the end of your analysis library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) # Taxa Prevalence Filter # 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 ) # OTU prevalence filter 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) } ## End(Not run)## Not run: if(interactive()){ # Use the cov_filter towards the end of your analysis library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) # Taxa Prevalence Filter # 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 ) # OTU prevalence filter 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) } ## End(Not run)
Create a phyloseq object using a biom file, phylogenetic tree file, and a metadata file. Alternatively, an .Rdata file can be used. For now this function takes output from Qiime. The data provided by this package was processed by the NIH's Nephele pipeline.
create_phyloseq( biom_file = NULL, tree_file = NULL, metadata_file = NULL, treatment_group = NULL, parse_func = NULL, rdata_file = NULL, save_rooted_tree = FALSE, recursive_save = FALSE )create_phyloseq( biom_file = NULL, tree_file = NULL, metadata_file = NULL, treatment_group = NULL, parse_func = NULL, rdata_file = NULL, save_rooted_tree = FALSE, recursive_save = FALSE )
biom_file |
A file in the BIOM format. Default: NULL |
tree_file |
A phylogenetic tree file. This function will generate a rooted tree file if your phylogenetic tree isn't already rooted. Default: NULL |
metadata_file |
Sample metadata in tab delimited format. It's very important that you make sure that you have a sample_id and TreatmentGroup column in your metadata file. You might otherwise run into problems. Default: NULL |
treatment_group |
The column number or name in the metadata file that contains the treatment group names. Default: NULL |
parse_func |
The parse function used to parse taxonomy strings from Greengenes or SILVA database. Default: NULL |
rdata_file |
A .Rdata file. Default: NULL |
save_rooted_tree |
A logical that determines weather or not the rooted tree is saved. Default: FALSE |
recursive_save |
If the directory doesn't exists create the parent directories that don't exist as well. Default: FALSE |
This function heavily relies on the phyloseq package to import data into R. It also requires you to use an absolute or relative path to your data files or for your data files to be in the working directory.
It's very important that you make sure that you have a sample_id and TreatmentGroup column in your metadata file.
A phyloseq object, and a phylogenetic tree file if one does not already exist.
import_biom, phyloseq::sample_data(), phyloseq::phy_tree(), import_qiime_sample_data, merge_phyloseq
root, is.rooted, read.tree, write.tree
Other Data Importers:
create_taxmap()
## Not run: if(interactive()){ library(MicrobiomeR) # Get the datafiles from the package biom_file <- system.file("extdata", "silva_OTU.biom", package = "MicrobiomeR") tree_file <- system.file("extdata", "silva.tre", package = "MicrobiomeR") md_file <- system.file("extdata", "nephele_metadata2.txt", package = "MicrobiomeR") 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) ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) # Get the datafiles from the package biom_file <- system.file("extdata", "silva_OTU.biom", package = "MicrobiomeR") tree_file <- system.file("extdata", "silva.tre", package = "MicrobiomeR") md_file <- system.file("extdata", "nephele_metadata2.txt", package = "MicrobiomeR") 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) ## End(Not run)
Creates an image of a table from a dataframe.
create_pub_table(dataframe)create_pub_table(dataframe)
dataframe |
A dataframe object. |
The text table as an object that can be saved to png/tiff/jpg/pdf.
## 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) data <- MicrobiomeR::basic_silva$data$taxa_abundance create_pub_table(data) } ## End(Not run)## 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) data <- MicrobiomeR::basic_silva$data$taxa_abundance create_pub_table(data) } ## End(Not run)
A function that handles the conversion of objects to Taxmap (taxa::taxmap) objects.
create_taxmap(obj)create_taxmap(obj)
obj |
An object that contains the data being analyzed. Can be one of the following:
|
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. For phyloseq inputs, this function
uses parse_phyloseq when possible and falls back to
an internal parser for known upstream metacoder namespace breakage.
The output generated is a taxa::taxmap object.
Other Data Importers:
create_phyloseq()
## Not run: if(interactive()){ library(MicrobiomeR) phy_obj <- MicrobiomeR::phyloseq_silva_2 mc_obj <- create_taxmap(phy_obj) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) phy_obj <- MicrobiomeR::phyloseq_silva_2 mc_obj <- create_taxmap(phy_obj) } ## End(Not run)
Get a color palette with a specific number of colors.
get_color_palette( pal_func = viridis_magma_palette, color_no = 20, display = TRUE, rev = FALSE, ... )get_color_palette( pal_func = viridis_magma_palette, color_no = 20, display = TRUE, rev = FALSE, ... )
pal_func |
A function that returns the output function from |
color_no |
The number of colors in the palette. Default: 20 |
display |
A logical for displaying a pie chart of the palette. Default: TRUE |
rev |
A logical that will reverse the order of the color palette. |
... |
Parameters for the pal_func. |
This function is meant to be a plugin style function for users to created palettes.
Returns a color palette in the form of a character vector.
Other Color Palettes:
combination_palette(),
scico_palette(),
viridis_magma_palette(),
viridis_palette()
## 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_analyzed_format}}. library(MicrobiomeR) 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) } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) 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) } ## End(Not run)
This function gets the parameters used for the heat_tree_plots function.
heat_tree_parameters(obj, title, treatment_no, ...)heat_tree_parameters(obj, title, treatment_no, ...)
obj |
A Taxmap object. |
title |
The title used in the heat_tree plot. |
treatment_no |
The number of treatment groups in the data. |
... |
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 members 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 explicitly on the Taxmap object. |
A list used with do.call and the metacoder::heat_tree function.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
A function for getting multiple heat_tree plots per rank.
heat_tree_plots(obj, rank_list = NULL, title = TRUE, seed = 1, ...)heat_tree_plots(obj, rank_list = NULL, title = TRUE, seed = 1, ...)
obj |
An object to be converted to a Taxmap object with |
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 |
seed |
A single integer seed used to make heat-tree layouts reproducible without
modifying the caller's RNG state. Use |
... |
Any of the |
By default, node size represents the number of retained OTUs assigned
to each taxon or any of its descendants in the source otu_abundance table.
Counts are pooled across samples after upstream filtering and do not represent
read abundance.
A list of heat_tree plots.
create_taxmap, validate_MicrobiomeR_format, heat_tree_parameters
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") h_trees <- heat_tree_plots(analyzed_silva, rank_list = c("Phylum", "Class")) h_trees$Class } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") h_trees <- heat_tree_plots(analyzed_silva, rank_list = c("Phylum", "Class")) h_trees$Class } ## End(Not run)
This function returns a logical based on weather or not the object is in the analyzed_format.
is_analyzed_format(obj)is_analyzed_format(obj)
obj |
A Taxmap object. |
The "analyzed_format" is Level 3. in the MicrobiomeR_Formats hierarchy.
A logical (TRUE/FALSE).
Other Validation:
is_basic_format(),
is_phyloseq_format(),
is_raw_format(),
order_metacoder_data(),
validate_MicrobiomeR_format(),
which_format()
## Not run: if(interactive()){ library(MicrobiomeR) if(is_analyzed_format(MicrobiomeR::raw_silva_2)){ print("It's analyzed!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not analyzed!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) if(is_analyzed_format(MicrobiomeR::raw_silva_2)){ print("It's analyzed!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not analyzed!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)
This function returns a logical based on weather or not the object is in the basic_format.
is_basic_format(obj)is_basic_format(obj)
obj |
A Taxmap object. |
The "basic_format" is Level 2. in the MicrobiomeR_Formats hierarchy.
A logical (TRUE/FALSE).
Other Validation:
is_analyzed_format(),
is_phyloseq_format(),
is_raw_format(),
order_metacoder_data(),
validate_MicrobiomeR_format(),
which_format()
## Not run: if(interactive()){ library(MicrobiomeR) if(is_basic_format(MicrobiomeR::raw_silva_2)){ print("It's basic!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not analyzed!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) if(is_basic_format(MicrobiomeR::raw_silva_2)){ print("It's basic!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not analyzed!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)
This function returns a logical based on weather or not the object is in the phyloseq_format.
is_phyloseq_format(obj)is_phyloseq_format(obj)
obj |
A Taxmap object. |
The "phyloseq_format" is Level 0. in the MicrobiomeR_Formats hierarchy.
A logical (TRUE/FALSE).
Other Validation:
is_analyzed_format(),
is_basic_format(),
is_raw_format(),
order_metacoder_data(),
validate_MicrobiomeR_format(),
which_format()
## Not run: if(interactive()){ library(MicrobiomeR) if(is_analyzed_format(MicrobiomeR::raw_silva_2)){ print("It's phyloseq format!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not phyloseq fomrat!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) if(is_analyzed_format(MicrobiomeR::raw_silva_2)){ print("It's phyloseq format!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not phyloseq fomrat!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)
This function returns a logical based on weather or not the object is in the raw_format.
is_raw_format(obj)is_raw_format(obj)
obj |
A Taxmap object. |
The "raw_format" is Level 1. in the MicrobiomeR_Formats hierarchy.
A logical (TRUE/FALSE).
Other Validation:
is_analyzed_format(),
is_basic_format(),
is_phyloseq_format(),
order_metacoder_data(),
validate_MicrobiomeR_format(),
which_format()
## Not run: if(interactive()){ library(MicrobiomeR) if(is_raw_format(MicrobiomeR::raw_silva_2)){ print("It's raw!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not analyzed!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) if(is_raw_format(MicrobiomeR::raw_silva_2)){ print("It's raw!") } else { fmt <- which_format(MicrobiomeR::raw_silva_2) print("It's not analyzed!") print(sprintf("It's %s!", fmt)) } } ## End(Not run)
Melt Taxmap
melt_taxmap(obj)melt_taxmap(obj)
obj |
An object to be converted to a taxmap object with |
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_analyzed_format(),
as_basic_format(),
as_custom_format(),
as_phyloseq_format(),
as_raw_format(),
treatment_matrix()
A comparison function for metacoder::compare_groups "func" parameter.
metacoder_comp_func_1(abund_1, abund_2)metacoder_comp_func_1(abund_1, abund_2)
abund_1 |
A character vector of abundances. |
abund_2 |
A character vector of abundances. |
This function is used by metacoder::compare_groups in order to compare every combination of treatment groups.
A list of statistical results used to compare groups.
Other Data Manipulators:
convert_proportions(),
transformer(),
transposer(),
vlookup()
The formats are listed in order from lowest to highest level. To get a taxmap object into the higher formats they must be in one of the lower formats. It is also inherently important to understand the MicrobiomeR_Workflow, which describes some of the important dependencies used to create the MicrobiomeR formats listed below:
Level 0. The "phyloseq_format" is the format given to a taxmap object that has just
been converted from a phyloseq object using metacoder via create_phyloseq. A taxmap object identified by MicrobiomeR
to be in this format will contain "otu_table", "tax_data", "sample_data" and "phy_tree" data in the observation
tables (metacoder_obj$data), which represents the matching phyloseq::otu_table, phyloseq::tax_table,
phyloseq::sample_data, and phyloseq::phy_tree data in the original phyloseq object.
Level 1. The "raw_format" is the format given to a taxmap object that has been
processed with as_raw_format. It contains the "otu_abundance" and "otu_annotations" data in the observation
tables, which are just name conversions of the otu_table and tax_data table from the "phyloseq_format".
Level 2. The "basic_format" is the format given to a taxmap object that has been
processed with as_basic_format. It contains the tables available in the "raw_format" along with
"taxa_abundance", "otu_proportions", and "taxa_proportions" tables.
Level 3. The "analyzed_format" is the format given to a taxmap object that has been
processed with as_analyzed_format. It contains the tables available in the "basic_format" along
with "statistical_data" and "stats_tax_data" tables.
Other Formatting:
as_MicrobiomeR_format(),
as_analyzed_format(),
as_basic_format(),
as_custom_format(),
as_phyloseq_format(),
as_raw_format(),
melt_taxmap(),
treatment_matrix()
In order to understand the MicrobiomeR packages workflow it is necessary to understand a few other packages. Primarily phyloseq, taxa, and metacoder.
Data is imported with the create_phyloseq function or something proprietary that
creates a phyloseq object with an phyloseq::otu_table,
a phyloseq::tax_table, a phyloseq::sample_data,
and a phyloseq::phy_tree. The data is preferably not filtered
with phyloseq at this stage.
Data is manipulated into a metacoder::taxmap object
using the metacoder::parse_phyloseq
function. Custom MicrobiomeR_Formats are used to validate the data for consistency.
MicrobiomeR and metacoder filtering functions can be used to preprocess the data
before visualization.
MicrobiomeR contains useful functions for creating visualizations such as heat_trees, correlations plots, stacked bar charts, violin plots, and PCA plots. These functions are also coupled with save functions that organize saved output by experiment.
A function for changing the order of the observation data in a Taxmap object
order_metacoder_data(obj)order_metacoder_data(obj)
obj |
An object to be converted to a Taxmap object with |
Changes the order of the observation tables in metacoder_object$data to otu_abundance, otu_annotations, otu_proportions, sample_data, phy_tree, taxa_abundance, taxa_proportions, statistical_data, and stats_tax_data respectively.
A taxmap object with observation data in the proper order for downstream analysis.
Other Validation:
is_analyzed_format(),
is_basic_format(),
is_phyloseq_format(),
is_raw_format(),
validate_MicrobiomeR_format(),
which_format()
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" )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" )
obj |
An object to be converted to a metacoder object with |
method |
Choose an ordination method from 'PCoA', 'CCA', 'NMDS' or 'DPCoA', Default: 'PCoA' |
distance |
Choose a |
color |
Choose the group or factor of which colors will be mapped to, Default: 'TreatmentGroup' |
title |
The title of the plot, Default: NULL |
only_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")' |
select_otu_table |
The data table to use in the observation data. Default: "otu_proportions" |
By default, it returns an ordination plot.
Returns a melted dataframe.
View save_ordination_plots to save your ordination plot or multiple ordination plots.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## Not run: if (interactive()) { # An example ordination plot library(MicrobiomeR) data <- analyzed_silva plot <- ordination_plot(obj = data) plot } ## End(Not run)## Not run: if (interactive()) { # An example ordination plot library(MicrobiomeR) data <- analyzed_silva plot <- ordination_plot(obj = data) plot } ## End(Not run)
This function provides a flexible way to filter unwanted otu_ids from the taxmap object and from the observations of a MicrobiomeR formatted object.
otu_id_filter( obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ... )otu_id_filter( obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ... )
obj |
A Taxmap object. |
.f_transform |
A function used for transforming the data. Default: NULL |
.f_filter |
A function used for summarising the data like 'sum' or 'mean'. Default: NULL |
.f_condition |
A function that takes the summarised data and applied a condition like x > 10000. Default: NULL |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
... |
An optional list of parameters to use in the .f_filter function specified |
Get the otu_ids to keep by using purr and the user supplied transform and filter + condition formulas. The purr package allows the use of anonymous functions as described in the link below:
https://jennybc.github.io/purrr-tutorial/ls03_map-function-syntax.html#anonymous_function,_formula
Returns a taxmap object with otu_ids that pass the filters.
validate_MicrobiomeR_format, transposer, transformer
Other Basic Metacoder Filters:
sample_id_filter(),
taxon_id_filter()
## Not run: if(interactive()){ # Below is the code for the otu_prevelence_filter function. # It's a good example of how to use the otu_id_filter function. 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) # Filter OTU ids mo_clone <- otu_id_filter(obj = mo_clone, .f_transform = ~./sum(.), .f_filter = ~mean(.), .f_condition = ~.> otu_percentage) return(mo_clone) } } ## End(Not run)## Not run: if(interactive()){ # Below is the code for the otu_prevelence_filter function. # It's a good example of how to use the otu_id_filter function. 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) # Filter OTU ids mo_clone <- otu_id_filter(obj = mo_clone, .f_transform = ~./sum(.), .f_filter = ~mean(.), .f_condition = ~.> otu_percentage) return(mo_clone) } } ## End(Not run)
This function filters observations by their prevalence across samples.
otu_prevalence_filter( obj, minimum_abundance = 5, rel_sample_percentage = 0.5, validated = FALSE )otu_prevalence_filter( obj, minimum_abundance = 5, rel_sample_percentage = 0.5, validated = FALSE )
obj |
A Taxmap object. |
minimum_abundance |
The minimum abundance needed per observation per sample. Default: 5 |
rel_sample_percentage |
The percentage of samples per observation that meet the minimum abundance. Default: 0.5 |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
The otu_prevalence_filter filters taxon_ids that do not appear more than a certain amount of times (minimum abundance) in a certain percentage of samples (rel_sample_percentage). The phyloseq workflow calls for a minimum abundance of 5 across %50 of the samples. This filtering method is considered unsupervised, because it solely relies on the data in this experiment (OTU ids).
Returns a taxmap object that contains taxon_ids that have passed the above filter.
Other Advanced Metacoder Filters:
agglomerate_taxmap(),
cov_filter(),
otu_proportion_filter(),
taxa_prevalence_filter()
## Not run: if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) # OTU prevalence filter metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, validated = TRUE) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) # OTU prevalence filter metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, validated = TRUE) } ## End(Not run)
This function filters OTU values from the observation data and the taxmap object based on a minimum proportional mean across samples per OTU.
otu_proportion_filter(obj, otu_percentage = 5e-05, validated = FALSE)otu_proportion_filter(obj, otu_percentage = 5e-05, validated = FALSE)
obj |
A Taxmap object. |
otu_percentage |
The minimum percentage used to compare against the proportional OTU mean. Default: 5e-05 |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
This type of filtering is used to remove OTUs that do not have a specified mean proportion. This function must be used conservatively, hence why the default otu_percentage is so low.
Returns a taxmap object that contains otu_ids that have passed the above filter.
validate_MicrobiomeR_format,otu_id_filter
Other Advanced Metacoder Filters:
agglomerate_taxmap(),
cov_filter(),
otu_prevalence_filter(),
taxa_prevalence_filter()
## Not run: if(interactive()){ # Use the otu_proportions filter early on in your analysis library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) } ## End(Not run)## Not run: if(interactive()){ # Use the otu_proportions filter early on in your analysis library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) } ## End(Not run)
A function for generating a consistent file system for data files and visualizations. If none of the parameters are set the full path generated by this function will be root_path/output
output_dir( start_path = NULL, experiment = NULL, plot_type = NULL, end_path = NULL, root_path = NULL, custom_path = NULL, overwrite = FALSE, mkdir = TRUE )output_dir( start_path = NULL, experiment = NULL, plot_type = NULL, end_path = NULL, root_path = NULL, custom_path = NULL, overwrite = FALSE, mkdir = TRUE )
start_path |
With the start_path set, the full path generated by this function will be root_path/start_path/?experiment?/?plot_type?/end_path. Default: NULL |
experiment |
(optional) This will add a second level to the start_path file system. Default: NULL |
plot_type |
(optional) This will add a third level to the start_path file system. With ONLY the plot_type set the full path generated by this function will be root_path/plot_type. Default: NULL |
end_path |
(optional) This will add the final directory to the start_path file system Default: A formatted date-time string. |
root_path |
The root of the new file system (start_path or not). Default: The working directory. |
custom_path |
This is an absolute path that overrides everything else. Default: NULL |
overwrite |
A logical denoting that overwriting is acceptable. Default: FALSE |
mkdir |
A logical denoting weather or not the directory should be created or not. Default: TRUE |
This function is incredibly useful on it's own but also for various other plotting/saving functions within the package. It helps keep data organized using a standard workflow.
Creates a directory for output and returns the path as a string.
## Not run: if(interactive()){ # Get the path to an output directory without creating library(MicrobiomeR) output_dir <- output_dir(start_path="output", experiment="microbiome-proj", mkdir=FALSE) print(output_dir) # Create a folder for your plot types output_dir <- output_dir(plot_type="scatter-plots") print(output_dir) } ## End(Not run)## Not run: if(interactive()){ # Get the path to an output directory without creating library(MicrobiomeR) output_dir <- output_dir(start_path="output", experiment="microbiome-proj", mkdir=FALSE) print(output_dir) # Create a folder for your plot types output_dir <- output_dir(plot_type="scatter-plots") print(output_dir) } ## End(Not run)
These are provided as both example and default functions for
parsing a character vector of taxonomic rank information for a single taxa.
As default functions, these are intended for cases where the data adheres to
the naming convention used by greengenes
the naming convention used by greengenes and silva.
(http://greengenes.lbl.gov/cgi-bin/nph-index.cgi)
or where the convention is unknown, respectively.
To work, these functions – and any similar custom function you may want to
create and use – must take as input a single character vector of taxonomic
ranks for a single OTU, and return a named character vector that has
been modified appropriately (according to known naming conventions,
desired length limits, etc.
The length (number of elements) of the output named vector does not
need to be equal to the input, which is useful for the cases where the
source data files have extra meaningless elements that should probably be
removed, like the ubiquitous
“Root” element often found in greengenes/QIIME taxonomy labels.
In the case of parse_taxonomy_default, no naming convention is assumed and
so dummy rank names are added to the vector.
More usefully if your taxonomy data is based on greengenes, the
parse_taxonomy_greengenes function clips the first 3 characters that
identify the rank, and uses these to name the corresponding element according
to the appropriate taxonomic rank name used by greengenes
(e.g. "p__" at the beginning of an element means that element is
the name of the phylum to which this OTU belongs).
If you taxonomy data is based on SILVA, the parse_taxonomy_silva_128 function
clips the first 5 characters that identify rank, and uses these to name the
corresponding element according to the appropriate taxonomic rank name used
by SILVA (e.g. "D_1__" at the beginning of an element means that element
is the name of the phylum to which this OTU belongs.
Alternatively you can create your own function to parse this data.
Most importantly, the expectations for these functions described above
make them compatible to use during data import,
specifically the import_biom function, but
it is a flexible structure that will be implemented soon for all phyloseq
import functions that deal with taxonomy
(e.g. import_qiime).
parse_taxonomy_silva_128(char.vec)parse_taxonomy_silva_128(char.vec)
char.vec |
(Required). A single character vector of taxonomic ranks for a single OTU, unprocessed (ugly). |
This function is currently under PR review by phyloseq in a well supported pull request: https://github.com/joey711/phyloseq/pull/854. If you use this function, then please comment on the GitHub PR to encourage merging this feature.
A character vector in which each element is a different
taxonomic rank of the same OTU, and each element name is the name of
the rank level. For example, an element might be "Firmicutes"
and named "phylum".
These parsed, named versions of the taxonomic vector should
reflect embedded information, naming conventions,
desired length limits, etc; or in the case of
parse_taxonomy_default,
not modified at all and given dummy rank names to each element.
## Not run: > 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") > parse_taxonomy_qiime(taxvec2) > taxvec3 = c("D_0__Bacteria", "D_1__Firmicutes", "D_2__Bacilli", "D_3__Staphylococcaceae") > parse_taxonomy_silva_128(taxvec3) ## End(Not run)## Not run: > 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") > parse_taxonomy_qiime(taxvec2) > taxvec3 = c("D_0__Bacteria", "D_1__Firmicutes", "D_2__Bacilli", "D_3__Staphylococcaceae") > parse_taxonomy_silva_128(taxvec3) ## End(Not run)
Evaluate whether the group(s) has a significant effect on overall gut microbiota composition.
permanova(obj, distance_method = "bray", group = "TreatmentGroup", seed = 1)permanova(obj, distance_method = "bray", group = "TreatmentGroup", seed = 1)
obj |
An object to be converted to a taxmap object with |
distance_method |
Use a desired distance method, Default: 'bray' |
group |
The group or column in the metadata to test upon, Default: 'TreatmentGroup' |
seed |
A single integer seed used to make PERMANOVA permutations reproducible without
modifying the caller's RNG state. Use |
Returns a list which includes permanova, anova, coefficients, and top coefficients.
View top_coefficients_barplot to plot the top_coefficients returned from this function.
See adonis2 and betadisper to understand more about how the permanova data was generated
## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva p <- permanova(obj = data, group = "TreatmentGroup") p$permanova } ## End(Not run)## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva p <- permanova(obj = data, group = "TreatmentGroup") p$permanova } ## End(Not run)
Data from the Nephele-16S-Qiime-Silva microbiome pipeline in the form of a phyloseq object.
data(phyloseq_silva_2)data(phyloseq_silva_2)
An object of class "phyloseq"
Zhang et al. (2019) (PubMed)
Data from the Nephele-16S-Qiime-Silva microbiome pipeline in the form of a phyloseq object.
data(phyloseq_silva_3)data(phyloseq_silva_3)
An object of class "phyloseq"
Zhang et al. (2019) (PubMed)
Pick an outgroup for rooting a phylogenetic tree.
pick_new_outgroup(unrooted_tree)pick_new_outgroup(unrooted_tree)
unrooted_tree |
An unrooted tree object. |
This function preprocess a phylogenetic tree for rooting by the longest edge. Please see this issue for more details https://github.com/joey711/phyloseq/issues/597.
A new tree with the longest branch as the outgroup.
Other Phylogenetic Tree Manipulators:
root_by_longest_edge(),
root_phyloseq_tree()
Get the limits of the plot using data values.
plot_limits(x, y)plot_limits(x, y)
x |
Data used to plot the x axis. |
y |
Data used to plot the y axis. |
A vector that supplies the overarching x and y limits.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
Data from the Nephele-16S-Qiime-Silva microbiome pipeline in the form of a taxmap object. This taxmap object has been formatted into the MicrobiomeR "raw_format".
data(raw_silva_2)data(raw_silva_2)
An object of class "Taxmap" with customized observation tables:
An abundance table with otu_id, taxon_id, and Sample_* columns.
A taxonomy annotations table with otu_id, taxon_id, and multiple rank columns.
A metadata table with SampleID, BarcodeSequence, LinkerPrimerSequence, ForwardFastqFile, ReverseFastqFile, TreatmentGroup, SampleName, Description
A phylogenetic tree.
Zhang et al. (2019) (PubMed)
Data from the Nephele-16S-Qiime-Silva microbiome pipeline in the form of a taxmap object. This taxmap object has been formatted into the MicrobiomeR "raw_format".
data(raw_silva_3)data(raw_silva_3)
An object of class "Taxmap" with customized observation tables:
An abundance table with otu_id, taxon_id, and Sample_* columns.
A taxonomy annotations table with otu_id, taxon_id, and multiple rank columns.
A metadata table with SampleID, BarcodeSequence, LinkerPrimerSequence, ForwardFastqFile, ReverseFastqFile, TreatmentGroup, SampleName, Description
A phylogenetic tree.
Zhang et al. (2019) (PubMed)
This function roots a phylogenetic tree object by it's longest edge.
root_by_longest_edge(unrooted_tree)root_by_longest_edge(unrooted_tree)
unrooted_tree |
An unrooted phylogenetic tree object. |
Please see this issue for more details https://github.com/joey711/phyloseq/issues/597.
A rooted phlogenetic tree object.
Other Phylogenetic Tree Manipulators:
pick_new_outgroup(),
root_phyloseq_tree()
A function for rooting and saving a phylogenetic tree.
root_phyloseq_tree( phyloseq_object, tree_path, save_rooted_tree, recursive = TRUE )root_phyloseq_tree( phyloseq_object, tree_path, save_rooted_tree, recursive = TRUE )
phyloseq_object |
A phyloseq object that contains a phylogenetic tree. |
tree_path |
The path to the existing or desired phylogenetic tree file. |
save_rooted_tree |
A logical that determines weather or not the rooted tree is saved. |
recursive |
If the directory doesn't exist, create the parent directories that don't exist as well, Default: TRUE |
This function is a helper function to get a proper phyloseq object for downstream analysis. Some analyses require a rooted tree. The function saves the rooted tree in the phyloseq object. It can also save the tree as a file if desired.
Returns a phyloseq object with a rooted tree.
Other Phylogenetic Tree Manipulators:
pick_new_outgroup(),
root_by_longest_edge()
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
This function provides a flexible way to filter unwanted samples from the "otu_abundance" and "sample_data" observations of a MicrobiomeR formatted object.
sample_id_filter( obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ... )sample_id_filter( obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ... )
obj |
A Taxmap object. |
.f_transform |
A function used for transforming the data. Default: NULL |
.f_filter |
A function used for summarising the data like 'sum' or 'mean'. Default: NULL |
.f_condition |
A function that takes the summarised data and applied a condition like x > 10000. Default: NULL |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
... |
An optional list of parameters to use in the .f_filter function specified |
Get the samples to keep by using purr and the user supplied transform and filter + condition formulas. The purr package allows the use of anonymous functions as described in the link below:
https://jennybc.github.io/purrr-tutorial/ls03_map-function-syntax.html#anonymous_function,_formula
Returns a Taxmap object with samples that pass the filters.
validate_MicrobiomeR_format, transformer
Other Basic Metacoder Filters:
otu_id_filter(),
taxon_id_filter()
## Not run: if(interactive()){ # Use the sample_id_filter early on in your analysis library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_silva_2, format = "raw_format") # Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples metacoder_obj <- sample_id_filter(obj = metacoder_obj, .f_filter = ~sum(.), .f_condition = ~.>= 20, validated = TRUE) } ## End(Not run)## Not run: if(interactive()){ # Use the sample_id_filter early on in your analysis library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_silva_2, format = "raw_format") # Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples metacoder_obj <- sample_id_filter(obj = metacoder_obj, .f_filter = ~sum(.), .f_condition = ~.>= 20, validated = TRUE) } ## End(Not run)
This function saves alpha diversity plots stored in a list object to an output folder.
save_alpha_diversity_plots( alpha_div_plots, format = "tiff", start_path = "output", ... )save_alpha_diversity_plots( alpha_div_plots, format = "tiff", start_path = "output", ... )
alpha_div_plots |
A named list of alpha diversity plots. |
format |
The format of the output image. Default: 'tiff' |
start_path |
The starting path of the output directory. Default: 'output' |
... |
An optional list of parameters to use in the output_dir function. |
This function creates an appropriate output directory, where it saves publication ready plots.
An output directory that contains alpha diversity plots.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") alpha_div_plots <- alpha_diversity_plots(analyzed_silva) # Save to \emph{./output/alpha_diversity} folder. save_alpha_diversity_plot(alpha_div_plots) } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") alpha_div_plots <- alpha_diversity_plots(analyzed_silva) # Save to \emph{./output/alpha_diversity} folder. save_alpha_diversity_plot(alpha_div_plots) } ## End(Not run)
This function saves correlation plots stored in a listlike object to an output folder.
save_correlation_plots(corr, format = "tiff", start_path = "output", ...)save_correlation_plots(corr, format = "tiff", start_path = "output", ...)
corr |
A correlation plot list generated by correlation_plot or correlation_plots. |
format |
The format of the output image. Default: 'tiff' |
start_path |
The starting path of the output directory. Default: 'output' |
... |
An optional list of parameters to use in the output_dir function. |
This function creates an appropriate output directory, where it saves publication ready plots.
An output directory that contains correlation plots.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_silva}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") corr_plot <- correlation_plot(analyzed_silva, primary_rank = "Class", secondary_rank = "Phylum") # Save to \emph{./output/corr_plot} folder. save_correlation_plots(corr_plot) } ## End(Not run)## 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_analyzed_silva}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") corr_plot <- correlation_plot(analyzed_silva, primary_rank = "Class", secondary_rank = "Phylum") # Save to \emph{./output/corr_plot} folder. save_correlation_plots(corr_plot) } ## End(Not run)
This function saves heat tree plots stored in a list object to an output folder.
save_heat_tree_plots(htrees, format = "tiff", start_path = "output", ...)save_heat_tree_plots(htrees, format = "tiff", start_path = "output", ...)
htrees |
A named list of heat trees. |
format |
The format of the output image. Default: 'tiff' |
start_path |
The starting path of the output directory. Default: 'output' |
... |
An optional list of parameters to use in the output_dir function. |
This function creates an appropriate output directory, where it saves publication ready plots.
An output directory that contains heat tree plots.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") h_trees <- heat_tree_plots(analyzed_silva, rank_list = c("Phylum", "Class")) # Save to \emph{./output/heat_trees} folder. save_heat_tree_plots(h_trees) } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") h_trees <- heat_tree_plots(analyzed_silva, rank_list = c("Phylum", "Class")) # Save to \emph{./output/heat_trees} folder. save_heat_tree_plots(h_trees) } ## End(Not run)
This function saves ordination plots stored in a listlike object to an output folder.
save_ordination_plots(ord_plots, format = "tiff", start_path = "output", ...)save_ordination_plots(ord_plots, format = "tiff", start_path = "output", ...)
ord_plots |
An ordination plot list generated by ordination_plots. |
format |
The format of the output image. Default: 'tiff' |
start_path |
The starting path of the output directory. Default: 'output' |
... |
An optional list of parameters to use in the output_dir function. |
This function creates an appropriate output directory, where it saves publication ready plots.
An output directory that contains ordination plots.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## Not run: if (interactive()) { } ## End(Not run)## Not run: if (interactive()) { } ## End(Not run)
This function saves stacked barplot stored in a list object to an output folder.
save_stacked_barplots(sb_plots, format = "tiff", start_path = "output", ...)save_stacked_barplots(sb_plots, format = "tiff", start_path = "output", ...)
sb_plots |
A named list of stacked barplots. |
format |
The format of the output image. Default: 'tiff' |
start_path |
The starting path of the output directory. Default: 'output' |
... |
An optional list of parameters to use in the output_dir function. |
This function creates an appropriate output directory, where it saves publication ready plots.
An output directory that contains stacked barplot.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
stacked_barplot(),
stacked_barplots(),
top_coefficients_barplot()
## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") alpha_div_plots <- alpha_diversity_plots(analyzed_silva) # Save to \emph{./output/alpha_diversity} folder. save_alpha_diversity_plot(salpha_div_plots) } ## End(Not run)## 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_analyzed_format}}. library(MicrobiomeR) analyzed_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "analyzed_format") alpha_div_plots <- alpha_diversity_plots(analyzed_silva) # Save to \emph{./output/alpha_diversity} folder. save_alpha_diversity_plot(salpha_div_plots) } ## End(Not run)
Save a top coefficients barplot.
save_top_coefficients_barplot( plot, filename, format = "tiff", start_path = "output", ... )save_top_coefficients_barplot( plot, filename, format = "tiff", start_path = "output", ... )
plot |
The plot object. |
filename |
The name of the file. (an extension should not be included) |
format |
The file format, Default = "tiff" |
start_path |
The path of which your output should be saved. |
... |
Additional parameters. |
## Not run: if (interactive()) { library(MicrobiomeR) save_top_coefficients_barplot(plot = plot, filename = "stacked_bar_phylum") } ## End(Not run)## Not run: if (interactive()) { library(MicrobiomeR) save_top_coefficients_barplot(plot = plot, filename = "stacked_bar_phylum") } ## End(Not run)
A function that returns a color palette function based off of the scico package.
scico_palette( scico_palette = "batlow", scico_number = 800, scico_range = 0:scico_number )scico_palette( scico_palette = "batlow", scico_number = 800, scico_range = 0:scico_number )
scico_palette |
The scico palette to use. Default: 'batlow' |
scico_number |
The number of colors to use in the scico palette. Default: 800 |
scico_range |
The range in the color palette to use. Default: c(0, scico_number) |
The purpose of this function is to provide an interpolated scico palette for using with the get_color_palette function.
The output of this function is another function (grDevoces::colorRampPalette), which takes a number to generate an interpolated color palette as a character vector.
Other Color Palettes:
combination_palette(),
get_color_palette(),
viridis_magma_palette(),
viridis_palette()
## Not run: if(interactive()){ library(MicrobiomeR) basic_pal <- scico_palette(scico_palette="hawaii")(25) better_pal <- get_color_palette(pal_func = scico_palette, color_no = 25) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) basic_pal <- scico_palette(scico_palette="hawaii")(25) better_pal <- get_color_palette(pal_func = scico_palette, color_no = 25) } ## End(Not run)
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.
stacked_barplot( obj, tax_level = "Phylum", fill = "Phylum", xlabel = "Samples", faceted = FALSE, title = NULL, palette_values = NULL )stacked_barplot( obj, tax_level = "Phylum", fill = "Phylum", xlabel = "Samples", faceted = FALSE, title = NULL, palette_values = NULL )
obj |
An object to be converted to a taxmap object with |
tax_level |
The taxonomic level, Default: 'Phylum' |
fill |
The taxonomic level by which the bars are filled, Default: 'Phylum' |
xlabel |
The label of the x axis, Default: 'Samples' |
faceted |
A boolean to determine if the barplot should be faceted by TreatmentGroup |
title |
The title or name of the plot. |
palette_values |
A list of the colors to input to be mapped to the plot palette, Default: 'NULL' |
Returns a stacked barplot.
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplots(),
top_coefficients_barplot()
## Not run: if (interactive()) { # An example stacked bar plot library(MicrobiomeR) data <- analyzed_silva palette <- get_color_palette(color_no = 12) plot <- stacked_barplot(obj = data, palette_values = palette) plot } ## End(Not run)## Not run: if (interactive()) { # An example stacked bar plot library(MicrobiomeR) data <- analyzed_silva palette <- get_color_palette(color_no = 12) plot <- stacked_barplot(obj = data, palette_values = palette) plot } ## End(Not run)
Stacked Barplots
stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order"))stacked_barplots(obj, tax_levels = c("Phylum", "Class", "Order"))
obj |
An object to be converted to a taxmap object with |
tax_levels |
The taxonomic levels, Default: 'c("Phylum", "Class", "Order")' |
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
top_coefficients_barplot()
This function filters observations at a specific rank by their prevalence across samples.
taxa_prevalence_filter( obj, rank, minimum_abundance = 5, rel_sample_percentage = 0.5, validated = FALSE )taxa_prevalence_filter( obj, rank, minimum_abundance = 5, rel_sample_percentage = 0.5, validated = FALSE )
obj |
A Taxmap object. |
rank |
The rank being analyzed for prevalence across samples. |
minimum_abundance |
The minimum abundance needed per observation per sample. Default: 5 |
rel_sample_percentage |
The percentage of samples per observation that meet the minimum abundance. Default: 0.5 |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
The taxa_prevalence_filter filters taxon_ids that do not appear more than a certain amount of times (minimum abundance) in a certain percentage of samples (rel_sample_percentage) at the specified agglomerated rank (rank). The phyloseq workflow calls for a minimum abundance of 5 across %50 of the samples. This method is considered supervised, because the filtering is done based on taxonomic annotation (taxon_ids), which is assigned based on a reference database (SILVA or GreenGenes).
Returns a taxmap object that contains taxon_ids that have passed the above filter.
Other Advanced Metacoder Filters:
agglomerate_taxmap(),
cov_filter(),
otu_prevalence_filter(),
otu_proportion_filter()
## Not run: if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) # Taxa Prevalence Filter # 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 ) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low Sample Filter - Remove the low samples 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 ) # Taxa Prevalence Filter # 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 ) } ## End(Not run)
This function provides a flexible way to filter unwanted taxon_ids from the taxmap object and from the observations of a MicrobiomeR formatted object.
taxon_id_filter( obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ... )taxon_id_filter( obj, .f_transform = NULL, .f_filter = NULL, .f_condition = NULL, validated = FALSE, ... )
obj |
A Taxmap object. |
.f_transform |
A function used for transforming the data. Default: NULL |
.f_filter |
A function used for summarising the data like 'sum' or 'mean'. Default: NULL |
.f_condition |
A function that takes the summarised data and applied a condition like x > 10000. Default: NULL |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
... |
An optional list of parameters to use in the .f_filter function specified |
Get the taxon_ids to keep by using purr and the user supplied transform and filter + condition formulas. The purr package allows the use of anonymous functions as described in the link below:
https://jennybc.github.io/purrr-tutorial/ls03_map-function-syntax.html#anonymous_function,_formula
Returns a Taxmap object with taxon_ids that pass the filters.
validate_MicrobiomeR_format, transposer, transformer
Other Basic Metacoder Filters:
otu_id_filter(),
sample_id_filter()
## Not run: if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low taxa filter - Remove the low taxon_ids metacoder_obj <- taxon_id_filter(obj = metacoder_obj, .f_filter = ~sum(.), .f_condition = ~.>= 2000, validated = TRUE) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) library(metacoder) library(taxa) # Convert Phyloseq object to Taxmap object metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format") # Remove Archaea from the Taxmap object metacoder_obj <- filter_taxa( obj = metacoder_obj, taxon_names == "Archaea", subtaxa = TRUE, invert = TRUE) # Ambiguous Annotation Filter - Remove taxonomies with ambiguous names metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE) # Low taxa filter - Remove the low taxon_ids metacoder_obj <- taxon_id_filter(obj = metacoder_obj, .f_filter = ~sum(.), .f_condition = ~.>= 2000, validated = TRUE) } ## End(Not run)
A barplot to visualize which taxa have had the greatest impact on the overall gut composition.
top_coefficients_barplot(top_coefficients, title = NULL)top_coefficients_barplot(top_coefficients, title = NULL)
top_coefficients |
Coefficients for the top taxa separating the groups. |
title |
The title of the plot, Default = NULL |
Returns a barplot of the top coefficients
View permanova to understand how to generate top_coefficents
Other Visualizations:
alpha_diversity_plot(),
correlation_data(),
correlation_plot(),
correlation_plots(),
heat_tree_parameters(),
heat_tree_plots(),
ordination_plot(),
plot_limits(),
save_alpha_diversity_plots(),
save_correlation_plots(),
save_heat_tree_plots(),
save_ordination_plots(),
save_stacked_barplots(),
stacked_barplot(),
stacked_barplots()
## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva p <- permanova(obj = data) top_coefficients_barplot(p$top_coefficients) } ## End(Not run)## Not run: if (interactive()) { library(MicrobiomeR) data <- analyzed_silva p <- permanova(obj = data) top_coefficients_barplot(p$top_coefficients) } ## End(Not run)
This function transforms a table by rows or by columns.
transformer( .data, func, by = "column", ids = NULL, header_name = NULL, preserved_categories = TRUE, separated_categories = NULL, ... )transformer( .data, func, by = "column", ids = NULL, header_name = NULL, preserved_categories = TRUE, separated_categories = NULL, ... )
.data |
A matrix/data_frame/tibble for transforming. |
func |
A function, which can be anonymous, that will be used to transform the data. (e.g. proportions: x/sum(x)). |
by |
This denotes how the data should be transformed (column/row). Default: 'column' |
ids |
The column to transpose by if by = 'row'. Default: The first column. |
header_name |
A name for the numeric data that will be transposed if by = 'row'. |
preserved_categories |
A logical denoting weather categorical data should be conserved if by = 'row'. A value of FALSE will cause all categorical data except the ids to be dropped. A value of TRUE will cause the categorical data to preserved by tidyr::uniteing these columns. Default: TRUE |
separated_categories |
A vector containing ordered column names to use in a previously transposed and categorically preserved table if by = 'row'. Retransposing with this set should yield an exact replicate of the original data. Default: NULL |
... |
Additional arguments passed on to func. |
This function transforms the supplied data using the func parameter, which is used in the purrr package. The purr package allows the use of anonymous functions as described in the link below:
https://jennybc.github.io/purrr-tutorial/ls03_map-function-syntax.html#anonymous_function,_formula
A tibble that has been transformed.
transposer
select_all, select
modify
Other Data Manipulators:
convert_proportions(),
metacoder_comp_func_1(),
transposer(),
vlookup()
## 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") data <- basic_silva$data$taxa_abundance # Get proportions using the anonymous functions tax_props <- data %>% transformer(~./sum(.)) # Get proportions using explicit functions alt_tax_props <- data %>% transformer(function(x)x/sum(x)) } ## End(Not run)## 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") data <- basic_silva$data$taxa_abundance # Get proportions using the anonymous functions tax_props <- data %>% transformer(~./sum(.)) # Get proportions using explicit functions alt_tax_props <- data %>% transformer(function(x)x/sum(x)) } ## End(Not run)
This function transposes tables containing numeric and categorical data using the tidyr package.
transposer( .data, ids = NULL, header_name, preserved_categories = TRUE, separated_categories = NULL )transposer( .data, ids = NULL, header_name, preserved_categories = TRUE, separated_categories = NULL )
.data |
A matrix/data_frame/tibble for transposing. |
ids |
The column to transpose by. Default: The first column. |
header_name |
A name for the numeric data that will be transposed. |
preserved_categories |
A logical denoting weather categorical data should be conserved. A value of FALSE will cause all categorical data except the ids to be dropped. A value of TRUE will cause the categorical data to preserved by tidyr::uniteing these columns. Default: TRUE |
separated_categories |
A vector containing ordered column names to use in a previously transposed and categorically preserved table. Retransposing with this set should yield an exact replicate of the original data. Default: NULL |
Transposing can help with preforming operations on the rows of your tibbles.
A transposed data table as a tibble.
select_all, select,
reexports, sym,
one_of
gather, unite, spread, separate
Other Data Manipulators:
convert_proportions(),
metacoder_comp_func_1(),
transformer(),
vlookup()
## 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") data <- basic_silva$data$taxa_abundance trans_data <- data %>% transposer(ids = "taxon_id", header_name = "samples") retrans_data <- trans_data %>% transposer(ids="samples", header_name="taxon_id") } ## End(Not run)## 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") data <- basic_silva$data$taxa_abundance trans_data <- data %>% transposer(ids = "taxon_id", header_name = "samples") retrans_data <- trans_data %>% transposer(ids="samples", header_name="taxon_id") } ## End(Not run)
A function that returns a matrix with used for comparing treatment data.
treatment_matrix(obj)treatment_matrix(obj)
obj |
An object to be converted to a taxmap object with |
Use this when you want to do pairwise comparisons.
A matrix with each column representing a comparison to be made.
Other Formatting:
MicrobiomeR_Formats,
as_MicrobiomeR_format(),
as_analyzed_format(),
as_basic_format(),
as_custom_format(),
as_phyloseq_format(),
as_raw_format(),
melt_taxmap()
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
This function validates that Taxmap objects are in a valid format MicrobiomeR format.
validate_MicrobiomeR_format( obj, validated = FALSE, valid_formats, force_format = FALSE, min_or_max = base::max, ... )validate_MicrobiomeR_format( obj, validated = FALSE, valid_formats, force_format = FALSE, min_or_max = base::max, ... )
obj |
A Taxmap object. |
validated |
This parameter provides a way to override validation steps. Use carefully. Default: FALSE |
valid_formats |
A vector of formats that are used for validation. |
force_format |
A logical denoting if the selected format is to be forced. Default: FALSE |
min_or_max |
A base function (min or max) that determines which format is to be forced. This is particularly useful if you provide multiple valid_formats. Min will choose the lowest level format, while max will choose the highest level format. Default: base::max |
... |
An optional list of parameters to use in |
This function can provide a way to check if a taxmap object has undergone a
MicrobiomeR Style Workflow.
If the object is validated, a Taxmap object.
which_format, as_MicrobiomeR_format
Other Validation:
is_analyzed_format(),
is_basic_format(),
is_phyloseq_format(),
is_raw_format(),
order_metacoder_data(),
which_format()
A function that returns a color palette function based off of the viridis package.
viridis_magma_palette( viridis_number = 800, viridis_range = 300:viridis_number, viridis_rev = TRUE, magma_number = 500, magma_range = 50:magma_number, magma_rev = FALSE, ... )viridis_magma_palette( viridis_number = 800, viridis_range = 300:viridis_number, viridis_rev = TRUE, magma_number = 500, magma_range = 50:magma_number, magma_rev = FALSE, ... )
viridis_number |
The total number of colors used to generate the viridis palette. Default: 800 |
viridis_range |
Tne range of colors in the viridis palette to use. Default: 300:viridis_number |
viridis_rev |
A logical for reversing the viridis palette. Default: TRUE |
magma_number |
The total number of colors used to generate the magma palette. Default: 500 |
magma_range |
The range of colors in the magma palette to use. Default: 0:magma_number |
magma_rev |
A logical for reversing the magma palette. Default: FALSE |
... |
These dots are optionally used as both the magma and viridis function parameters. |
The primary purpose of this function is to return a palette-function for generating virdis style color palettes. By taking the viridis::viridis() and the viridis::magma() colors, and manipulating them, this function can help create a unique set of colors that you can distinguish on a busy plot. The hopes of this function is to help improve plots that use more than 20 colors. Use the provided example to view the color palette.
The output of this function is another function (grDevoces::colorRampPalette), which takes a number to generate an interpolated color palette as a character vector.
Other Color Palettes:
combination_palette(),
get_color_palette(),
scico_palette(),
viridis_palette()
## Not run: if(interactive()){ # Use the default values > pal_func <- viridis_palette() # Get a palette with 20 colors > pal <- pal_func(20) # Make a pie plot of the colros. > pie(rep(1, length(pal)), col=pal) } ## End(Not run)## Not run: if(interactive()){ # Use the default values > pal_func <- viridis_palette() # Get a palette with 20 colors > pal <- pal_func(20) # Make a pie plot of the colros. > pie(rep(1, length(pal)), col=pal) } ## End(Not run)
A function that returns a color palette function based off of the viridis package.
viridis_palette( viridis_palette = "viridis", viridis_number = 800, viridis_range = 0:viridis_number )viridis_palette( viridis_palette = "viridis", viridis_number = 800, viridis_range = 0:viridis_number )
viridis_palette |
The viridis palette to use. Default: 'viridis' |
viridis_number |
The number of colors to use in the viridis palette. Default: 800 |
viridis_range |
The range in the color palette to use. Default: c(0, viridis_number) |
The purpose of this function is to provide an interpolated viridis palette for using with the get_color_palette function.
The output of this function is another function (grDevoces::colorRampPalette), which takes a number to generate an interpolated color palette as a character vector.
Other Color Palettes:
combination_palette(),
get_color_palette(),
scico_palette(),
viridis_magma_palette()
## Not run: if(interactive()){ library(MicrobiomeR) basic_pal <- viridis::viridis(n=25, option="magma") better_pal <- get_color_palette(pal_func = viridis_palette, color_no = 25) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) basic_pal <- viridis::viridis(n=25, option="magma") better_pal <- get_color_palette(pal_func = viridis_palette, color_no = 25) } ## End(Not run)
A function that mimics excels vlookup, but for R's dataframe.
vlookup(lookup_vector, df, match_var, return_var)vlookup(lookup_vector, df, match_var, return_var)
lookup_vector |
A vector of items to look up. |
df |
The dataframe to search. |
match_var |
The column name to search in the dataframe. |
return_var |
The column of data to return when matched. |
A function that works like the VLOOKUP function in excel. This function was borrowed from https://www.r-bloggers.com/an-r-vlookup-not-so-silly-idea/.
A vector that contains the items of interest.
Other Data Manipulators:
convert_proportions(),
metacoder_comp_func_1(),
transformer(),
transposer()
## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)## Not run: if(interactive()){ #EXAMPLE1 } ## End(Not run)
A function for looking at a Taxmap object and returning the identified MicrobiomeR format.
which_format(obj)which_format(obj)
obj |
A Taxmap object. |
This function is used to get basic information about the format of the taxmap object that is supplied by the user.
If the format is verified it returns a character string denoting the identified format.
Other Validation:
is_analyzed_format(),
is_basic_format(),
is_phyloseq_format(),
is_raw_format(),
order_metacoder_data(),
validate_MicrobiomeR_format()
## Not run: if(interactive()){ library(MicrobiomeR) fmt <- which fmt(MicrobiomeR::raw_silva_2) print(fmt) } ## End(Not run)## Not run: if(interactive()){ library(MicrobiomeR) fmt <- which fmt(MicrobiomeR::raw_silva_2) print(fmt) } ## End(Not run)