timeSliceTree: Time-Slicing a Phylogeny

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Removes the portion of a tree after a set point in time, as if the tree after that moment had been sliced away.

Usage

1
timeSliceTree(ttree, sliceTime, drop.extinct = FALSE, plot = TRUE)

Arguments

ttree

A time-scaled phylogeny of class phylo

sliceTime

Time to 'slice' the tree at. See details below.

drop.extinct

If true, drops tips that go extinct before timeSlice.

plot

If true, plots input and output trees for comparison.

Details

The function assumes that ttree will generally have an element called $root.time, which is the time before present that the root divergence occurred. If $root.time is not present as an element of ttree, then it is assumed the tip furthest from the root is at time 0 (present-day) and a new $root.time is calculated (a warning will be issued in this case).

The sliceTime is always calculated as on the same scale as ttree$root.time. In other words, if root.time=100, then timeSlice=80 will slice the tree 20 time units after the root.

If drop.extinct=T, then extinct tips are dropped and (if present) the $root.time of ttree is adjusted. This is done using the function dropExtinct.

Value

Returns the modified phylogeny as an object of class phylo.

Tip labels for cut branches which held multiple descendant tips will be the label for the earliest appearing tip descendant of that branch. This is somewhat arbitrary; the actual morphotaxon present at that time might have been a different taxon. For simulated datasets, use taxa2phylo.

Author(s)

David W. Bapst, with modification of code by Klaus Schliep to avoid use of function dist.nodes which has difficulty with large trees and greatly benefiting function runtime.

See Also

phyloDiv, dropExtinct, dropExtant

Also see the function treeSlice in the library phytools, which will slice a tree at some point in and return all the subtrees which remain after the slicing time. (Effectively the reverse of timeSliceTree.)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#a neat example of using phyloDiv with timeSliceTree 
   #to simulate doing extant-only phylogeny studies 
   #of diversification...in the past!
set.seed(444)
record<-simFossilRecord(p=0.1, q=0.1, nruns=1,
nTotalTaxa=c(30,40), nExtant=0)
taxa<-fossilRecord2fossilTaxa(record)
taxicDivCont(taxa)
#that's the whole diversity curve

#with timeSliceTree we could look at the lineage accumulation curve 
   #we'd get of species sampled at a point in time
tree <- taxa2phylo(taxa)
#use timeSliceTree to make tree of relationships up until time=950 
tree950 <- timeSliceTree(tree,sliceTime=950,plot=TRUE,drop.extinct=FALSE)

#use drop.extinct=T to only get the tree of lineages extant at time=950
tree950 <- timeSliceTree(tree,sliceTime=950,plot=FALSE,drop.extinct=TRUE)
#now its an ultrametric tree with many fewer tips...
#lets plot the lineage accumulation plot on a log scale
phyloDiv(tree950,plotLogRich=TRUE)


Search within the paleotree package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.