*treespace* implements new methods for the exploration and analysis of distributions of phylogenetic trees for a given set of taxa.

To install the development version from github:

```
library(devtools)
install_github("thibautjombart/treespace")
```

The stable version can be installed from CRAN using:

`install.packages("treespace")`

Then, to load the package, use:

```
library("treespace")
## Loading required package: ape
## Loading required package: ade4
## Creating a generic function for 'toJSON' from package 'jsonlite' in package 'googleVis'
## Registered S3 method overwritten by 'spdep':
## method from
## plot.mst ape
## Registered S3 methods overwritten by 'adegraphics':
## method from
## biplot.dudi ade4
## kplot.foucart ade4
## kplot.mcoa ade4
## kplot.mfa ade4
## kplot.pta ade4
## kplot.sepan ade4
## kplot.statis ade4
## scatter.coa ade4
## scatter.dudi ade4
## scatter.nipals ade4
## scatter.pco ade4
## score.acm ade4
## score.mix ade4
## score.pca ade4
## screeplot.dudi ade4
```

The main functions implemented in *treespace* are:

: explore landscapes of phylogenetic trees`treespace`

: open up an application in a web browser for an interactive exploration of the diversity in a set of trees`treespaceServer`

: identify clusters of similar trees`findGroves`

: scatterplot of groups of trees, and`plotGroves`

which enables interactive plotting based on d3.js`plotGrovesD3`

: find geometric median tree(s) to summarise a group of trees`medTree`

: find the distance between transmission trees by comparing their MRCI depth matrices`wiwTreeDist`

: find the median of a list of transmission scenarios`wiwMedTree`

: calculate the distances between trees whose tips belong to the same categories but are not necessarily identically labelled`relatedTreeDist`

: calculate the concordance between a category tree and an individuals tree`treeConcordance`

Other functions are central to the computations of distances between trees:

: characterise a tree by a vector`treeVec`

: find the distance between two tree vectors`treeDist`

: find the pairwise distances of a list of trees`multiDist`

: find the distances of a list of trees from a reference tree`refTreeDist`

: for a pair of trees, list the tips with differing ancestry`tipDiff`

: plot a pair of trees, highlighting the tips with differing ancestry`plotTreeDiff`

: find the most recent common infector (MRCI) matrix from “who infected whom” information`findMRCIs`

: similar to`tipsMRCAdepths`

`treeVec`

but the output is a matrix where columns 1 and 2 correspond to tip labels and column 3 gives the depth of the MRCA of that pair of tips

Distributed datasets include:

: illustrative set of 201 trees built using the neighbour-joining and bootstrapping example from the`woodmiceTrees`

*woodmice*dataset in the*ape*documentation.: 500 trees sampled from a BEAST posterior set of trees from (Drummond and Rambaut, 2007)`DengueTrees`

: 17 dengue virus serotype 4 sequences from (Lanciotti`DengueSeqs`

*et al.*, 1997), from which the`DengueTrees`

were inferred.: the maximum clade credibility (MCC) tree from the`DengueBEASTMCC`

`DengueTrees`

.

*treespace* comes with the following vignettes:

*introduction*: general introduction using a worked example.*Dengue example*: worked example using a Dengue dataset, used in the*treespace*publication.*transmission trees*: worked example using transmission trees.*tip categories*: introduction to the measures for comparing trees with shared tip label “categories”

Contributions are welcome via **pull requests**.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Questions, feature requests and bugs can be reported using the package’s issue system.

Authors:

Contributors:

Maintainer of the CRAN version:

See details of contributions on:

https://github.com/thibautjombart/treespace/graphs/contributors