softparsmap
Class GeneLeaf

java.lang.Object
  extended bysoftparsmap.Node
      extended bysoftparsmap.GeneNode
          extended bysoftparsmap.GeneLeaf
All Implemented Interfaces:
java.lang.Comparable

public class GeneLeaf
extends GeneNode
implements java.lang.Comparable

Defines a gene leaf in a gene tree.


Constructor Summary
GeneLeaf(EdgeType edgeType, int label)
          Same as using the constructor GeneLeaf(edgeType, label, 1.0);
GeneLeaf(EdgeType edgeType, int label, double edge)
          Construct a gene leaf given an edge type, a label, and an edge value.
 
Method Summary
 GeneNode cloneNode()
          Returns a copy of this GeneNode.
 int compareTo(java.lang.Object o)
          Returns this label number minus the given nodes label number.
 GeneLeaf findLeaf(GeneLeaf leaf)
          Returns the leaf with the same label as given leaf.
 java.util.Set getChildren()
          Leaves can not have children so this will throw an FatalException.
 SpeciesNode getM()
          See the m-map in the article.
 boolean isBinaryTree()
          Return true if the subtree where this node is the root is binary, else false.
static GeneLeaf nextLeaf(EdgeType edgeType)
          Returns a new leaf with an unique label.
 Node pruneOneChildNodes()
          Collapsing all internal nodes with only one child node.
 GeneNode rerootThis()
          Re-rooting the gene tree that this node is a part of.
 boolean rootedEquals(GeneNode leaf)
          Returns true if this subtrees have the same rooted topology as the given subtree.
 GeneNode setCollapsedEdge(boolean collapsedEdge)
          Sets the collapsed flag to given value.
 void setM(SpeciesNode m)
          Sets the species in which this sequence was found.
 void setNewLabel()
          Reassigns the label of this node to a new unique number.
 java.lang.String toString()
          Returns the label number.
 
Methods inherited from class softparsmap.GeneNode
cloneTree, collapsedEdges, collapseEdges, countDuplications, countGeneLosses, countMutation, countStrongEdges, duplicatedNode, findLeaf, findNode, findNodeForUnrootedSplit, getChildIterator, getCollapsedEdge, getDuplicatedNodes, getDuplicationsNode, getEdgeType, getEdgeValue, getFamily, getGeneLossesNode, getInternalNodes, getMM, getPropertyFile, getSL, hasFamily, hasM, hasMM, hasSL, insertSpeciesTreeSplits, isEdgeWeak, nextNode, nextNode, reroot, resolveUncertainties, setEdge, setEdgeType, setEdgeValue, setFamily, setFamilyTree
 
Methods inherited from class softparsmap.Node
addChild, equals, findLCA, getLabel, getLeaves, getMap, getNodes, getParent, getRoot, getSplits, hasChildren, hashCode, isConsistentWith, isRoot, nextUnique, numChildren, removeChild, setMap, setNextUnique, toStringAll, toStringTable, toStringTree
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeneLeaf

public GeneLeaf(EdgeType edgeType,
                int label,
                double edge)
Construct a gene leaf given an edge type, a label, and an edge value.

Parameters:
edgeType - is the edge type
label - is the gene label
edge - is the value of edge for this leaf

GeneLeaf

public GeneLeaf(EdgeType edgeType,
                int label)
Same as using the constructor GeneLeaf(edgeType, label, 1.0);

Method Detail

getM

public SpeciesNode getM()
Description copied from class: GeneNode
See the m-map in the article.

Overrides:
getM in class GeneNode
Returns:
the mapped species node

setM

public void setM(SpeciesNode m)
Sets the species in which this sequence was found.

Parameters:
m - is the species in which this sequence was found

getChildren

public java.util.Set getChildren()
Leaves can not have children so this will throw an FatalException.

Overrides:
getChildren in class Node
Returns:
the set of children under this node. If there are no children an empty set will be created and returned.
Throws:
FatalException - since a child can not have children.

setCollapsedEdge

public GeneNode setCollapsedEdge(boolean collapsedEdge)
Description copied from class: GeneNode
Sets the collapsed flag to given value.

Overrides:
setCollapsedEdge in class GeneNode
Parameters:
collapsedEdge - is new value of the collapsed flag
Returns:
this gene node for chaining.

pruneOneChildNodes

public Node pruneOneChildNodes()
Description copied from class: GeneNode
Collapsing all internal nodes with only one child node. Replacing the same method in Node in order to join edges when removing a node with one child.

Overrides:
pruneOneChildNodes in class GeneNode
Returns:
the new root.

cloneNode

public GeneNode cloneNode()
Description copied from class: GeneNode
Returns a copy of this GeneNode. Does not connect it to any other node.

Overrides:
cloneNode in class GeneNode
Returns:
The copy.

rootedEquals

public boolean rootedEquals(GeneNode leaf)
Description copied from class: GeneNode
Returns true if this subtrees have the same rooted topology as the given subtree.

Overrides:
rootedEquals in class GeneNode
Parameters:
leaf - is the root of the subtree that this subtree will be compared against
Returns:
true if their rooted topology is identical, else false

findLeaf

public GeneLeaf findLeaf(GeneLeaf leaf)
Description copied from class: GeneNode
Returns the leaf with the same label as given leaf. The search will only be done in this subtree.

Overrides:
findLeaf in class GeneNode
Parameters:
leaf - is the leaf
Returns:
a leaf that has the same label as the given leaf. Null if not found.
See Also:
GeneLeaf

isBinaryTree

public boolean isBinaryTree()
Description copied from class: Node
Return true if the subtree where this node is the root is binary, else false.

Overrides:
isBinaryTree in class Node
Returns:
true if the subtree is binary, else false.

compareTo

public int compareTo(java.lang.Object o)
Description copied from class: Node
Returns this label number minus the given nodes label number.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class Node
Parameters:
o - is the given node
Returns:
this label number minus the given nodes label number
See Also:
Comparable

rerootThis

public GeneNode rerootThis()
Description copied from class: GeneNode
Re-rooting the gene tree that this node is a part of. This gene node will be the root when finished.

Overrides:
rerootThis in class GeneNode
Returns:
the root of the re-rooted tree.

toString

public java.lang.String toString()
Description copied from class: Node
Returns the label number.

Overrides:
toString in class Node
Returns:
the label number

setNewLabel

public void setNewLabel()
Description copied from class: GeneNode
Reassigns the label of this node to a new unique number.

Overrides:
setNewLabel in class GeneNode
Returns:
this node for chaining

nextLeaf

public static GeneLeaf nextLeaf(EdgeType edgeType)
Returns a new leaf with an unique label.

Returns:
a new leaf with an unique label.