clade.matrix: Create a clade matrix from a phylogeny

Description Usage Arguments Details Value Author(s) Examples

Description

Takes a phylogeny in the 'ape' package format and converts it into a binary matrix showing which tips (matrix columns) subtend from each node in the phylogeny (matrix rows). This is a useful format for quickly calculating branch length information for subsets of the phylogeny.

Usage

1

Arguments

phy

A object of class 'phylo'

Details

The clade matrix shows the tips from a phylogeny that subtend from each internal and external node. Each tip is represented as column showing the nodes of which it is a member and hence each row shows the tips that are members of a given node. Dropping columns gives a quick and easy way to find out which edges are retained in a particular subset of the tree and this structure is used for quickly calculating branch lengths calculations or clade statistics.

Value

A list of class 'clade.matrix' containing the following components:

clade.matrix

A binary m x n matrix, where m is the total number of nodes in the phylogeny and n is the number of tips. An element is 1 if tip $n_i$ subtends from a node $m_j$.

edge.length

A numeric vector of length m showing the edge length leading to each node in the phylogeny and named with the node number.

tip.label

A character vector of length n giving the labels assigned to the tips of the phylogeny.

edge

The edge matrix from the original phylogeny.

Author(s)

David Orme

Examples

1
2

Example output

Loading required package: ape
Loading required package: MASS
Loading required package: mvtnorm
$clade.matrix
     tips
edges 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
   1  1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0
   2  0 1 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0
   3  0 0 1 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0
   4  0 0 0 1 0 0 0 0 0  0  0  0  0  0  0  0  0  0
   5  0 0 0 0 1 0 0 0 0  0  0  0  0  0  0  0  0  0
   6  0 0 0 0 0 1 0 0 0  0  0  0  0  0  0  0  0  0
   7  0 0 0 0 0 0 1 0 0  0  0  0  0  0  0  0  0  0
   8  0 0 0 0 0 0 0 1 0  0  0  0  0  0  0  0  0  0
   9  0 0 0 0 0 0 0 0 1  0  0  0  0  0  0  0  0  0
   10 0 0 0 0 0 0 0 0 0  1  0  0  0  0  0  0  0  0
   11 0 0 0 0 0 0 0 0 0  0  1  0  0  0  0  0  0  0
   12 0 0 0 0 0 0 0 0 0  0  0  1  0  0  0  0  0  0
   13 0 0 0 0 0 0 0 0 0  0  0  0  1  0  0  0  0  0
   14 0 0 0 0 0 0 0 0 0  0  0  0  0  1  0  0  0  0
   15 0 0 0 0 0 0 0 0 0  0  0  0  0  0  1  0  0  0
   16 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  1  0  0
   17 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  1  0
   18 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  1
   19 1 1 1 1 1 1 1 1 1  1  1  1  1  1  1  1  1  1
   20 1 1 1 1 1 1 1 1 1  0  0  0  0  0  0  0  0  0
   21 1 1 1 1 1 0 0 0 0  0  0  0  0  0  0  0  0  0
   22 1 1 1 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0
   23 0 1 1 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0
   24 0 0 0 1 1 0 0 0 0  0  0  0  0  0  0  0  0  0
   25 0 0 0 0 0 1 1 1 1  0  0  0  0  0  0  0  0  0
   26 0 0 0 0 0 1 1 0 0  0  0  0  0  0  0  0  0  0
   27 0 0 0 0 0 0 0 0 0  1  1  1  1  1  1  1  1  1
   28 0 0 0 0 0 0 0 0 0  1  1  1  1  1  0  0  0  0
   29 0 0 0 0 0 0 0 0 0  1  1  0  0  0  0  0  0  0
   30 0 0 0 0 0 0 0 0 0  0  0  1  1  1  0  0  0  0
   31 0 0 0 0 0 0 0 0 0  0  0  1  1  0  0  0  0  0
   32 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  1  1  1
   33 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  1  1

$tip.label
 [1] "Dicerorhinus sumatrensis" "Rhinoceros sondaicus"    
 [3] "Rhinoceros unicornis"     "Diceros bicornis"        
 [5] "Ceratotherium simum"      "Tapirus terrestris"      
 [7] "Tapirus pinchaque"        "Tapirus bairdii"         
 [9] "Tapirus indicus"          "Equus grevyi"            
[11] "Equus burchelli"          "Equus quagga"            
[13] "Equus ferus"              "Equus zebra"             
[15] "Equus africanus"          "Equus hemionus"          
[17] "Equus kiang"              "Equus onager"            

$edge
      [,1] [,2]
 [1,]   19   20
 [2,]   20   21
 [3,]   21   22
 [4,]   22    1
 [5,]   22   23
 [6,]   23    2
 [7,]   23    3
 [8,]   21   24
 [9,]   24    4
[10,]   24    5
[11,]   20   25
[12,]   25   26
[13,]   26    6
[14,]   26    7
[15,]   25    8
[16,]   25    9
[17,]   19   27
[18,]   27   28
[19,]   28   29
[20,]   29   10
[21,]   29   11
[22,]   28   30
[23,]   30   31
[24,]   31   12
[25,]   31   13
[26,]   30   14
[27,]   27   15
[28,]   27   32
[29,]   32   16
[30,]   32   33
[31,]   33   17
[32,]   33   18

$edge.length
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
 2  1  1  1  1  1  1  3  3  1  1  1  1  2  8  2  1  1  0  9  4  2  1  3  5  2 
27 28 29 30 31 32 33 
 9  4  3  2  1  6  1 

attr(,"class")
[1] "clade.matrix"

caper documentation built on May 2, 2019, 4:49 p.m.