Learn R Programming

Pavian is a interactive browser application for analyzing and visualization metagenomics classification results from classifiers such as Kraken, Centrifuge and MetaPhlAn. Pavian also provides an alignment viewer for validation of matches to a particular genome.

For more information look at the preprint at http://biorxiv.org/content/early/2016/10/31/084715.full.pdf+html . Please cite the preprint if you use Pavian in your research.

You can try out Pavian at https://fbreitwieser.shinyapps.io/pavian/.

Installation and deployment

Pavian is a R package, and thus requires R to run. Look here for how to install R. On Windows, you probably need to install Rtools. On Ubuntu, install r-base-dev. Once you started R, the following commands will install the package:

if (!require(remotes)) { install.packages("remotes") }
remotes::install_github("fbreitwieser/pavian")

To run Pavian from R, type

pavian::runApp(port=5000)

Pavian will then be available at http://127.0.0.1:5000 in the web browser of you choice.

Alternatively, you can install and test Pavian with the following command:

shiny::runGitHub("fbreitwieser/pavian", subdir = "inst/shinyapp")

To try out Pavian, load the example files directly from the interface.

Installing Rsamtools

The alignment viewer uses Rsamtools. To install this package from Bioconductor, use the following commands

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("Rsamtools")

Installing to Shinyapps.io

In order to install to Shinyapps.io, because of the Bioconductor repo dependencies, you need to first set the options using setRepositories() in R. At that point a `rsconnect::deployApp('pavian/inst/shinapp/') should work.

Docker image

As an alternative to installing Pavian in R, a Docker image is available at florianbw/pavian. When you run this docker image, Pavian will start automatically on port 80, which you need to make available to the hosting machine. On the shell, you can pull the image and remap the Docker port to port 5000 with the following commands:

docker pull 'florianbw/pavian'
docker run --rm -p 5000:80 florianbw/pavian

Screenshots

Supported formats

pavian natively supports the Kraken and MetaPhlAn-style report formats. In extension, you can use Centrifuge results by running centrifuge-kreport on Centrifuge output files, and Kaiju results by running kraken-report on Kaiju output files (see issue #11)

Error: Maximum upload size exceeded The maximum upload size is defined by the option shiny.maxRequestSize. To increase it to 500 MB, for example, type the following before pavian::runApp():

options(shiny.maxRequestSize=500*1024^2)

If your BAM file contains the unaligned reads, you can decrease the file size before uploading by getting rid of non-aligned reads using samtools view -F4.

Acknowledgments

We'd like to thank the creators, contributors and maintainers of several packages without whom Pavian wouldn't exist:

  • Winston Chang, Hadley Wickham, Joe Cheng, JJ Allaire and all other developers at Rstudio and outside who contribute to the amazing set of packages behind shiny and the tidyverse (shiny, shinydashboard, DT, dplyr, plyr, htmltools, htmlwidgets, rmarkdown, knitr, ggplot2, rappdirs)
  • Mike Bostock and all developers behind the amazong D3 visualization library
  • Dean Atali for the shinyjs R package
  • dreamR developers for the shinyWidgets R package
  • Jonathan Owen for rhandsontable widget, based on the handsontable javascript library
  • M. Morgan and the other developers behind Rsamtools, as well as Heng Li and the other developers behind samtools
  • Christopher Garund and the other developers behind networkD3, on which sankeyD3 is based
  • The developers of jstree, on which shinyFileTree is based

Copy Link

Version

Version

1.0.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Florian P Breitwieser

Last Published

April 11th, 2021

Functions in pavian (1.0.0)

get_pileup

Get the pileup-statistics from a bam file using Rsamtools
pavianServer

Pavian server function
summarize_reports

Summarize list of reports
normalize

Helper function to normalize data
summarize_report

Summarize the result of a metagenomics report
read_reports

Read metagenomics classification results ('reports'), with Shiny progress bar
get_seqlengths

Get sequence lengths from a bam file
read_report2

Read kraken or centrifuge-style report
robust_zscore

Calculate robust z-score on matrix
humanreadable

Make a number human readable
load_or_create

Load a file from a cache directory, or create and save it
merge_reports

Merge report files into a wide format, with column(s) for each report.
runApp

Run Pavian web interface
sampleModule

Server part for sample module
sampleModuleUI

UI part for sample module
filter_taxon

Filter lines from a kraken report result based on the taxonomy name
merge_reports2

Merge report files into a wide format, with column(s) for each report.
get_nreads

Get number of aligned reads from a bam file
read_report

Read Kraken-style and MetaPhlAn reports
read_sample_data

Read sample definitions from a directory
plot_pileup

Plot a pileup
read_server_directory1

Search for classification results in a directory and its children
reportOverviewModuleUI

UI part of report overview module
zero_if_na

Helper function that sets NAs to zeros in a supplied data.frame
dashboardUI

Function building dashboard UI, used in Shiny app
reportOverviewModule

Shiny modules to display an overview of metagenomics reports
alignmentModule

Server part of alignment module
filter_taxa

Filter taxon
filter_cladeReads

Remove specified taxa or whole clades this function removes the read numbers from the parents, too
beautify_colnames

Beautify colnames
comparisonModule

Server part of comparison module
dataInputModuleUI

UI part of pavian data input module
dataInputModule

Server part of pavian data input module.
alignmentModuleUI

UI part of alignment module
comparisonModuleUI

UI part of the comparison module