Package edu.msu.cme.rdp.classifier.train.validation

# Class TreeFactory

java.lang.Object
edu.msu.cme.rdp.classifier.train.validation.TreeFactory

public class TreeFactory extends Object

## Constructor Summary

Constructors
Constructor
Description
`TreeFactory(Reader taxReader)`
Creates new TreeFactory

## Method Summary

Modifier and Type
Method
Description
`HierarchyTree`
`addSequence(LineageSequence pSeq)`
For the given sequence name, its ancestors, and the sequence, creates a HierarchyTree for each ancestor, If the root does not exist, creates the root with a null parent.
`HierarchyTree`
`addSequence(LineageSequence pSeq, boolean initWordOccurrence)`
`void`
`buildTree()`
build the taxonomic tree without sequences attached to it
`void`
`calculateWordPrior()`
`void`
`displayTreePhylo(HierarchyTree root, String index, int indent)`
display the phylogenetic tree for each node, display the index and the name for each sequence, diaplay the name and the description
`String`
`getLowestRank()`
`Set<String>`
`getRankSet()`
`HierarchyTree`
`getRoot()`
Gets the root of the tree
`Taxonomy`
`getTaxonomy(String seqName, String ancestorName, int pid, int index)`
`float`
`getWordPrior(int wordIndex)`
`void`
`printWordPriors()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TreeFactory

public TreeFactory(Reader taxReader) throws IOException
Creates new TreeFactory

Throws:
  `IOException`

## Method Details

### buildTree

public void buildTree()
build the taxonomic tree without sequences attached to it

### addSequence

public HierarchyTree addSequence(LineageSequence pSeq) throws IOException
For the given sequence name, its ancestors, and the sequence, creates a HierarchyTree for each ancestor, If the root does not exist, creates the root with a null parent. If the root is already exist, checks the ParsedSequence to see if its oldest ancestor is the same as the previous root.

Throws:
  `IOException`

### addSequence

public HierarchyTree addSequence(LineageSequence pSeq, boolean initWordOccurrence) throws IOException

Throws:
  `IOException`

### getTaxonomy

public Taxonomy getTaxonomy(String seqName, String ancestorName, int pid, int index)

### getRoot

public HierarchyTree getRoot()
Gets the root of the tree

### getRankSet

public Set<String> getRankSet()

### getLowestRank

public String getLowestRank()

### displayTreePhylo

public void displayTreePhylo(HierarchyTree root, String index, int indent)
display the phylogenetic tree for each node, display the index and the name for each sequence, diaplay the name and the description

### calculateWordPrior

public void calculateWordPrior()

### printWordPriors

public void printWordPriors() throws IOException

Throws:
  `IOException`

### getWordPrior

public float getWordPrior(int wordIndex)