Automatic Phylogenetic Tree Generator

Christophe Benjamin

March 28, 2017

Use of aptg

The aptg package is used to generate phylogenetic trees from a vector of species names or a tree of a taxon down to whatever taxon that is included in the first one. The phylogenetic tree are generated from brranching::phylomatic based on the program of the same name accessible there : http://phylodiversity.net/phylomatic/.

When the tree is generated from a vector of species names, distance matrices are given.

taxa.tree

The function needs list of species name as an input and will give phylogenetic trees and distance matrices as an output. Let’s do an example with a mixed list of mammal and angiosperm species.

taxa.tree(c("Canis lupus", "Canis latrans", "Acer saccharum", "Castor canadensis", "Alces alces", "Acer rubrum", "Vulpes vulpes", "Salix babylonica", "Odocoileus virginianus", "Betula alleghaniensis", "Rangifer tarandus","Juniperus occidentalis", "Pinus strobus"))
## # A tibble: 2 × 4
##      tsn           target    commonNames    nameUsage
##    <chr>            <chr>          <chr>        <chr>
## 1  22503 Salix babylonica weeping willow not accepted
## 2 837788 Salix babylonica weeping willow     accepted

##                        Castor_canadensis Alces_alces
## Castor_canadensis                    0.0       197.8
## Alces_alces                        197.8         0.0
## Odocoileus_virginianus             197.8        37.0
## Rangifer_tarandus                  197.8        37.0
## Canis_lupus                        197.8       177.0
## Canis_latrans                      197.8       177.0
## Vulpes_vulpes                      197.8       177.0
##                        Odocoileus_virginianus Rangifer_tarandus
## Castor_canadensis                       197.8             197.8
## Alces_alces                              37.0              37.0
## Odocoileus_virginianus                    0.0              28.4
## Rangifer_tarandus                        28.4               0.0
## Canis_lupus                             177.0             177.0
## Canis_latrans                           177.0             177.0
## Vulpes_vulpes                           177.0             177.0
##                        Canis_lupus Canis_latrans Vulpes_vulpes
## Castor_canadensis            197.8         197.8         197.8
## Alces_alces                  177.0         177.0         177.0
## Odocoileus_virginianus       177.0         177.0         177.0
## Rangifer_tarandus            177.0         177.0         177.0
## Canis_lupus                    0.0           2.8          14.8
## Canis_latrans                  2.8           0.0          14.8
## Vulpes_vulpes                 14.8          14.8           0.0
##                        Pinus_strobus Juniperus_occidentalis Acer_rubrum
## Pinus_strobus                 0.0000               533.4320    704.4692
## Juniperus_occidentalis      533.4320                 0.0000    704.4692
## Acer_rubrum                 704.4692               704.4692      0.0000
## Acer_saccharum              704.4692               704.4692     20.0674
## Salix_babylonica            704.4696               704.4696    235.0698
## Betula_alleghaniensis       704.4696               704.4696    235.0698
##                        Acer_saccharum Salix_babylonica
## Pinus_strobus                704.4692         704.4696
## Juniperus_occidentalis       704.4692         704.4696
## Acer_rubrum                   20.0674         235.0698
## Acer_saccharum                 0.0000         235.0698
## Salix_babylonica             235.0698           0.0000
## Betula_alleghaniensis        235.0698         226.5180
##                        Betula_alleghaniensis
## Pinus_strobus                       704.4696
## Juniperus_occidentalis              704.4696
## Acer_rubrum                         235.0698
## Acer_saccharum                      235.0698
## Salix_babylonica                    226.5180
## Betula_alleghaniensis                 0.0000

Here, Salix babylonica have required an input to choose the good TSN number, if we omit it it is not include in the plot. As you can see the taxa have been sorted by reference trees; mammals and angiosperms. The distance matrices are also an output.

downto.tree

This function creates a phylogenetic tree from a taxon down to another one. For now, only the input species gives a result, but any higher taxon can be choosed.

downto.tree("Canidae", "species")

When running the code, this message would have appeared:

NOTE: 10 taxa not matched: canidae/canis/canis_anthus, canidae/canis/canis_lupaster, canidae/dusicyon/dusicyon_australis, canidae/lycalopex/lycalopex_culpaeus, canidae/lycalopex/lycalopex_fulvipes, canidae/lycalopex/lycalopex_gymnocercus, canidae/lycalopex/lycalopex_sechurae, canidae/lycalopex/lycalopex_vetulus, canidae/vulpes/vulpes_lagopus, canidae/vulpes/vulpes_macrotis, ];

For esthetic purposes we omitted all the messages of the function, but when creating the tree, certain inputs from functions included in downto.tree are not recognized in the reference supertrees.