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

# Class RawHierarchyTree

java.lang.Object
edu.msu.cme.rdp.classifier.train.RawHierarchyTree

public class RawHierarchyTree extends Object
A RawHierarchyTree holds the raw taxon and sequences information. A RawHierarchyTree can only have one type of children: child treenodes or child sequences.

## Constructor Summary

Constructors
Constructor
Description
`RawHierarchyTree(String n, RawHierarchyTree p, Taxonomy tax)`
Creates new RawHierarchyTree given the name and its parent.

## Method Summary

Modifier and Type
Method
Description
`float`
`getCopyNumber()`
`int`
`getGenusIndex()`
Returns the genus index of this treenode.
`int`
`getGenusNodeCount()`
`int`
`getLeaveCount()`
Counts the number of sequence leaves below this tree.
`String`
`getName()`
Gets the name of the treenode.
`void`
`getNodeMap(String level, HashMap<String,RawHierarchyTree> nodeMap)`
get all the lowest level nodes in given hierarchy level starting from the given root
`int`
`getNonSingletonLeaveCount()`
Counts the number of non-singleton sequence leaves below this tree.
`RawHierarchyTree`
`getParent()`
Gets the parent treenode.
`int`
`getSizeofChildren()`
Gets the size of the children, either taxon children or sequence leaves.
`int`
`getSizeofSubclasses()`
Gets the size of the child treenodes.
`RawHierarchyTree`
`getSubclassbyName(String n)`
Gets the child treenode with the given name.
`Collection<RawHierarchyTree>`
`getSubclasses()`
Gets the array of the subclasses if any.
`Taxonomy`
`getTaxonomy()`
Returns the taxon object of this treenode.
`int`
`getWordOccurrence(int wordIndex)`
Gets the word occurrence for the given word index.
`int`
`getWordOccurrenceSize()`
Returns the size of the array wordOccurrence.
`boolean`
`hasCopyNumber()`
`void`
`initWordOccurrence(LineageSequence pSeq, float[] wordPriorArr)`
This method initiates the word occurrences from a sequence for the lowest level of the hierarchy tree.
`boolean`
`isSingleton()`
`void`
`releaseWordOccurrence()`
Resets the array wordOccurrence to null.
`protected void`
`setCopyNumber(float c)`
`void`
`setGenusIndex(int i)`
Sets the genus index of this treenode.

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

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

## Constructor Details

### RawHierarchyTree

public RawHierarchyTree(String n, RawHierarchyTree p, Taxonomy tax)
Creates new RawHierarchyTree given the name and its parent. Note: a RawHierarchyTree can only have one type of children: child treenodes or child sequences. Usually the lowest ranked nodes contain the sequence leaves.

## Method Details

### setCopyNumber

protected void setCopyNumber(float c)

### getCopyNumber

public float getCopyNumber()

### hasCopyNumber

public boolean hasCopyNumber()

### getName

public String getName()
Gets the name of the treenode.

### getParent

public RawHierarchyTree getParent()
Gets the parent treenode.

### getSubclasses

public Collection<RawHierarchyTree> getSubclasses()
Gets the array of the subclasses if any.

### getSubclassbyName

public RawHierarchyTree getSubclassbyName(String n)
Gets the child treenode with the given name.

### getSizeofChildren

public int getSizeofChildren()
Gets the size of the children, either taxon children or sequence leaves.

### getSizeofSubclasses

public int getSizeofSubclasses()
Gets the size of the child treenodes.

### initWordOccurrence

public void initWordOccurrence(LineageSequence pSeq, float[] wordPriorArr) throws IOException
This method initiates the word occurrences from a sequence for the lowest level of the hierarchy tree. Duplicate words from one sequence will be count only once.

Throws:
  `IOException`

### getWordOccurrenceSize

public int getWordOccurrenceSize()
Returns the size of the array wordOccurrence.

### getWordOccurrence

public int getWordOccurrence(int wordIndex)
Gets the word occurrence for the given word index.

### releaseWordOccurrence

public void releaseWordOccurrence()
Resets the array wordOccurrence to null.

### getLeaveCount

public int getLeaveCount()
Counts the number of sequence leaves below this tree.

### getGenusNodeCount

public int getGenusNodeCount()

### isSingleton

public boolean isSingleton()

### getNonSingletonLeaveCount

public int getNonSingletonLeaveCount()
Counts the number of non-singleton sequence leaves below this tree.

### getTaxonomy

public Taxonomy getTaxonomy()
Returns the taxon object of this treenode.

### setGenusIndex

public void setGenusIndex(int i)
Sets the genus index of this treenode.

### getGenusIndex

public int getGenusIndex()
Returns the genus index of this treenode.

### getNodeMap

public void getNodeMap(String level, HashMap<String,RawHierarchyTree> nodeMap)
get all the lowest level nodes in given hierarchy level starting from the given root