Learn R Programming

apTreeshape (version 1.4-1)

dbtrees: Download trees from internet databases.

Description

dbtrees connects to the internet phylogenetic tree database TreeBASE or Pandit, downloads trees with specified ID numbers, and converts them into either the "treeshape" or the "phylo" format. Can solve polytomies.

Usage

dbtrees(db, tree, class="phylo", type="s", quiet=FALSE, 
      model=NULL, p=0.3)

Arguments

db
A character string equals to the name of the database to connect: "pandit" or "treebase".
tree
A vector or list of ID corresponding to the trees to be downloaded.
class
The class of the downloaded objects: must be one of "phylo" (default) or "treebase".
type
The type of the tree: an object of class "character" equals to either "s" (default) or "f" (seed or full). This option is only used for the Pandit database.
quiet
A logical value. If TRUE, nothing will be printed on screen. If FALSE (default), informations about the status of the download are displayed.
model
Argument to be passed to as.treshape.phylo. One of NULL (default), "pda", "biased", "aldous" or "yule"
p
Argument to be passed to as.treshape.phylo (only for the biased speciation model).

Value

  • An object of class "treeshape" or class "phylo" if only one tree is requested, a list of trees otherwise.

Details

The aim of this function is to provide a simple method to retrieve trees and to put them into the "treeshape" or "phylo" format, in order to be able to apply the methods of ape or apTreeshape. This function connects to internet database and download trees using their internal reference number. There is currently no option to retrieve trees from names. See references for more details about the Pandit and TreeBASE databases and the description of their data. This function can solve trees with polytomies using simulation methods (see as.treeshape for more details about the polytomy resolution).

References

http://www.ebi.ac.uk/goldman-srv/pandit/ for more details about the Pandit database. http://www.treebase.org/treebase/ for informations about the TreeBASE database.

See Also

as.treeshape for more details about the convertion of non-binary trees.

Examples

Run this code
if(!inherits(try(open(url("http://www.google.com")), silent = TRUE),
   "try-error")) {
## Sackin's index of a tree within TreeBASE.
sackin(dbtrees(db="treebase", tree=715, class="treeshape"))

## Colless' index of a tree within Pandit
t <- as.treeshape(dbtrees(db="pandit", tree=1, class="phylo"),model="yule")
colless(t)
  
## Collects a tree without printings: 
t <- as.treeshape(dbtrees(db="pandit", tree=709, class="phylo"),model="yule")
plot(t)

## Collects a list of trees :

trees=trees <-sapply(dbtrees(db="pandit", tree=1:5, class="phylo"),FUN=function(x){as.treeshape(x,model="yule")}) 
summary(trees[[2]])
  
## Collects a non-binary tree
phy=as.treeshape(dbtrees(db="pandit", tree=1, class="phylo"),model="yule")
plot(phy)
tree=dbtrees(db="treebase", tree=741, class="treeshape")
tree=dbtrees(db="treebase", tree=741, class="treeshape", model="yule")
plot(tree)
}

Run the code above in your browser using DataLab