Skip to contents

Subsetting or sorting phyloseq samples

Functions for filtering or reording samples in a phyloseq object. These characteristically start with “ps_”, which is short for phyloseq.

ps_filter()
Filter phyloseq samples by sample_data variables
ps_arrange()
Arrange samples in phyloseq by sample_data variables or taxon abundance
ps_seriate()
Arrange samples in a phyloseq by microbiome similarity
ps_sort_ord() ord_order_samples()
Sort phyloseq samples by ordination axes scores
ps_reorder()
Set order of samples in phyloseq object
ps_dedupe()
De-duplicate phyloseq samples
ps_drop_incomplete()
Deselect phyloseq samples with sample_data missings

Manipulating phyloseq sample_data

Functions for modifying and augmenting the sample data within phyloseq objects. These also start with “ps_”, which is short for phyloseq.

ps_select()
Select phyloseq sample_data using dplyr::select syntax
ps_mutate()
Modify or compute new sample_data in phyloseq object
ps_join()
Join a dataframe to phyloseq sample data
ps_otu2samdat()
Copy phyloseq otu_table data to sample_data
ps_melt()
Melt phyloseq data object into large data.frame (tibble)

Manipulating taxa

Functions for modifying the taxonomic information contained within phyloseq objects. These characteristically start with “tax_”, which is short for taxa.

tax_fix()
Replace unknown, NA, or short tax_table values
tax_fix_interactive()
Shiny app to help you use tax_fix
tax_prepend_ranks()
Add rank prefixes to phyloseq tax_table values
tax_filter()
Filter rare and/or low abundance taxa from a phyloseq object
tax_agg()
Aggregate taxa and track aggregation in psExtra
tax_transform()
Transform taxa in phyloseq object and record transformation
tax_scale()
Mean-center and SD-scale taxa in phyloseq
tax_select()
Subset phyloseq object by (partial) taxa names
tax_mutate()
Modify or compute new taxonomic ranks in phyloseq
tax_rename()
Make new phyloseq taxa names from classification and taxon abundance info
tax_name()
Simple way to set unique taxa_names for phyloseq object
tax_sort()
Sort taxa in phyloseq otu_table and tax_table
tax_sort_ord() ord_order_taxa()
Order taxa in phyloseq by their loading vectors
tax_reorder()
Reorder taxa in phyloseq object using vector of names
tax_top()
Get names of "top" n taxa
tax_names2rank()
Add taxa_names as last column in phyloseq tax_table

Functions for assessing and visualising overall microbiota composition and its associations with phyloseq sample data variables. dist_* functions calculate or use sample-sample distances/dissimilarities. ord_* functions calculate or use sample ordinations.

dist_calc()
Calculate distances between pairs of samples in phyloseq object
dist_permanova()
Calculate PERMANOVA after dist_calc()
dist_bdisp()
Wrapper for vegan::betadisper()
ord_calc()
Ordinate samples (arrange by similarity in multiple dimensions)
ord_plot()
Customisable ggplot2 ordination plot
stat_chull()
Draw convex hull for a set of points on a ggplot
add_paths()
Add paths connecting points on a ggplot scatterplot
tax_lab_style() constraint_lab_style()
Create list for ord_plot() *_lab_style arguments
vec_constraint() vec_tax_sel() vec_tax_all()
Create ordination plot vector styling lists
ord_plot_iris()
Circular compositional barplot sorted by ordination angle
ord_explore()
Interactively explore microbial compositions of ordinated samples
scale_shape_girafe_filled()
Filled shapes for ggiraph interactive plots
ps_get() dist_get() ord_get() info_get() perm_get() bdisp_get() tax_models_get() tax_stats_get() taxatree_models_get() taxatree_stats_get() otu_get() tt_get() samdat_tbl()
Extract elements from psExtra class

Taxon models and tree visualisations

Functions for modelling and visualising associations between individual microbes and phyloseq sample data variables.

tax_model()
Statistical modelling for individual taxa in a phyloseq
taxatree_models()
Statistical modelling for individual taxa across multiple ranks
taxatree_models2stats() tax_models2stats()
Extract statistics from taxatree_models or tax_model output
taxatree_stats_p_adjust()
Adjust p values in taxatree_stats dataframe
taxatree_plots()
Plot statistical model results for all taxa on a taxonomic tree
taxatree_plotkey()
Draw labelled key to accompany taxatree_plots
taxatree_label()
Add logical label column to taxatree_stats dataframe
taxatree_plot_labels()
Add labels to taxatree plots/key
taxatree_nodes() taxatree_edges()
Create node and edge dataframes for taxatree_plots
cor_test()
Simple wrapper around cor.test for y ~ x style formula input

Heatmap plotting functions

Functions for drawing and annotating heatmaps

comp_heatmap()
Draw heatmap of microbiome composition across samples
cor_heatmap()
Microbe-to-sample-data correlation heatmap
taxAnnotation()
Helper to specify a HeatmapAnnotation for taxa
anno_tax_box()
Helper to specify heatmap annotation for showing taxa abundance on boxplot
anno_tax_prev()
Helper to specify heatmap annotation for showing taxa prevalence as barplot
anno_tax_density()
Helper to specify heatmap annotation for showing taxa abundance density plot
sampleAnnotation()
Helper to specify a HeatmapAnnotation for samples in comp_heatmap
anno_sample()
Helper to specify simple comp_heatmap annotation for other sample data
anno_sample_cat()
Helper to specify comp_heatmap annotation for categorical sample data
anno_cat()
Create colored rectangle annotations for categorical data
anno_cat_legend()
Convenience function for generating a legend for anno_cat annotations.
varAnnotation()
Helper to specify a HeatmapAnnotation for variables in cor_heatmap
anno_var_box()
Helper to specify heatmap annotation for variable distribution boxplots
anno_var_hist()
Helper to specify heatmap annotation for variable distribution histograms
anno_var_density()
Helper to specify heatmap annotation for variable distribution density plot
heat_palette()
Easy palettes for ComplexHeatmap
heat_numbers()
Aesthetic settings for drawing numbers on heatmap tiles
heat_grid()
set options for drawing gridlines on heatmaps
adjacent_side()
Simple heatmap helper to get a default adjacent side for another annotation

Other functions

Other assorted functions

comp_barplot()
Plot (grouped and ordered) compositional barplots
distinct_palette()
Colour palettes suitable for 20+ categories
tax_palette()
Make a fixed taxa colour palette e.g. for comp_barplot
tax_palette_plot()
tax_palette plotting helper function
ps_calc_dominant()
Calculate dominant taxon in each phyloseq sample
ps_calc_diversity()
Calculate diversity index and add to phyloseq sample data
ps_calc_richness()
Calculate richness estimate and add to phyloseq sample data
phyloseq_validate()
Check for (and fix) common problems with phyloseq objects
prev()
Calculate prevalence from numeric vector

Datasets

shao19
Gut microbiota relative abundance data from Shao et al. 2019
ibd
IBD study data in phyloseq object.

Other

microViz-package microViz
microViz: microbiome data analysis and visualization
print(<psExtraInfo>)
Print method for psExtraInfo object
psExtra-class
Define psExtra class S4 object
upgrade_ps_extra_to_psExtra()
Convert old format "ps_extra" objects to new "psExtra" objects
dist_calc_seq()
Calculate distances between sequential samples in ps_extra/phyloseq object
tax_anno() anno_prev() anno_abund() var_anno() old_anno_var_hist() old_anno_var_box()
DEPRECATED Heatmap annotations helpers