Binary files 1.1.2-1/build/vignette.rds and 1.1.3-1/build/vignette.rds differ diff -pruN 1.1.2-1/debian/changelog 1.1.3-1/debian/changelog --- 1.1.2-1/debian/changelog 2018-03-16 09:40:27.000000000 +0000 +++ 1.1.3-1/debian/changelog 2018-05-15 06:36:19.000000000 +0000 @@ -1,3 +1,13 @@ +r-cran-treespace (1.1.3-1) unstable; urgency=medium + + * New upstream version + * Maintainer: Debian R Packages Maintainers + * Point Vcs fields to salsa.debian.org + * dh-update-R to update Build-Depends + + -- Andreas Tille Tue, 15 May 2018 08:36:19 +0200 + r-cran-treespace (1.1.2-1) unstable; urgency=medium * New upstream version diff -pruN 1.1.2-1/debian/control 1.1.3-1/debian/control --- 1.1.2-1/debian/control 2018-03-16 09:40:27.000000000 +0000 +++ 1.1.3-1/debian/control 2018-05-15 06:36:19.000000000 +0000 @@ -1,5 +1,5 @@ Source: r-cran-treespace -Maintainer: Debian Med Packaging Team +Maintainer: Debian R Packages Maintainers Uploaders: Andreas Tille Section: gnu-r Priority: optional @@ -19,13 +19,14 @@ Build-Depends: debhelper (>= 11~), r-cran-phangorn, r-cran-phytools, r-cran-rcpp, + r-cran-rgl, r-cran-rlumshiny, r-cran-scatterd3, r-cran-shiny, r-cran-shinybs -Standards-Version: 4.1.3 -Vcs-Browser: https://anonscm.debian.org/git/debian-med/r-cran-treespace.git -Vcs-Git: https://anonscm.debian.org/git/debian-med/r-cran-treespace.git +Standards-Version: 4.1.4 +Vcs-Browser: https://salsa.debian.org/r-pkg-team/r-cran-treespace +Vcs-Git: https://salsa.debian.org/r-pkg-team/r-cran-treespace.git Homepage: https://cran.r-project.org/package=treespace Package: r-cran-treespace diff -pruN 1.1.2-1/DESCRIPTION 1.1.3-1/DESCRIPTION --- 1.1.2-1/DESCRIPTION 2018-02-22 18:11:40.000000000 +0000 +++ 1.1.3-1/DESCRIPTION 2018-05-14 15:48:19.000000000 +0000 @@ -1,7 +1,7 @@ Package: treespace Title: Statistical Exploration of Landscapes of Phylogenetic Trees -Date: 2018-02-20 -Version: 1.1.2 +Date: 2018-05-14 +Version: 1.1.3 Authors@R: c(TJ = person("Thibaut", "Jombart", email="thibautjombart@gmail.com", role = "aut"), MK = person("Michelle", "Kendall", email="michelle.kendall@bdi.ox.ac.uk", role = c("aut", "cre")), JAG = person("Jacob", "Almagro-Garcia", role = "aut"), @@ -9,13 +9,14 @@ Authors@R: c(TJ = person("Thibaut", "Jom Maintainer: Michelle Kendall Description: Tools for the exploration of distributions of phylogenetic trees. This package includes a 'shiny' interface which can be started from R using - treespaceServer(). + treespaceServer(). + For further details see Jombart et al. (2017) . Depends: R (>= 3.4.0), ape, ade4 Imports: adegenet, adegraphics, adephylo, combinat, compiler, distory, fields, htmlwidgets, MASS, parallel, phangorn, phytools, Rcpp, - RLumShiny, scatterD3, shiny, shinyBS, utils + rgl, RLumShiny, scatterD3, shiny, shinyBS, utils LinkingTo: Rcpp -Suggests: ggplot2, igraph, knitr, pander, RColorBrewer, reshape2, rgl, +Suggests: ggplot2, igraph, knitr, pander, RColorBrewer, reshape2, rmarkdown, testthat License: MIT + file LICENSE LazyData: true @@ -25,11 +26,14 @@ Collate: RcppExports.R metrics.R medTree tipsMRCAdepths.R treeConcordance.R RoxygenNote: 6.0.1 VignetteBuilder: knitr +URL: https://cran.r-project.org/package=treespace, + https://github.com/thibautjombart/treespace +BugReports: https://github.com/thibautjombart/treespace/issues NeedsCompilation: yes -Packaged: 2018-02-21 20:23:39 UTC; Michelle +Packaged: 2018-05-14 15:00:12 UTC; michellekendall Author: Thibaut Jombart [aut], Michelle Kendall [aut, cre], Jacob Almagro-Garcia [aut], Caroline Colijn [aut] Repository: CRAN -Date/Publication: 2018-02-22 18:11:40 UTC +Date/Publication: 2018-05-14 15:48:19 UTC diff -pruN 1.1.2-1/inst/CITATION 1.1.3-1/inst/CITATION --- 1.1.2-1/inst/CITATION 1970-01-01 00:00:00.000000000 +0000 +++ 1.1.3-1/inst/CITATION 2018-05-14 08:57:28.000000000 +0000 @@ -0,0 +1,14 @@ +citHeader("To cite treespace in publications, please use:") + +citEntry(entry = "article", + author = "Thibaut Jombart, Michelle Kendall, Jacob Almagro-Garcia and Caroline Colijn", + title = "treespace: Statistical Exploration of Landscapes of Phylogenetic Trees", + journal = "Molecular Ecology Resources", + volume = "17", + issue = "6", + pages = "1385-1392", + publisher = "Wiley", + year = "2017", + url = "https://doi.org/10.1111/1755-0998.12676", + textVersion = "T. Jombart, M. Kendall, J. Almagro-Garcia and C. Colijn. treespace: Statistical Exploration of Landscapes of Phylogenetic Trees. Molecular Ecology Resources, 17(6):1385-1392, 2017." +) \ No newline at end of file diff -pruN 1.1.2-1/inst/doc/DengueVignette.html 1.1.3-1/inst/doc/DengueVignette.html --- 1.1.2-1/inst/doc/DengueVignette.html 2018-02-21 20:22:15.000000000 +0000 +++ 1.1.3-1/inst/doc/DengueVignette.html 2018-05-14 14:59:56.000000000 +0000 @@ -1,4658 +1,373 @@ - - - - - - - - - - - - - - - - -treespace worked example: Dengue trees - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

treespace worked example: Dengue trees

-

Michelle Kendall, Thibaut Jombart

-

2018-02-21

- - - -

This vignette demonstrates the use of treespace to compare a collection of trees. For this example we use trees inferred from 17 dengue virus serotype 4 sequences from Lanciotti et al. (1997). We include a sample of trees from BEAST (v1.8), as well as creating neighbour-joining (NJ) and maximum-likelihood (ML) trees.

-
-

Loading treespace and data:

-

Load the required packages:

-
library("treespace")
-library("phangorn")
-library("adegenet")
-library("rgl")
-

Load BEAST trees:

-
data(DengueTrees)
-

We load a random sample of 500 of the trees (from the second half of the posterior) produced using BEAST v1.8 with xml file 4 from Drummond and Rambaut (2007). It uses the standard GTR + Gamma + I substitution model with uncorrelated lognormal-distributed relaxed molecular clock. Each tree has 17 tips.

-

For convenience in our initial analysis we will take a random sample of 200 of these trees; sample sizes can be increased later.

-
set.seed(123)
-BEASTtrees <- DengueTrees[sample(1:length(DengueTrees),200)]
-

Load nucleotide sequences:

-
data(DengueSeqs)
-
-
-

Creating neighbour-joining and maximum likelihood trees:

-

Create a neighbour-joining (NJ) tree using the Tamura and Nei (1993) model (see ?dist.dna for more information) and root it on the outgroup "D4Thai63":

-
makeTree <- function(x){
-  tree <- nj(dist.dna(x, model = "TN93"))
-  tree <- root(tree, resolve.root=TRUE, outgroup="D4Thai63")
-  tree
-}
-DnjRooted <- makeTree(DengueSeqs)
-# Note, there is a (small) negative branch length. 
-# We set this to 0 to avoid warnings from the phangorn package later:
-DnjRooted$edge.length[which(DnjRooted$edge.length < 0)] <- 0
-plot(DnjRooted)
-

-

We use boot.phylo to bootstrap the tree:

-
Dnjboots <- boot.phylo(DnjRooted, DengueSeqs, B=100, 
-                   makeTree, trees=TRUE, rooted=TRUE)
-Dnjboots
-

and we can plot the tree again, annotating it with the bootstrap clade support values:

-
plot(DnjRooted)
-drawSupportOnEdges(Dnjboots$BP)
-

-

We create a maximum-likelihood (ML) tree and root it as before:

-
Dfit.ini <- pml(DnjRooted, as.phyDat(DengueSeqs), k=4)
-Dfit <- optim.pml(Dfit.ini, optNni=TRUE, optBf=TRUE,
-                  optQ=TRUE, optGamma=TRUE, model="GTR")
-
## Warning: I unrooted the tree
-
# root:
-DfitTreeRooted <- root(Dfit$tree, resolve.root=TRUE, outgroup="D4Thai63")
-

View the ML tree:

-
plot(DfitTreeRooted)
-

-

Create bootstrap trees:

-
# bootstrap supports:
-DMLboots <- bootstrap.pml(Dfit, optNni=TRUE)
-# root:
-DMLbootsrooted <- lapply(DMLboots, function(x) root(x, resolve.root=TRUE, outgroup="D4Thai63"))
-class(DMLbootsrooted) <- "multiPhylo"
-

Plot the ML tree again, with bootstrap support values:

-
plotBS(DfitTreeRooted, DMLboots, type="phylogram")
-

-
-
-

Using treespace to compare trees

-

We now use the function treespace to find and plot distances between all these trees:

-
# collect the trees into a single object of class multiPhylo:
-DengueTrees <- c(BEASTtrees, Dnjboots$trees, DMLbootsrooted,
-                     DnjRooted, DfitTreeRooted)
-class(DengueTrees) <- "multiPhylo"
-# add tree names:
-names(DengueTrees)[1:200] <- paste0("BEAST",1:200)
-names(DengueTrees)[201:300] <- paste0("NJ_boots",1:100)
-names(DengueTrees)[301:400] <- paste0("ML_boots",1:100)
-names(DengueTrees)[[401]] <- "NJ"
-names(DengueTrees)[[402]] <- "ML"
-# create vector corresponding to tree inference method:
-Dtype <- c(rep("BEAST",200),rep("NJboots",100),rep("MLboots",100),"NJ","ML")
-
-# use treespace to find and project the distances:
-Dscape <- treespace(DengueTrees, nf=5)
-
# simple plot:
-plotGrovesD3(Dscape$pco, groups=Dtype)
-
- -

The function plotGrovesD3 produces interactive d3 plots which enable zooming, moving, tooltip text and legend hovering. We now refine the plot with colour-blind friendly colours (selected using ColorBrewer2), bigger points, varying symbols and point opacity to demonstrate the NJ and ML trees, informative legend title and smaller legend width:

-
Dcols <- c("#1b9e77","#d95f02","#7570b3")
-Dmethod <- c(rep("BEAST",200),rep("NJ",100),rep("ML",100),"NJ","ML")
-Dbootstraps <- c(rep("replicates",400),"NJ","ML")
-Dhighlight <- c(rep(1,400),2,2)
-plotGrovesD3(Dscape$pco, 
-             groups=Dmethod, 
-             colors=Dcols,
-             col_lab="Tree type",
-             size_var=Dhighlight,
-             size_range = c(100,500),
-             size_lab="",
-             symbol_var=Dbootstraps,
-             symbol_lab="",
-             point_opacity=c(rep(0.4,400),1,1), 
-             legend_width=80)
-
- -

We can also add tree labels to the plot. Where these overlap, the user can use “drag and drop” to move them around for better visibility.

-
plotGrovesD3(Dscape$pco, 
-             groups=Dmethod, 
-             treeNames = names(DengueTrees), # add the tree names as labels
-             colors=Dcols,
-             col_lab="Tree type",
-             size_var=Dhighlight,
-             size_range = c(100,500),
-             size_lab="",
-             symbol_var=Dbootstraps,
-             symbol_lab="",
-             point_opacity=c(rep(0.4,400),1,1), 
-             legend_width=80)
-
- -

Alternatively, where labels are too cluttered, it may be preferable not to plot them but to make the tree names available as tooltip text instead:

-
plotGrovesD3(Dscape$pco, 
-             groups=Dmethod, 
-             tooltip_text = names(DengueTrees), # add the tree names as tooltip text
-             colors=Dcols,
-             col_lab="Tree type",
-             size_var=Dhighlight,
-             size_range = c(100,500),
-             size_lab="",
-             symbol_var=Dbootstraps,
-             symbol_lab="",
-             point_opacity=c(rep(0.4,400),1,1), 
-             legend_width=80)
-
- -

The scree plot is available as part of the treespace output:

-
barplot(Dscape$pco$eig, col="navy")
-

-

We can also view the plot in 3D:

-
library(rgl)
-
Dcols3D <- c(rep(Dcols[[1]],200),rep(Dcols[[2]],100),rep(Dcols[[3]],100),Dcols[[2]],Dcols[[3]])
-rgl::plot3d(Dscape$pco$li[,1],Dscape$pco$li[,2],Dscape$pco$li[,3],
-       type="s",
-       size=c(rep(1.5,400),3,3), 
-       col=Dcols3D,
-       xlab="", ylab="", zlab="")
- - -
- -
- -

-You must enable Javascript to view this page properly. -

- -
-
-

treespace analysis

-

From these plots we can see that treespace has identified variation in the trees according to the Kendall Colijn metric (\(\lambda=0\), ignoring branch lengths). The NJ and ML bootstrap trees have broadly similar topologies but are different from any of the BEAST trees. We can check whether any bootstrap trees have the same topology as either the NJ or ML tree, as follows:

-
# trees with the same topology as the NJ tree:
-which(as.matrix(Dscape$D)["NJ",]==0)
-
## NJ_boots91         NJ 
-##        291        401
-
# trees with the same topology as the ML tree:
-which(as.matrix(Dscape$D)["ML",]==0)
-
##  ML_boots1  ML_boots6 ML_boots26 ML_boots40 ML_boots43 ML_boots48 
-##        301        306        326        340        343        348 
-## ML_boots51 ML_boots62 ML_boots65 ML_boots69 ML_boots70 ML_boots76 
-##        351        362        365        369        370        376 
-## ML_boots79         ML 
-##        379        402
-

This shows that the NJ tree has the same topology as one NJ bootstrap tree and one ML bootstrap tree. The ML tree has the same topology as 15 ML bootstrap trees, but no NJ bootstrap trees.

-

We can compare pairs of trees using the plotTreeDiff function to see exactly where their differences arise. Tips with identical ancestry in the two trees are coloured grey, whereas tips with differing ancestry are coloured peach-red, with the colour darkening according to the number of ancestral differences found at each tip. Since we are comparing the trees topologically (ignoring branch lengths, for the moment), we plot with constant branch lengths for clarity.

-
# comparing NJ and ML:
-plotTreeDiff(DnjRooted,DfitTreeRooted, use.edge.length=FALSE)
-

-
treeDist(DnjRooted,DfitTreeRooted)
-
## [1] 13.93
-

We can adjust the plot settings to make the visualisation clearer:

-
# comparing NJ and ML:
-plotTreeDiff(DnjRooted,DfitTreeRooted, use.edge.length=FALSE, 
-             treesFacing = TRUE, colourMethod = "palette", palette = funky)
-

-

For pairwise comparisons it is helpful to find a small number of representative trees. We can find a geometric median tree from the BEAST trees using the medTree function:

-
BEASTmed <- medTree(BEASTtrees)
-

There are two median trees, with identical topology:

-
BEASTmed$trees
-
## 2 phylogenetic trees
-
treeDist(BEASTmed$trees[[1]],BEASTmed$trees[[2]])
-
## [1] 0
-

so we may select one of them as a BEAST representative tree. Note that for a more thorough analysis it may be appropriate to identify clusters among the BEAST trees and select a summary tree from each cluster: we demonstrate this approach later in the vignette.

-
BEASTrep <- BEASTmed$trees[[1]]
-
# comparing BEAST median and NJ:
-plotTreeDiff(BEASTrep,DnjRooted, use.edge.length=FALSE, 
-             treesFacing = TRUE, colourMethod = "palette", palette = funky)
-

-
treeDist(BEASTrep,DnjRooted)
-
## [1] 13.27
-
# comparing BEAST median and ML:
-plotTreeDiff(BEASTrep,DfitTreeRooted, use.edge.length=FALSE, 
-             treesFacing = TRUE, colourMethod = "palette", palette = funky)
-

-
treeDist(BEASTrep,DfitTreeRooted)
-
## [1] 9.487
-
# comparing BEAST median to a random BEAST tree:
-num <- runif(1,1,200)
-randomBEASTtree <- BEASTtrees[[num]]
-plotTreeDiff(BEASTrep, randomBEASTtree, use.edge.length=FALSE, 
-             treesFacing = TRUE, colourMethod = "palette", palette = funky)
-