Home

Awesome

hilldiv 1.5.4

Last update: April 2020

:warning: This version of hilldiv (1.5.4) is different to the version available at CRAN (1.5.1). The CRAN package will be updated when validating all changes.

hilldiv is an R package that provides a set of functions to assist analysis of diversity for diet reconstruction, microbial community profiling or more general ecosystem characterisation analyses based on Hill numbers, using OTU/ASV tables and associated phylogenetic trees as inputs. The package includes functions for (phylo)diversity measurement, (phylo)diversity profile plotting, (phylo)diversity comparison between samples and groups, (phylo)diversity partitioning and (dis)similarity measurement. All of these grounded in abundance-based and incidence-based Hill numbers.

The statistical framework developed around Hill numbers encompasses many of the most broadly employed diversity (e.g. richness, Shannon index, Simpson index), phylogenetic diversity (e.g. Faith’s PD, Allen’s H, Rao’s quadratic entropy) and dissimilarity (e.g. Sørensen index, Unifrac distances) metrics. This enables the most common analyses of diversity to be performed while grounded in a single statistical framework. For details about the use of Hill numbers in molecularly characterised biological systems, read the following article.

Alberdi A, Gilbert MTP. (2019). A guide to the application of Hill numbers to DNA‐based diversity analyses. Molecular Ecology Resources. 19(4): 804-817. https://doi.org/10.1111/1755-0998.13014

If you want/need to cite hilldiv: Alberdi A, Gilbert MTP. 2019. hilldiv: an R package for the integral analysis of diversity based on Hill numbers. bioRxiv, 545665. https://www.biorxiv.org/content/10.1101/545665v1

Some recent papers that used hilldiv:

List of functions

FunctionShort explanationDocumentation
hill_div()Neutral or phylogenetic Hill number computationLINK
index_div()Neutral or phylogenetic diversity index computationLINK
div_profile()(Phylo)Diversity profiles of individual samples or groups of samplesLINK
div_profile_plot()Visual representation of (phylodiversity profiles)LINK
div_test()Diversity comparison between two or multiple groups of samplesLINK
div_test_plot()Visual representation of diversity testsLINK
depth_cov()Assessment of the sequencing depth per sampleLINK
div_part()Hierarchical diversity partitioningLINK
alpha_div()Alpha diversity computationLINK
gamma_div()Gamma diversity computationLINK
beta_dis()(Dis)similarity computation based on beta diversitiesLINK
pair_dis()Pairwise (dis)similarity computation based on beta diversitiesLINK
pair_dis_plot()Visual representation of pairwise (dis)similaritiesLINK
dis_nmds()NMDS representation pairwise (dis)similaritiesTo be added
UqN()Jaccard-type overlap computation from beta diversitiesLINK
CqN()Sørensen-type overlap from beta diversitiesLINK
SqN()Jaccard-type turnover-complement from beta diversitiesLINK
VqN()Sørensen-type turnover-complement from beta diversitiesLINK
to.incidence()Convert an abundance-based count (OTU/ASV) table into an incidence-based objectLINK
to.occurrences()Convert an abundance-based vector or matrix to occurrencesTo be added
merge_samples()Combine samples into groups defined by the hierarchy table.LINK
match_data()Filter count tables and trees to match OTUs/ASVs in both data filesLINK
depth_filt()Filter samples according to a minimum sequencing depth thresholdLINK
copy_filt()Filter OTUs/ASVs according to a minimum copy number thresholdLINK
is.nested()Check if hierarchy structure is nestedLINK
tss()Total sum scaling per sampleLINK
tree_depth()Tree depth computationLINK

Installation

To install hilldiv in your R environment, from October 2019, you can rely on the built-in install.packages() function:

install.packages("hilldiv")
library(hilldiv)

Or alternatively, you need to 1) install devtools, 2) load devtools library, 3) install hilldiv using devtools and 4) finally load hilldiv library to your environment.

install.packages("devtools")
library(devtools)
install_github("anttonalberdi/hilldiv")
library(hilldiv)

If not installed, it will automatically install the following dependencies: ggplot2, ggpubr, RColorBrewer, data.table, ape, vegan, geiger, qgraph and FSA.

If the console returns the following error:

"tar: Failed to set default locale"

Type the following in the console and restart R

system('defaults write org.R-project.R force.LANG en_US.UTF-8')

Updating

If you want to update your local hilldiv library from Github, you can use the following script:

remove.packages("hilldiv")
install_github("anttonalberdi/hilldiv")
library(hilldiv)

Workflow

<img src="https://github.com/anttonalberdi/DiverHill/blob/master/figures/hilldiv_workflow.png" title="Hilldiv workflow">

Documentation

I am creating extensive documentation about Hill numbers and implementation of hilldiv in the Hilldiv WIKI.

0 - Introduction to Hill numbers: an introduction to Hill numbers. If you don't know the basics about Hill numbers, you should first read this page.

1 - Data files: basic information about the data types implemented in the package hilldiv.

2 - Data preprocessing: count table, phylogenetic tree and metadata processing for the optimal using the functions copy_filt(), depth_cov(), match_data() and to.incidence()

3.1 - Diversity computation of a single system: diversity computation of a single system using the functions hill_div() and index_div().

3.2 - Diversity computation and comparison of multiple systems: diversity computation and comparison of multiple systems or contrasting groups using the functions hill_div(), div_test() and div_test_plot().

3.3 - Diversity profiles: generation of diversity profile tables and plots using functions div_profile() and div_profile_plot().

4 - Diversity partitioning: hierarchical diversity partitioning using the function div_part().

References