Learn R Programming

TreeSearch (version 0.1.2)

Ratchet: Parsimony Ratchet

Description

Ratchet uses the parsimony ratchet (Nixon 1999) to search for a more parsimonious tree.

Usage

Ratchet(tree, dataset, InitializeData = PhyDat2Morphy,
  CleanUpData = UnloadMorphy, TreeScorer = MorphyLength,
  Bootstrapper = MorphyBootstrap, swappers = list(TBRSwap, SPRSwap,
  NNISwap), BootstrapSwapper = if (class(swappers) == "list")
  swappers[[length(swappers)]] else swappers, returnAll = FALSE,
  stopAtScore = NULL, ratchIter = 100, ratchHits = 10,
  searchIter = 4000, searchHits = 42, bootstrapIter = searchIter,
  bootstrapHits = searchHits, verbosity = 1L, suboptimal = 1e-08, ...)

ProfileRatchet(tree, dataset, swappers = list(TBRSwap, SPRSwap, NNISwap), BootstrapSwapper = if (class(swappers) == "list") swappers[[length(swappers)]] else swappers, returnAll = FALSE, stopAtScore = NULL, ratchIter = 100, ratchHits = 10, searchIter = 2000, searchHits = 40, bootstrapIter = searchIter, bootstrapHits = searchHits, verbosity = 1L, suboptimal = 1e-08, ...)

IWRatchet(tree, dataset, concavity = 4, swappers = list(TBRSwap, SPRSwap, NNISwap), BootstrapSwapper = if (class(swappers) == "list") swappers[[length(swappers)]] else swappers, returnAll = FALSE, stopAtScore = NULL, ratchIter = 100, ratchHits = 10, searchIter = 2000, searchHits = 40, bootstrapIter = searchIter, bootstrapHits = searchHits, verbosity = 1L, suboptimal = 1e-08, ...)

RatchetConsensus(tree, dataset, ratchHits = 10, searchIter = 500, searchHits = 20, verbosity = 0L, swappers = list(RootedNNISwap), nSearch = 10, stopAtScore = NULL, ...)

IWRatchetConsensus(tree, dataset, ratchHits = 10, concavity = 4, searchIter = 500, searchHits = 20, verbosity = 0L, swappers = list(RootedNNISwap), nSearch = 10, suboptimal = suboptimal, stopAtScore = NULL, ...)

Arguments

tree

A tree of class phylo.

dataset

a dataset in the format required by TreeScorer.

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.

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.

Bootstrapper

Function to perform bootstrapped rearrangements of tree. First arguments will be an edgeList and a dataset, initialized using InitializeData Should return a rearranged edgeList.

swappers

A list of functions to use to conduct edge rearrangement during tree search. Provide functions like NNISwap to shuffle root position, or RootedTBRSwap if the position of the root should be retained. You may wish to use extreme swappers (such as TBR) early in the list, and a more subtle rearranger (such as NNI) later in the list to make incremental tinkerings once an almost-optimal tree has been found.

BootstrapSwapper

Function such as RootedNNISwap to use to rearrange trees within Bootstrapper.

returnAll

Set to TRUE to report all MPTs encountered during the search, perhaps to analyze consensus.

stopAtScore

stop search as soon as this score is hit or beaten.

ratchIter

stop when this many ratchet iterations have been performed.

ratchHits

stop when this many ratchet iterations have found the same best score.

searchIter

maximum rearrangements to perform on each bootstrap or ratchet iteration.

searchHits

maximum times to hit best score before terminating a tree search within a ratchet iteration.

bootstrapIter

maximum rearrangements to perform on each bootstrap iteration (default: searchIter).

bootstrapHits

maximum times to hit best score on each bootstrap iteration (default: searchHits).

verbosity

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

suboptimal

retain trees that are suboptimal by this score. Defaults to 1e-08 to counter rounding errors.

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

concavity

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

nSearch

Number of Ratchet searches to conduct (for RatchetConsensus)

Value

This function returns a tree modified by parsimony ratchet iterations.

Functions

  • ProfileRatchet: Shortcut for Ratchet search under Profile Parsimony

  • IWRatchet: Shortcut for Ratchet search using implied weights

  • RatchetConsensus: returns a list of optimal trees produced by nSearch Ratchet searches

  • IWRatchetConsensus: returns a list of optimal trees produced by nSearch Ratchet searches, using implied weighting

References

Nixon1999TreeSearch

See Also

TreeSearch

Adapted from pratchet in the phangorn package.

Examples

Run this code
# NOT RUN {
data('Lobo')
njtree <- NJTree(Lobo.phy)
# Increase value of ratchIter and searchHits to do a proper search
quickResult <- Ratchet(njtree, Lobo.phy, ratchIter=2, searchHits=3)
plot(quickResult)
# IW search is currently much slower:
quickIWResult <- IWRatchet(quickResult, Lobo.phy, concavity=2.5,
                           ratchIter=1, searchIter = 25, searchHits=2,
                           swappers=RootedTBRSwap, verbosity=5)
 
# }

Run the code above in your browser using DataLab