Learn R Programming

paleotree (version 2.5)

taxonTable2taxonTree: Create a Taxonomy-Based Phylogeny ('Taxon Tree') from a Hierarchical Table of Taxonomy Memberships

Description

This function takes a matrix of taxon names, indicating a set of hierarchical taxonomic relationships conveyed as nested placements for a set of tip-taxa (listed in the last column of the matrix) and returns a 'taxonomy-tree' phylogeny object of class 'phylo'.

Usage

taxonTable2taxonTree(taxonTable, cleanTree = TRUE)

Arguments

taxonTable
A matrix of type character and multiple rows and columns, containing the tip taxa in the last column, one per row, with progressively larger taxa listed in prior columns (reading left-to-right). Invariant columns (i.e. taxa that all tip taxa are in) ar
cleanTree
By default, the tree is run through a series of post-processing, including having singles collapsed, nodes reordered and being written out as a Newick string and read back in, to ensure functionality with ape functions and ape-derived functions. If FALS

Value

  • A phylogeny of class 'phylo', where each tip is a taxon listed in the last column of the input taxonTable. Edges are scaled so that the distance from one taxon rank to another 1, then merged to remove singleton nodes. As not all taxa have parents at the immediate taxon level above, this leads to some odd cases. For example, two genera emanating from a node representing a class but with a very short (length=1) branch and a long branch (length=3) means one genus is simply placed in the class, with no family or order listed while the one on the long branch is within an order and family that is otherwise monogeneric. The names of higher taxa than the tips should be appended as the element $node.label for the internal nodes.

Details

This function can deal with empty entries in cells of taxonTable by assuming these are lower-level taxa which are 'floating' freely somewhere in taxa several levels higher.

See Also

makePBDBtaxonTree, parentChild2taxonTree

Examples

Run this code
#let's create a small, really cheesy example
pokeTable<-rbind(cbind("Pokezooa","Shelloidea","Squirtadae",
		c("Squirtle","Blastoise","Wartortle")),
	c("Pokezooa","Shelloidea","","Lapras"),
	c("Pokezooa","","","Parasect"),
	cbind("Pokezooa","Hirsutamona","Rodentapokemorpha",
		c("Linoone","Sandshrew","Pikachu")),
	c("Pokezooa","Hirsutamona",NA,"Ursaring"))

pokeTree<-taxonTable2taxonTree(pokeTable)
plot(pokeTree);nodelabels(pokeTree$node.label)

Run the code above in your browser using DataLab