View source: R/LineageHomology.R
LineageHomology | R Documentation |
LineageHomology takes the output of an ancestral state reconstruction method with included state probabilities at each node and counts transmission lineages (TLs). A transmission lineage is defined as a connected group of tips where state transitions between ancestral and descendant nodes that have a probability lower than 50 percent. The function also counts the number of tips that are not connected to any other tips in this way (singletons). The method is analogous to that introduced by du Plessis et al. (2021) (DOI: 10.1126/science.abf2946). The input format should match the return format from the ape::ace function (see the help files at ?ape::ace). The outputs contain descriptions of the size of TLs, singletons, and other useful summaries. See the full tutorial including visualization methods at: https://github.com/magnusnosnes/LineageHomology.
LineageHomology(tree, ace_nodes, ace_tips, give_tips = NA, start_time = NA)
tree |
Phylogenetic tree |
ace_nodes |
Node probabilities in ace format. |
ace_tips |
Tip probabilities in ace format |
give_tips |
Constrain the computations to a set of tips, e.g. all the names of the tips in a certain state (e.g. one specific geographical location). |
start_time |
Date of root in the phylogeny. |
Import_LocalTrans The first entry can be thought of as an estimate of the number of tips that have acquired their state through novel acquisition (a transition in the phylogeny). Similarly, the second number describes the number of tips that have inherited their state by inheritance (homology). Since each transmission lineage started is defined by a state transition, each transmission lineage of size n is composed of 1 novel acquisition and n-1 homologous acquisitions. Singletons are directly translated to novel acquisitions.
Lineage_sizes contains the number of tips that belong to each TL. This means that all the internal nodes will be mapped to the same state with 50 percent or higher probability for the entire TL.
Taxa_names is a list of lists where each sub list contains the names of the tips in each transmission lineage. The order is the same as the listed order of the Lineage_sizes.
MRCA’s contains the time of the most recent common ancestor of the groups.
Halfedge_over_tmrca is the time point on the middle of the edge that is ancestral to each TL's mrca. This is used in analyses of importation and local transmission.
Lineage_state contains the state the transmission lineages belong to, the states are treated as numbers in the analyses, so the relative ordering has to be looked up.
## Not run:
set.seed(400)
library(BactDating)
tree_test = simdatedtree(nsam=300, dateroot=2000) #300 taxa and date of the root at year 2000.
tree_test = ladderize(tree_test) #Reorder the tree to make it look nice
fit1 = ace(x=trait, phy= tree_test, type="discrete", mod="ARD") #Estimate the ancestral history
LineageHomology(tree_test, ace_nodes=fit1$lik.anc,
ace_tips = to.matrix(loc, seq=c("Norway", "RoW")), start_time=2000)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.