Package pal.treesearch
Class FreeBranch
- java.lang.Object
-
- pal.treesearch.FreeBranch
-
- All Implemented Interfaces:
GeneralOptimisable
,RootAccess
public final class FreeBranch extends java.lang.Object implements RootAccess, GeneralOptimisable
-
-
Constructor Summary
Constructors Constructor Description FreeBranch(Node n, FreeNode parent, GeneralConstructionTool tool, GeneralConstraintGroupManager.Store store)
Continuing recurison constructor for a given treeFreeBranch(Node n, GeneralConstructionTool tool, GeneralConstraintGroupManager.Store store)
The starting constructor for building from a given treeFreeBranch(FreeNode left, FreeNode right, double branchLength, GeneralConstructionTool tool)
A generic constructor given two already defined left and right children
-
Method Summary
-
-
-
Constructor Detail
-
FreeBranch
public FreeBranch(Node n, GeneralConstructionTool tool, GeneralConstraintGroupManager.Store store)
The starting constructor for building from a given tree- Parameters:
n
- The normal PAL node structure to base this tree ontool
- to aid in construction
-
FreeBranch
public FreeBranch(Node n, FreeNode parent, GeneralConstructionTool tool, GeneralConstraintGroupManager.Store store)
Continuing recurison constructor for a given tree- Parameters:
n
- The PAL node structure to base sub tree onparent
- The parent node (sub tree in other direction)tool
- to aid in construction
-
FreeBranch
public FreeBranch(FreeNode left, FreeNode right, double branchLength, GeneralConstructionTool tool)
A generic constructor given two already defined left and right children- Parameters:
left
- The left noderight
- The right nodebranchLength
- The length of connectiontool
- to aid in construction
-
-
Method Detail
-
setAnnotation
public void setAnnotation(java.lang.Object annotation)
-
getLeft
public final FreeNode getLeft()
- Returns:
- The "right" node of this connection.
-
getRight
public final FreeNode getRight()
- Returns:
- The "left" node of this connection.
-
mark
public final void mark()
Mark this node, or in other words store information on left and right nodes and branch length for later retreival (via undoToMark())
-
getLeftPatternInfo
public final PatternInfo getLeftPatternInfo(GeneralConstructionTool tool)
- Returns:
- The pattern info object for the left node leading to this connection
-
getRightPatternInfo
public final PatternInfo getRightPatternInfo(GeneralConstructionTool tool)
- Returns:
- The pattern info object for the right node leading to this connection
-
getPatternInfo
public final PatternInfo getPatternInfo(GeneralConstructionTool tool, FreeNode caller)
-
getCenterPatternInfo
public final PatternInfo getCenterPatternInfo(GeneralConstructionTool tool)
- Returns:
- The pattern info across this connection (for use if this connection is the "root" of the likelihood calculation)
-
undoToMark
public final void undoToMark()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hasConnection
public boolean hasConnection(FreeBranch c, FreeNode caller)
-
getLeftLeftBranch
public FreeBranch getLeftLeftBranch()
- Returns:
- the "left" connection of the left node
-
getLeftRightBranch
public FreeBranch getLeftRightBranch()
- Returns:
- the "right" connection of the left node
-
getRightLeftBranch
public FreeBranch getRightLeftBranch()
- Returns:
- the "left" connection of the right node
-
getRightRightBranch
public FreeBranch getRightRightBranch()
- Returns:
- the "right" connection of the left node
-
attachTo
public FreeBranch attachTo(FreeBranch attachmentPoint, FreeBranch[] store)
- Returns:
- connection that by attaching to we would undo this operation, null if operation no successful
-
buildPALNodeBase
public Node buildPALNodeBase()
- Specified by:
buildPALNodeBase
in interfaceRootAccess
-
buildPALNodeES
public Node buildPALNodeES()
- Specified by:
buildPALNodeES
in interfaceRootAccess
-
getLeftFlatConditionalProbabilities
public final ConditionalProbabilityStore getLeftFlatConditionalProbabilities(GeneralConstructionTool tool)
-
getRightFlatConditionalProbabilities
public final ConditionalProbabilityStore getRightFlatConditionalProbabilities(GeneralConstructionTool tool)
-
getBranchLength
public final double getBranchLength()
-
setBranchLength
public final void setBranchLength(double x)
-
toString
public java.lang.String toString(FreeNode caller)
-
testLikelihood
public void testLikelihood(GeneralConstructionTool tool)
- Specified by:
testLikelihood
in interfaceRootAccess
-
testLikelihood
public void testLikelihood(FreeNode caller, GeneralConstructionTool tool)
-
getExtendedConditionalProbabilities
public ConditionalProbabilityStore getExtendedConditionalProbabilities(FreeNode caller, GeneralConstructionTool tool)
-
getExtendedConditionalProbabilities
public ConditionalProbabilityStore getExtendedConditionalProbabilities(FreeNode caller, UnconstrainedLikelihoodModel.External externalCalculator, ConditionalProbabilityStore extendedStore, GeneralConstructionTool tool)
-
getNumberOfOptimisationTypes
public final int getNumberOfOptimisationTypes()
- Specified by:
getNumberOfOptimisationTypes
in interfaceGeneralOptimisable
-
optimise
public double optimise(int optimisationType, UnivariateMinimum minimiser, GeneralConstructionTool tool, int fracDigits)
- Specified by:
optimise
in interfaceGeneralOptimisable
minimiser
- The single dimensional minimisation tooltool
- The construction toolfracDigits
- the number of fractional digits to converge to- Returns:
- The optimised log likelihood, or >0 if not optimisation occured
-
getAllComponents
public void getAllComponents(java.util.ArrayList store, java.lang.Class componentType)
- Specified by:
getAllComponents
in interfaceRootAccess
-
getAllComponents
public void getAllComponents(java.util.ArrayList store, java.lang.Class componentType, FreeNode caller)
-
getCenterPatternInfo
public void getCenterPatternInfo(GeneralConstructionTool tool, PatternInfo store)
-
doNNI
public final void doNNI(MersenneTwisterFast r)
-
doNNI
public boolean doNNI(boolean leftSwapLeft, boolean rightSwapLeft)
Does not reconstruct patterns
-
calculateLogLikelihood
public double calculateLogLikelihood(GeneralConstructionTool tool)
- Specified by:
calculateLogLikelihood
in interfaceRootAccess
-
calculateLogLikelihood2
public double calculateLogLikelihood2(GeneralConstructionTool tool)
-
calculateSiteDetails
public SiteDetails calculateSiteDetails(UnconstrainedLikelihoodModel.External calculator, GeneralConstructionTool tool)
-
-