Many phylogenetic inference software packages, such as BEAST2 and RevBayes, can handle trees containing fossil samples. In the zero-edge format, tip samples are represented normally in the tree, but sampled ancestors, i.e fossil samples which have sampled descendants, are represented as tips at the end of edges with length 0.
This format is included in FossilSim
as the
SAtree
objects.
SAtree
objects can be built from a fossils
object and the associated tree. Tips (both extinct and extant) will be
labelled with the species they were sampled from followed by an index:
the oldest sample for a given species will get index 1 and all other
samples will be ordered from oldest to youngest. The SAtree
format also includes a field complete
which indicates
whether the tree should be considered as including all lineages of the
process or only sampled lineages. Note that if the tree is complete, the
youngest tip of a given extinct species represents the extinction event
for this species and not a fossil sample.
t = ape::rtree(6)
f = sim.fossils.poisson(rate = 2, tree = t)
SAt = SAtree.from.fossils(tree = t, fossils = f)
print(SAt$tree)
##
## Phylogenetic tree with 16 tips and 15 internal nodes.
##
## Tip labels:
## t5_4, t2_4, t3_2, t4_2, t1_1, t6_2, ...
##
## Rooted; includes branch lengths.
## sp edge hmin hmax h tip.label
## 3 1 1 2.6971593 2.6971593 2.6971593 t5_1
## 1 1 1 1.9321964 1.9321964 1.9321964 t5_2
## 2 1 1 1.7465526 1.7465526 1.7465526 t5_3
## 6 2 2 2.6804124 2.6804124 2.6804124 t2_1
## 5 2 2 2.4219198 2.4219198 2.4219198 t2_2
## 4 2 2 2.3758187 2.3758187 2.3758187 t2_3
## 7 3 3 1.5260146 1.5260146 1.5260146 t3_1
## 8 4 4 1.6298610 1.6298610 1.6298610 t4_1
## 9 6 6 0.6084066 0.6084066 0.6084066 t6_1
## 10 11 11 1.0188497 1.0188497 1.0188497 t11_1
## Fossil record with 10 occurrences representing 6 species
## Fossil record not simulated using taxonomy: all speciation events are assumed to be symmetric
## [1] TRUE
Other functions are present in FossilSim
to modify
trees. prune.fossils
will remove all intermediate fossil
samples and keep only the first and last occurrences of any species.
sampled.tree.from.combined
removes all unsampled
lineages from the tree, and can optionally apply a sampling probability
to extant samples, or keep only a specified list of extant samples.
These two functions can be applied to any object of type
phylo
, but are designed to work on trees which include
fossil samples.