Ratchet
uses the parsimony ratchet (Nixon 1999) to search for a more parsimonious tree.
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, ...)
A tree of class phylo
.
a dataset in the format required by TreeScorer.
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.
Function to destroy data object on function exit. The function will be passed the value returned by InitializeData.
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.
Function to perform bootstrapped rearrangements of tree.
First arguments will be an edgeList and a dataset, initialized using InitializeData
Should return a rearranged edgeList.
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.
Function such as RootedNNISwap
to use to rearrange trees
within Bootstrapper
.
Set to TRUE
to report all MPTs encountered during the search, perhaps to analyze consensus.
stop search as soon as this score is hit or beaten.
stop when this many ratchet iterations have been performed.
stop when this many ratchet iterations have found the same best score.
maximum rearrangements to perform on each bootstrap or ratchet iteration.
maximum times to hit best score before terminating a tree search within a ratchet iteration.
maximum rearrangements to perform on each bootstrap iteration (default: searchIter
).
maximum times to hit best score on each bootstrap iteration (default: searchHits
).
Level of detail to display in console: larger numbers provide more verbose feedback to the user.
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
)
A numeric value to use as the concavity constant (`k`) in implied weighting.
Number of Ratchet searches to conduct (for RatchetConsensus)
This function returns a tree modified by parsimony ratchet iterations.
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
Nixon1999TreeSearch
Adapted from pratchet
in the phangorn package.
# 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