Learn R Programming

TreeSearch (version 0.2.2)

IWTreeSearch: Search for most parsimonious trees

Description

Run standard search algorithms (NNI, SPR or TBR) to search for a more parsimonious tree.

Usage

IWTreeSearch(tree, dataset, concavity = 4, EdgeSwapper = RootedTBR,
  maxIter = 100, maxHits = 20, forestSize = 1, verbosity = 1, ...)

EdgeListSearch(edgeList, dataset, TreeScorer = MorphyLength, EdgeSwapper = RootedTBRSwap, maxIter = 100, maxHits = 20, bestScore = NULL, stopAtScore = NULL, stopAtPeak = FALSE, stopAtPlateau = 0L, forestSize = 1L, cluster = NULL, verbosity = 1L, ...)

TreeSearch(tree, dataset, InitializeData = PhyDat2Morphy, CleanUpData = UnloadMorphy, TreeScorer = MorphyLength, EdgeSwapper = RootedTBRSwap, maxIter = 100L, maxHits = 20L, forestSize = 1L, stopAtPeak = FALSE, stopAtPlateau = 0L, verbosity = 1L, ...)

ProfileTreeSearch(tree, dataset, EdgeSwapper = RootedTBR, maxIter = 100, maxHits = 20, forestSize = 1, verbosity = 1, precision = 40000, ...)

Arguments

tree

a fully-resolved starting tree in phylo format, with the desired outgroup; edge lengths are not supported and will be deleted;

dataset

Data in format required by InitializeData.

concavity

A numeric value to use as the concavity constant (`k`) in implied weighting.

EdgeSwapper

a function that rearranges a parent and child vector, and returns a list with modified vectors; for example SPRSwap.

maxIter

the maximum number of iterations to perform before abandoning the search.

maxHits

the maximum times to hit the best pscore before abandoning the search.

forestSize

the maximum number of trees to return - useful in concert with consensus.

verbosity

Level of detail to display in console: larger numbers provide more verbose feedback to the user.

further arguments to pass to TreeScorer function (e.g. TipsAreColumns, dataset)

edgeList

a list containing the following: - vector of integers corresponding to the parent of each edge in turn - vector of integers corresponding to the child of each edge in turn - (optionally) score of the tree - (optionally, if score provided) number of times this score has been hit

TreeScorer

function to score a given tree. The function will be passed three parameters, corresponding to the `parent` and `child` entries of a tree's edge list, and a dataset.

stopAtPeak

Logical specifying whether to terminate search once a subsequent iteration recovers a sub-optimal score. Useful with methods that return all trees one rearrangement from the current tree, such as AllTBR. Will be overridden if a passed function has an attribute `stopAtPeak` set by `attr(FunctionName, 'stopAtPeak') <- TRUE`.

stopAtPlateau

Integer. If > 0, tree search will terminate if the score has not improved after `stopAtPlateau` iterations. Useful with methods that return all trees one rearrangement from the current tree, such as AllTBR. Will be overridden if a passed function has an attribute `stopAtPlateau` set by `attr(FunctionName, 'stopAtPlateau') <- TRUE`.

InitializeData

Function that sets up data object to prepare for tree search. The function will be passed the dataset parameter. Its return value will be passed to TreeScorer and CleanUpData.

CleanUpData

Function to destroy data object on function exit. The function will be passed the value returned by InitializeData.

dataset

A phylogenetic data matrix of class phyDat, whose names correspond to the labels of any accompanying tree.

Value

This function returns a tree, with an attribute pscore conveying its parsimony score. Note that the parsimony score will be inherited from the tree's attributes, which is only valid if it was generated using the same data that is passed here.

Functions

  • IWTreeSearch: Search using profile parsimony

  • EdgeListSearch: Tree Search from Edge lists

  • ProfileTreeSearch: Search using profile parsimony

See Also

  • Fitch, calculates parsimony score;

  • RootedNNI, conducts tree rearrangements;

  • Ratchet, alternative heuristic, useful to escape local optima.

Examples

Run this code
# NOT RUN {
data('Lobo')
njtree <- NJTree(Lobo.phy)

# }
# NOT RUN {
TreeSearch(njtree, Lobo.phy, maxIter=20, EdgeSwapper=NNISwap)
TreeSearch(njtree, Lobo.phy, maxIter=20, EdgeSwapper=RootedSPRSwap)
TreeSearch(njtree, Lobo.phy, maxIter=20, EdgeSwapper=TBRSwap)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab