softparsmap
Class SpeciesLeaf

java.lang.Object
  extended bysoftparsmap.Node
      extended bysoftparsmap.SpeciesNode
          extended bysoftparsmap.SpeciesLeaf
All Implemented Interfaces:
java.lang.Comparable

public class SpeciesLeaf
extends SpeciesNode

Defines a species leaf in a species tree.


Constructor Summary
SpeciesLeaf(DataSource dataSource, int label)
          Constructs a species leaf given a data source and a label.
 
Method Summary
 SpeciesLeaf addSequence(EdgeType edgeType, int leafLabel)
          Add a sequence with the the given edge type and label.
 SpeciesLeaf addSequence(GeneLeaf leaf)
          Adds a given sequence.
 java.util.Set getChildren()
          Leaves can not have children so if calling this method will throw a FatalException.
 java.util.Set getSequences()
          Returns the set of gene sequences that belongs to this species.
static SpeciesLeaf nextLeafS(DataSource dataSource)
          Returns a species leaf with a unique label.
static SpeciesLeaf nextLeafS(DataSource dataSource, int seq)
          Returns a species leaf with a unique label and with one sequence.
 Node pruneOneChildNodes()
          Remove all internal nodes with only one child.
 java.lang.String toNewick()
          Returns the subtree in Newick format.
 
Methods inherited from class softparsmap.SpeciesNode
computeLca, computeLca, getDataSource, getPropertyFile, inferMutation, isBelow, isOnSameRootPath, minimizeMutation, nextNodeS, parseNewick, setPreorder
 
Methods inherited from class softparsmap.Node
addChild, compareTo, equals, findLCA, getLabel, getLeaves, getMap, getNodes, getParent, getRoot, getSplits, hasChildren, hashCode, isBinaryTree, isConsistentWith, isRoot, nextUnique, numChildren, removeChild, setMap, setNextUnique, toString, toStringAll, toStringTable, toStringTree
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpeciesLeaf

public SpeciesLeaf(DataSource dataSource,
                   int label)
Constructs a species leaf given a data source and a label.

Parameters:
dataSource - is the data source used to create this leaf
label - is the label of this species leaf
Method Detail

nextLeafS

public static SpeciesLeaf nextLeafS(DataSource dataSource,
                                    int seq)
Returns a species leaf with a unique label and with one sequence.

Parameters:
dataSource - is the data source used to create this leaf
seq - is the label of the sequence that will be attached after creating the new species leaf
Returns:
a new species with the sequence with label 'seq' in it.

nextLeafS

public static SpeciesLeaf nextLeafS(DataSource dataSource)
Returns a species leaf with a unique label.

Parameters:
dataSource - is the data source used to create this leaf
Returns:
a new species leaf

pruneOneChildNodes

public Node pruneOneChildNodes()
Description copied from class: Node
Remove all internal nodes with only one child. This is done on this subtree and the lowest node is retained.

Overrides:
pruneOneChildNodes in class Node
Returns:
the new root for the changed subtree.

toNewick

public java.lang.String toNewick()
Description copied from class: SpeciesNode
Returns the subtree in Newick format.

Overrides:
toNewick in class SpeciesNode
Returns:
the subtree in Newick format.

getChildren

public java.util.Set getChildren()
Leaves can not have children so if calling this method will throw a 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 - if called.

getSequences

public java.util.Set getSequences()
Returns the set of gene sequences that belongs to this species.

Returns:
a set with at least one instance of GeneLeaf.
See Also:
GeneLeaf

addSequence

public SpeciesLeaf addSequence(GeneLeaf leaf)
Adds a given sequence.

Parameters:
leaf - is the sequence that will be added
Returns:
this for chaining
See Also:
GeneLeaf

addSequence

public SpeciesLeaf addSequence(EdgeType edgeType,
                               int leafLabel)
Add a sequence with the the given edge type and label.

Parameters:
edgeType - is the edge type of the gene leaf added
leafLabel - is the label of the new sequence that is added
Returns:
this for chaining.
See Also:
GeneLeaf, EdgeType