|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.compbio.phyl.DnaSequenceTree
public class DnaSequenceTree
Class DnaSequenceTree encapsulates a rooted bifurcating tree of DNA sequences. Each node in the tree is designated by an index from 0 to N−1, where N is the tree's length. The tree's capacity C is the maximum number of nodes (specified when the tree was constructed). For a tree to hold M tip nodes, the tree's capacity must be C ≥ 2M − 1.
| Constructor Summary | |
|---|---|
DnaSequenceTree(int C)
Construct a new DNA sequence tree with the given capacity. |
|
| Method Summary | |
|---|---|
int |
add(int i,
DnaSequence seq)
Add the given DNA sequence to this DNA sequence tree. |
Double |
branchLength(int i)
Returns the branch length associated with the given node in this tree. |
void |
branchLength(int i,
Double brlen)
Set the branch length associated with the given node in this tree. |
int |
capacity()
Returns the capacity of this tree. |
int |
child1(int i)
Returns the first child of the given node in this tree. |
int |
child2(int i)
Returns the second child of the given node in this tree. |
void |
clear()
Clear this DNA sequence tree. |
void |
copy(DnaSequenceTree tree)
Set this DNA sequence tree to be a copy of the given tree. |
void |
join(DnaSequenceTree tree1,
DnaSequenceTree tree2)
Set this DNA sequence tree to be the join of the two given trees. |
int |
length()
Returns the length of this tree. |
int |
parent(int i)
Returns the parent of the given node in this tree. |
int |
root()
Returns the root of this tree. |
DnaSequence |
seq(int i)
Returns the DNA sequence associated with the given node in this tree. |
void |
seq(int i,
DnaSequence seq)
Set the DNA sequence associated with the given node in this tree. |
DnaSequenceList |
toList()
Create a DnaSequenceList consisting of the DNA sequences associated with the tip nodes in this tree. |
String |
toString()
Returns a string version of this DNA sequence tree. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DnaSequenceTree(int C)
C - Capacity.
IllegalArgumentException - (unchecked exception) Thrown if C < 0.| Method Detail |
|---|
public int capacity()
public int length()
public int root()
public int parent(int i)
i - Node index, 0 ≤ i ≤ N−1.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.public int child1(int i)
i - Node index, 0 ≤ i ≤ N−1.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.public int child2(int i)
i - Node index, 0 ≤ i ≤ N−1.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.public DnaSequence seq(int i)
i - Node index, 0 ≤ i ≤ N−1.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.
public void seq(int i,
DnaSequence seq)
Note: The tree contains a reference to (not a copy of) seq.
i - Node index, 0 ≤ i ≤ N−1.seq - DNA sequence associated with node i, or null if no
DNA sequence is associated.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.public Double branchLength(int i)
i - Node index, 0 ≤ i ≤ N−1.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.
public void branchLength(int i,
Double brlen)
i - Node index, 0 ≤ i ≤ N−1.brlen - Branch length between node i and its parent, or
null if no branch length is associated.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.public void clear()
public void copy(DnaSequenceTree tree)
Note: This tree contains references to (not copies of) the DNA sequences in tree.
tree - DNA sequence tree.
NullPointerException - (unchecked exception) Thrown if tree is null.
IllegalArgumentException - (unchecked exception) Thrown if this tree's capacity is less than
tree's length.
public void join(DnaSequenceTree tree1,
DnaSequenceTree tree2)
Note: This tree contains references to (not copies of) the DNA sequences in tree1 and tree2.
Note: Both tree1 and tree2 must be different objects from this tree.
Note: This method may alter the index of this tree's root node.
tree1 - First DNA sequence tree.tree2 - Second DNA sequence tree.
NullPointerException - (unchecked exception) Thrown if tree1 is null. Thrown if
tree2 is null.
IllegalArgumentException - (unchecked exception) Thrown if this tree's capacity is less than
N1 + N2 + 1.
public int add(int i,
DnaSequence seq)
Alternatively, if this tree is empty, the add() method sets this tree to have one root node associated with the given DNA sequence. In this case i is ignored.
Note: This tree contains a reference to (not a copy of) seq.
Note: This method may alter the index of this tree's root node.
i - Node index, 0 ≤ i ≤ N−1.seq - DNA sequence associated with new tip node, or null if no DNA
sequence is associated.
IllegalArgumentException - (unchecked exception) Thrown if this tree's capacity is less than
this tree's length + 2.
IndexOutOfBoundsException - (unchecked exception) Thrown if i is out of bounds.public DnaSequenceList toList()
Note: The returned list contains references to (not copies of) the DNA sequences in this tree.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||