Package pal.tree
Class TreeManipulator
java.lang.Object
pal.tree.TreeManipulator
- All Implemented Interfaces:
RootedTreeInterface.Instructee
,UnrootedTreeInterface.Instructee
public class TreeManipulator
extends Object
implements UnrootedTreeInterface.Instructee, RootedTreeInterface.Instructee
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
The branch access objects allow specific operations on a particular branch (refered to as connections internally to confuse and bewilder)static final class
static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Construct tree, but convert general multifications to a series of bificationsstatic final int
Construct tree with same multification as originalstatic final int
Construct tree, but convert bificating nodes that appear as multifications (due to very short branchlengths) to multifications -
Constructor Summary
ConstructorsConstructorDescriptionTreeManipulator
(Node base) Units will be Units.UNKNOWNTreeManipulator
(Node base, int units) Construct a TreeManipulator based around a normal treeTreeManipulator
(Node base, int units, int constructionMode) Construct a TreeManipulator based around a normal treeTreeManipulator
(RootedTreeInterface.Instructee base, int units, int constructionMode) TreeManipulator
(Tree base) Construct a TreeManipulator based around a normal treeTreeManipulator
(Tree base, int constructionMode) Construct a TreeManipulator based around a normal treeTreeManipulator
(UnrootedTreeInterface.Instructee base, int units, int constructionMode) -
Method Summary
Modifier and TypeMethodDescriptionNode[]
getAllRootedBy
(String[] outgroupNames) static final Tree[]
getAllRootingsBy
(Tree base, String[] outgroupNames) Roots a tree by an outgroupTree[]
getAllTreesRootedBy
(String[] outgroupNames) A method for recovering the input (construction) tree (with the EXPANSION/MIMIC/REDUCED differences)A method for recovering the input (construction) tree (with the EXPANSION/MIMIC/REDUCED differences)Obtain access to individual branchesTree[]
static final Tree[]
getEveryRoot
(Tree base) Obtains every rooting of a base treestatic final TreeIterator
getEveryRootIterator
(Tree base) Obtains every rooting of a base treestatic final Tree
getMidpointRooted
(Tree base) Returns the mid point rooting of a tree.getRootedAbove
(Node base) getRootedBy
(String[] outgroupNames) getRootedBy
(String[] outgroupNames, double ingroupBranchLength) static final Tree
getRootedBy
(Tree base, String[] outgroupNames) Roots a tree by an outgroupstatic final Tree
getRootedBy
(Tree base, String[] outgroupNames, double ingroupBranchLength) Roots a tree by an outgroupgetTreeRootedBy
(String[] outgroupNames) getTreeRootedBy
(String[] outgroupNames, double ingroupBranchLength) return unrooted nodestatic final Tree
getUnrooted
(Tree base) Unroots a treereturn unrooted nodevoid
instruct
(RootedTreeInterface treeInterface) void
instruct
(UnrootedTreeInterface treeInterface) void
instructRootedBy
(RootedTreeInterface rootedInterface, String[] outgroupNames)
-
Field Details
-
MIMIC_CONSTRUCTION
public static final int MIMIC_CONSTRUCTIONConstruct tree with same multification as original- See Also:
-
EXPAND_CONSTRUCTION
public static final int EXPAND_CONSTRUCTIONConstruct tree, but convert general multifications to a series of bifications- See Also:
-
REDUCE_CONSTRUCTION
public static final int REDUCE_CONSTRUCTIONConstruct tree, but convert bificating nodes that appear as multifications (due to very short branchlengths) to multifications- See Also:
-
-
Constructor Details
-
TreeManipulator
Construct a TreeManipulator based around a normal tree- Parameters:
base
- The base tree, which can be rooted or unrooted (will be treated as unrooted either way)constructionMode
- the way in which the internal tree representation is constructed
-
TreeManipulator
Construct a TreeManipulator based around a normal tree- Parameters:
base
- The base tree, which can be rooted or unrooted (will be treated as unrooted either way)
-
TreeManipulator
Units will be Units.UNKNOWN -
TreeManipulator
Construct a TreeManipulator based around a normal tree- Parameters:
base
- The base tree, which can be rooted or unrooted (will be treated as unrooted either way)units
- , the units of generated trees. Not really of concern if only Node trees built
-
TreeManipulator
Construct a TreeManipulator based around a normal tree- Parameters:
base
- The base tree, which can be rooted or unrooted (will be treated as unrooted either way)units
- , the units of generated trees. Not really of concern if only Node trees built
-
TreeManipulator
-
TreeManipulator
-
-
Method Details
-
getMidPointRooted
- Returns:
- the MidPoint rooted tree (as root node);
-
getDefaultRoot
- Returns:
- a tree rooted around the node it was originally rooted around (if originally rooted),
-
getAsInputRooting
A method for recovering the input (construction) tree (with the EXPANSION/MIMIC/REDUCED differences)- Returns:
- An unrooted tree if the input tree was unrooted, otherwise the default rooting
-
getAsInputRootingTree
A method for recovering the input (construction) tree (with the EXPANSION/MIMIC/REDUCED differences)- Returns:
- An unrooted tree if the input tree was unrooted, otherwise the default rooting
-
getDefaultRootTree
- Returns:
- a tree rooted around the node it was originally rooted around (if originally rooted),
-
getMidPointRootedTree
- Returns:
- the MidPoint rooted tree
-
getUnrooted
return unrooted node -
getUnrootedTree
return unrooted node -
getRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroup- Returns:
- the tree rooted by an outgroup defined by the mrca of a set of nodes
-
instructRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroup
-
getRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroupingroupBranchLength
- the maximum length of the branch leading to the ingroup clade- Returns:
- the tree rooted by an outgroup defined by the mrca of a set of nodes
-
getAllRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroup- Returns:
- all the trees rooted by an outgroup defined by the mrca of a set of nodes
-
getTreeRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroup- Returns:
- the tree rooted by an outgroup defined by the mrca of a set of nodes
-
getTreeRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroupingroupBranchLength
- the maximum length of the branch leading to the ingroup clade- Returns:
- the tree rooted by an outgroup defined by the mrca of a set of nodes
-
getAllTreesRootedBy
- Parameters:
outgroupNames
- the names of the members of the outgroup- Returns:
- all the possible rootings defined by the outgroup
-
getEveryRootIterator
- Returns:
- a tree iterator that returns each and every possible root of the base tree (as a new tree object each time)
-
instruct
- Specified by:
instruct
in interfaceUnrootedTreeInterface.Instructee
-
instruct
- Specified by:
instruct
in interfaceRootedTreeInterface.Instructee
-
getBranchAccess
Obtain access to individual branches- Returns:
- an array of branch access objects
-
getEveryRoot
- Returns:
- each and every possible root of the base tree
-
getRootedAbove
- Parameters:
Node
- n, a node from the original base tree that this TreeManipulator was constructed on
-
getTreeRootedAbove
- Parameters:
Node
- n, a node from the original base tree that this TreeManipulator was constructed on
-
getUnrooted
Unroots a tree- Parameters:
base
- The input tree that may or may not be unrooted- Returns:
- an unrooted tree (has a trification at base)
-
getMidpointRooted
Returns the mid point rooting of a tree. This is the rooting that divides the data between the two most distinct taxa- Parameters:
base
- The input tree that may or may not be unrooted- Returns:
- an unrooted tree (has a trification at base)
-
getEveryRoot
Obtains every rooting of a base tree- Parameters:
base
- The input tree that may or may not be unrooted
-
getEveryRootIterator
Obtains every rooting of a base tree- Parameters:
base
- The input tree that may or may not be unrooted
-
getRootedBy
Roots a tree by an outgroup- Parameters:
base
- The input tree that may or may not be unrootedoutgroupNames
- The names of the members of the outgroup. Names not matching taxa in the tree are ignored. The node that is the MCRA of members of the outgroup will influence the rooting.- Throws:
IllegalArgumentException
- if no members of the tree appear in the outgroup
-
getRootedBy
Roots a tree by an outgroup- Parameters:
base
- The input tree that may or may not be unrootedoutgroupNames
- The names of the members of the outgroup. Names not matching taxa in the tree are ignored. The node that is the MCRA of members of the outgroup will influence the rooting.- Throws:
IllegalArgumentException
- if no members of the tree appear in the outgroup
-
getAllRootingsBy
Roots a tree by an outgroup- Parameters:
base
- The input tree that may or may not be unrootedoutgroupNames
- The names of the members of the outgroup. Names not matching taxa in the tree are ignored. The node that is the MCRA of members of the outgroup will influence the rooting.ingroupBranchLength
- the maximum length of the branch leading to the ingroup clade- Returns:
- every possible interpretation of rooting a tree by the given outgroup. If the outgroup is well defined there will be only one tree.
- Throws:
IllegalArgumentException
- if no members of the tree appear in the outgroup
-