if (!require(remotes)) { install.packages("remotes") }
remotes::install_github("fbreitwieser/pavian")Visualisation of the data
1 Krona
Krona is an interactive visualisation tool for exploring metagenomic species abundance.
1.1 Running Krona
We can use the Kraken2 report files to create Krona plots. The following command imports taxonomy information from the Kraken2 report files and generates an interactive HTML file.
ktImportTaxonomy -o kraken2.krona.html *.kreport2-ospecifies the output HTML file*.kreport2matches all Kraken2 report files in the current directory- The
*wildcard matches any characters, meaning this will include K1.kreport2, K2.kreport2, and W1.kreport2
- The
You may see a warning indicating that some taxonomy IDs were not found. This can be ignored for this practical. In future analyses, this should be resolved by running Krona’s taxonomy update command:
ktImportTaxonomy.sh1.2 Visualising Krona plots
The Krona plot can be viewed in a web browser.
firefox kraken2.krona.html &The Krona output is an interactive, multi-layered pie chart. Key features include:
- To switch between samples, click the sample name in the top left
- To zoom into a lower taxonomic level, double-click a taxonomy name on the chart
- To zoom out, click the taxonomy name in the centre of the chart
- To view percentage statistics, click on a taxonomy name
2 Pavian (alternative to Krona)
Pavian is an interactive Shiny-based application for exploring metagenomic taxonomic classification results, including Kraken2 and Bracken outputs. It provides rich, interactive visualisation and comparison of multiple samples.
2.1 Install Pavian in RStudio
In the RStudio Console:
2.1.1 Launch Pavian
Run the following command in RStudio:
pavian::runApp(port=5000)Pavian will then be available at http://127.0.0.1:5000 in the web browser of your choice.
2.1.2 Load Kraken2 report files
Using the Pavian interface, import the following files:
- K1.kreport2
- K2.kreport2
- W1.kreport2
2.2 When to use Pavian instead of Krona
Use Pavian when:
- You want to compare multiple samples interactively
- You are already working within R or RStudio
- You want richer filtering and comparison tools
Use Krona when:
- You want a single self-contained HTML file
- You need a lightweight visualisation with no R dependency
- You want to easily share results by email or download