Pretty heatmaps

pheatmap is a great package for making nice heatmaps in R.

The ps_pheatmap is a function in MicEco, which wraps the pheatmap function to make pretty heatmaps easily directly from phyloseq objects.

In [1]:
# Packages needed
library(MicEco) # https://github.com/Russel88/MicEco
In [2]:
# Data
library(phyloseq)
load("../data/physeq.RData")

Heatmap

Here we agglomorate the taxa to the Class level (tax_agg = "Class"). We filter by classes at least present in 10 samples (min_samples = 10). We annotate by the Time variable (annot_samp = "Time"). All in one go.

ps_pheatmap accepts similar arguments as the original pheatmap function. So we can for example also hide the column names (show_colnames = FALSE).

By default, abundances are transformed to relative abundances, these are then log10 transformed. The default color map is viridis::viridis, with absent taxa as black. Taxa are ordered by average abundance.

In [3]:
ps_pheatmap(phy, tax_agg = "Class", 
            min_samples = 10, 
            annot_samp = "Time", 
            show_colnames = FALSE)
11 features grouped as 'Others' in the output