drop.tips: Drop tips from objects with phylogenetic trees and...

View source: R/mis_covenient.methods.R

drop.tipsR Documentation

Drop tips from objects with phylogenetic trees and edgewise/nodewise data

Description

This is a generic that extends the drop.tip() function from ape to objects of class evorates and evorates_fit. Mostly intended for dropping "pseudo-tips" used for fossil calibrations, but could be helpful in a number of scenarios.

Usage

drop.tips(phy, tip, partial.match, entire.clade, invert, ...)

Arguments

phy

An object of class evorates, evorates_fit, or phylo.

tip

A numeric or character vector specifying which tips to drop from phy.

partial.match

TRUE or FALSE: if tip is a character vector, should it be partially matched to tip labels? For example, one could write a genus name to select all tips belonging to that genus. Defaults to FALSE to align with normal drop.tip behavior by default.

entire.clade

TRUE or FALSE: should all descendants of the most recent common ancestor of tips in tip be removed? Allows for easy exclusion of entire monophyletic clades. Defaults to FALSE to align with normal drop.tip behavior by default.

invert

TRUE or FALSE: should tip specify tips to keep, rather than to remove, as in keep.tip? Defaults to FALSE to align with normal drop.tip behavior by default.

...

Optional arguments. Notably, arguments from drop.tip can only be used with phylo objects. In the cases of evorates and evorates_fit, arguments from drop.tip are set to their defaults with the exception of collapse.singles, which is set to FALSE (though I hope to allow this option to be TRUE in the future). Other optional arguments in the case of evorates and evorates_fit objects include:

  • try.all.elements (for evorates objects only), which, if TRUE (the default), causes the function to assume any vector with the same number of elements as there are edges in the phylogeny corresponds to edgewise data and reshuffles indices accordingly. This will additionally sort the post.probs element present in most evorates objects coerced from evorates_fit objects, but may cause unpredictable results in cases when users manually customize an evorates objects.

  • store.traits, which, if TRUE (the default), causes the function to infer/store trait values for all nodes in phy. This is helpful because dropping tips will inevitably alter the inference of trait values–particularly ancestral state reconstructions–and this is probably undesirable in most cases.

  • recalc.bg (for evorates_fit objects only), which, if TRUE (defaults to FALSE), causes the function to recalculate the background rate ("bg_rate") parameter based on the new phylogenetic tree, which may be desirable in some cases.

  • recalc.devs (for evorates_fit objects only), which, if TRUE (defaults to FALSE), causes the function to recalculate rate deviations/posterior probabilities to determine which branchwise rates are "anomalously" fast or slow based on the new phylogenetic tree, which may be desirable in some cases. The arguments remove.trend and geometric may also be specified to further control of the (re)calculation of rate deviations (see get.bg.rate for details).

Value

An object of the same class as phy, with reordered phylogeny and edgewise/nodewise data.

See Also

drop.tip, get.bg.rate


bstaggmartin/backwards-BM-simulator documentation built on June 3, 2024, 5:51 p.m.