Converting from and to paleotree format

knitr::opts_chunk$set(echo = TRUE)
library(FossilSim)
if(!require(paleotree)) knitr::opts_chunk$set(eval = FALSE)

Compatibility with paleotree

Objects produced by FossilSim contain all the information required by the paleotree format and vice-versa, thus these two packages are fully compatible.

Converting from paleotree is done using the paleotree.record.to.fossils function, which returns a list of the corresponding phylo, taxonomy and fossils objects.

record = paleotree::simFossilRecord(p = 0.1, q = 0.1, r = 0.1, nruns = 1, nTotalTaxa = c(30,40),
                                    nExtant = 0, nSamp = c(5,25))

converted_record = paleotree.record.to.fossils(record = record)
converted_record

If the paleotree record is fully extinct, i.e contains no extant samples, the age of the record will be encoded in the field origin.time of the tree.

converted_record$tree$origin.time

Similarly, converting from the FossilSim objects to paleotree format is done using the fossils.to.paleotree.record function, which requires a fossils object and either a phylo or taxonomy object. If no taxonomy is provided, all speciation events in the tree will be assumed to be symmetric (bifurcating).

t = ape::rtree(6)
f = sim.fossils.poisson(rate = 2, tree = t)

converted_record = fossils.to.paleotree.record(fossils = f, tree = t)
converted_record


Try the FossilSim package in your browser

Any scripts or data that you put into this service are public.

FossilSim documentation built on Oct. 5, 2023, 5:08 p.m.