public abstract class OtuNodeImpl extends Object implements OtuNode, Comparable<OtuNode>
OtuNode
is also the superclass for all WGS and 16S OtuNode
classes. OtuNodes hold taxonomy assignment info, represents one line of
ClassifierModule
output. The assignment is stored in a local taxaMap, which holds
one taxa name per taxonomy level.Modifier and Type | Field and Description |
---|---|
protected static String |
CLASS_DELIM
Standard classifier output level delimiter for CLASS
|
protected static String |
DOMAIN_DELIM
Standard classifier output level delimiter for DOMAIN
|
protected static String |
FAMILY_DELIM
Standard classifier output level delimiter for FAMILY
|
protected static String |
GENUS_DELIM
Standard classifier output level delimiter for GENUS
|
protected static String |
ORDER_DELIM
Standard classifier output level delimiter for ORDER
|
protected static String |
PHYLUM_DELIM
Standard classifier output level delimiter for PHYLUM
|
protected static String |
SPECIES_DELIM
Standard classifier output level delimiter for SPECIES
|
Constructor and Description |
---|
OtuNodeImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addTaxa(String taxa,
String level)
If called for level not included in
Config ."report.taxonomyLevels",
check if the top level taxonomy level is already assigned. |
int |
compareTo(OtuNode node)
The sort order of the TreeSet(
OtuNode ) is absolutely required for proper processing in
addTaxa(String, String) and getTaxaMap() . |
Map<String,String> |
delimToLevelMap()
|
int |
getCount()
Gets the OTU count.
|
String |
getLine()
Get the line from classifier output file used to create this OtuNode.
|
String |
getOtuName()
Build the OTU name from the taxaMap.
|
String |
getSampleId()
Gets the sample ID to which the read belongs
|
Map<String,String> |
getTaxaMap()
This implementation ensures all levels between top and bottom taxonomy levels are complete.
|
protected void |
populateInBetweenTaxa()
Populate missing OTUs if top level taxa is defined and there is a level gap between the top level and the bottom
level.
|
void |
setCount(int count)
Set the number of reads for a sample ID that have this OTU assignment.
|
void |
setLine(String line)
Set line only if in DEBUG mode, so we can print OtuNode constructor inputs.
|
void |
setSampleId(String sampleId)
Set the sample ID, parsed from file name or sequence header, to which this taxonomy assignment belongs.
|
protected static String CLASS_DELIM
protected static String DOMAIN_DELIM
protected static String FAMILY_DELIM
protected static String GENUS_DELIM
protected static String ORDER_DELIM
protected static String PHYLUM_DELIM
protected static String SPECIES_DELIM
public void addTaxa(String taxa, String level) throws Exception
Config
."report.taxonomyLevels",
check if the top level taxonomy level is already assigned. If so, populate missing levels by passing the parent
taxa to TaxaUtil.buildUnclassifiedTaxa(String)
until the given in level is assigned.public int compareTo(OtuNode node)
OtuNode
) is absolutely required for proper processing in
addTaxa(String, String)
and getTaxaMap()
. We sort alphabetically by otuName, however if one
otuName is a substring of the compared otuName, the longer name is ordered before the shorter name.OtuNode
s we can be sure we add
nodes in the taxonomy hierarchy from the bottom-up.compareTo
in interface Comparable<OtuNode>
public Map<String,String> delimToLevelMap()
OtuNode
delimToLevelMap
in interface OtuNode
public int getCount()
OtuNode
public String getLine()
OtuNode
public String getOtuName()
OtuNode
getOtuName
in interface OtuNode
public String getSampleId()
OtuNode
getSampleId
in interface OtuNode
public Map<String,String> getTaxaMap() throws Exception
getTaxaMap
in interface OtuNode
Exception
- if errors occur building mappublic void setCount(int count)
OtuNode
public void setLine(String line)
public void setSampleId(String sampleId)
OtuNode
setSampleId
in interface OtuNode
sampleId
- ID of sample to which this taxonomy assignment belongsprotected void populateInBetweenTaxa()