LineageHomology_v2: LineageHomology_v2

View source: R/LineageHomology.R

LineageHomology_v2R Documentation

LineageHomology_v2

Description

LineageHomology_v2 is faster version of LineageHomology. LineageHomology counts transmission lineages according to state transitions between ancestral and descendant nodes that have a probability higher than 50 percent. LineageHomolog_w_uncertainty instead samples states from the posterior probability of states (that is usually included in a phylogeographical consensus tree) for each node. Thus, the transmission lineage division is probabilistic and retains the uncertainty in the posterior distribution if the function is run multiple times, e.g., using base::replicate().

Usage

LineageHomology_v2(tree, ace_nodes, ace_tips, give_tips = NA, start_time = NA)

Arguments

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.

Value

A list with the following components:

Lineage_sizes

A vector containing the number of tips that belong to each transmission lineage.

Import_Export_LocalTransmission

A list containing the estimated number of importation, local transmission and export events.

Import_times

A vector containing the times at the middle of the ancestral edge of the TLs.

Exports_from_TL

A vector containing the number of exports from each transmission lineage.

Exports_times_from_TL

A list of vectors containing the times of exports from each transmission lineage.

Genome_identifiers_in_TLs

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.

TMRCA

A vector containing the time of the most recent common ancestor of each transmission lineage.

lineage_state

A vector containing the state each transmission lineage belongs to. The states are treated as numbers in the analyses, so the relative ordering has to be looked up.

lineage_nodes

A list of lists where each sub list contains the node IDs of the nodes that belong to each transmission lineage. The order is the same as the listed order of the Lineage_sizes.

unobserved_tl_nodes

A list containing the node IDs of the unobserved transmission lineages.

unobserved_tl_states

A vector containing the state of each unobserved transmission lineage.

unobserved_tl_halfedge_above_mrca

A vector containing the time points on the middle of the edges ancestral to each unobserved transmission lineage's MRCA. Used in analyses of importation and local transmission.

Examples

## Not run: 
multi_counts = pbreplicate(
  100,
  LineageHomology::LineageHomology_w_uncertainty_v2(
    tree,
    ace_nodes = test$lik.anc,
    give_tips = Norwegian_tips,
    ace_tips = to.matrix(Locations, seq = c("Norway", "RoW")),
    start_time = start_date
  )
)

## End(Not run)


magnusnosnes/GeoLineages documentation built on April 17, 2025, 6:29 p.m.