Visualization and Reporting - iffatAGheyas/bioinformatics-tutorial-wiki GitHub Wiki
6.2.10 Visualization & Reporting
Effective visualization and reporting turn your analyses into compelling stories. In this section we cover three complementary approaches: Krona for interactive taxonomic sunbursts, phyloseq in R for publication-quality heat trees and barplots, and MicrobiomeAnalyst for rich web-based dashboards.
A. Krona Interactive Plots
Installation
conda install -c bioconda krona
# Or download from https://github.com/marbl/Krona
Prepare a Krona‐compatible table
Krona expects a tab-delimited file with counts by taxonomic path, e.g.:
SampleA Bacteria;Proteobacteria;Gammaproteobacteria;Enterobacterales;Enterobacteriaceae;Escherichia 12345
SampleA Bacteria;Firmicutes;Bacilli;Lactobacillales;Streptococcaceae;Streptococcus 6789
Generate HTML
# Convert Kraken2 report to Krona input
cut -f2,3 kraken2_out/sampleA.bracken.tsv \
| sed '1d' \
| ktImportTaxonomy -o kraken2_out/sampleA.krona.html -
-
-o ...krona.html creates an interactive HTML you can open in any browser.
-
Zoom, search, and export SVG directly from the plot.
B. Phyloseq Heat Trees & Barplots (R)
Installation
# In R
install.packages("phyloseq")
BiocManager::install("metacoder")
install.packages("ggplot2")
Import Data
library(phyloseq)
# ASV/OTU table and taxonomy from your pipeline
ps <- phyloseq(
import_biom("feature-table.biom"),
import_qiime_sample_data("sample-metadata.tsv")
)
Stacked Barplots
library(ggplot2)
# Genus‐level relative abundance
ps_genus <- tax_glom(ps, taxrank = "Genus")
ps_rel <- transform_sample_counts(ps_genus, function(x) x / sum(x))
plot_bar(ps_rel, fill="Genus") +
facet_wrap(~Condition, scales="free_x") +
theme_bw() +
labs(y="Relative abundance")
Heat Trees
library(metacoder)
# Convert phyloseq to metacoder object
obj <- phyloseq_to_metacoder(ps)
# Calculate taxon counts
obj$data$otu_table$count <- calc_taxon_abund(obj,
"otu_table", cols = colnames(otu_table(ps)))
# Plot heat tree
heat_tree(obj,
node_size = n_obs, # number of observations
node_color = log10(n_obs + 1),# log10 of counts
layout = "davidson-harel",
title = "Taxonomic Heat Tree"
)
- Save to file with ggsave("heat_tree.png", width=6, height=6, dpi=300).
C. MicrobiomeAnalyst Dashboards
Overview
MicrobiomeAnalyst is a web platform for multi-omics data that provides interactive plots, statistics, and functional profiling.
Workflow
-
Upload your feature table (OTU/ASV counts) and metadata as CSV or BIOM.
-
Select analyses: diversity, differential abundance, biomarker discovery, correlation networks.
-
Customize plots: heatmaps, volcano plots, correlation networks.
-
Export figures (PNG, PDF, SVG) and full reports.
-
Tip: MicrobiomeAnalyst integrates popular R pack
Tip: MicrobiomeAnalyst integrates popular R packages under the hood (e.g. phyloseq, DESeq2), making it easy to generate publication-ready figures without coding.
Summary of Outputs
kraken2_out/sampleA.krona.html # interactive sunburst
phyloseq_plots/barplot_genus.png # stacked barplot
phyloseq_plots/heat_tree.png # taxonomic heat tree
microbiomeanalyst_report.zip # full HTML/PDF dashboard
With these tools, you can deliver both interactive web reports and static figures for publications or presentations.