Package org.biojavax.bio.taxa
Class SimpleNCBITaxon
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.bio.taxa.SimpleNCBITaxon
- All Implemented Interfaces:
Comparable,Changeable,NCBITaxon
Reference implementation of NCBITaxon.
- Since:
- 1.5
- Author:
- Richard Holland, Mark Schreiber, David Scott
-
Field Summary
FieldsFields inherited from interface org.biojavax.bio.taxa.NCBITaxon
ACRONYM, COMMON, EQUIVALENT, GENETICCODE, HIDDEN, LEFTVALUE, MITOGENETICCODE, NAMES, NODERANK, PARENT, RIGHTVALUE, SCIENTIFIC, SYNONYM -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSimpleNCBITaxon(int NCBITaxID) Creates a new instance of SimpleNCBITaxon based on the given taxon ID.SimpleNCBITaxon(Integer NCBITaxID) Creates a new instance of SimpleNCBITaxon based on the given taxon ID. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the name to this taxon in the given name class.intNCBITaxon objects are compared only by their NCBITaxID fields.booleancontainsName(String nameClass, String name) Tests for the presence of a name in a given class.booleanNCBITaxon objects are equal if their NCBITaxID fields match.Returns the name of this taxon entry in the form: scientific (common) or if there is no common name: scientific or if there are no scientific names at all, the empty string.Returns the genetic code of this taxon, which may be null if not known.getId()Gets the Hibernate ID.Gets the left value.Getter for property mitoGeneticCode.Returns all the name classes available for a taxon.Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific.Returns all the names available for a taxon in a given class.protected Setprotected final MapintGets the NCBI taxon ID.Gets the node rank of this taxon.Returns the parent NCBI taxon ID, if known.Gets the right value.inthashCode()final booleanReturns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific.booleanremoveName(String nameClass, String name) Removes the name from the given name class.voidsetGeneticCode(Integer geneticCode) Sets the genetic code of this taxon, which may be null, which will unset it.voidSets the Hibernate ID.voidsetLeftValue(Integer leftValue) Sets the left value.voidsetMitoGeneticCode(Integer mitoGeneticCode) Sets the mitochondrial genetic code of this taxon, which may be null, which will unset it.voidsetNodeRank(String nodeRank) Setter for property nodeRank.voidsetParentNCBITaxID(Integer parent) Sets the parent NCBI taxon ID.voidsetRightValue(Integer rightValue) Sets the right value.final voidsetTaxonHidden(boolean isTaxonHidden) determines whether this taxonomy level is displayed in etNameHierarchy()toString()Form: "taxid:[name,name...]"Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
names
-
-
Constructor Details
-
SimpleNCBITaxon
Creates a new instance of SimpleNCBITaxon based on the given taxon ID.- Parameters:
NCBITaxID- the underlying taxon ID from NCBI.
-
SimpleNCBITaxon
Creates a new instance of SimpleNCBITaxon based on the given taxon ID. It may not be null, else you'll get exceptions.- Parameters:
NCBITaxID- the underlying taxon ID from NCBI.
-
SimpleNCBITaxon
protected SimpleNCBITaxon()
-
-
Method Details
-
compareTo
NCBITaxon objects are compared only by their NCBITaxID fields.- Specified by:
compareToin interfaceComparable
-
equals
NCBITaxon objects are equal if their NCBITaxID fields match. -
hashCode
-
getNameClasses
Returns all the name classes available for a taxon. These are Strings.- Specified by:
getNameClassesin interfaceNCBITaxon- Returns:
- a set of name classes, or the empty set if there are none.
-
getNames
Returns all the names available for a taxon in a given class. These are Strings.- Specified by:
getNamesin interfaceNCBITaxon- Parameters:
nameClass- the name class to retrieve names from.- Returns:
- a set of names, or the empty set if there are none.
- Throws:
IllegalArgumentException- if the name is null.
-
getNameSet
-
addName
public void addName(String nameClass, String name) throws IllegalArgumentException, ChangeVetoException Adds the name to this taxon in the given name class. Neither can be null.- Specified by:
addNamein interfaceNCBITaxon- Parameters:
nameClass- the class to add the name in.name- the name to add.- Throws:
IllegalArgumentException- if the name is null.ChangeVetoException- in case of objections.
-
removeName
public boolean removeName(String nameClass, String name) throws IllegalArgumentException, ChangeVetoException Removes the name from the given name class. Neither can be null.- Specified by:
removeNamein interfaceNCBITaxon- Parameters:
nameClass- the class to remove the name from.name- the name to remove.- Returns:
- True if the name was found and removed, false otherwise.
- Throws:
IllegalArgumentException- if the name is null.ChangeVetoException- in case of objections.
-
containsName
Tests for the presence of a name in a given class. Neither can be null.- Specified by:
containsNamein interfaceNCBITaxon- Parameters:
nameClass- the class to look the name up in.name- the name to text for existence of.- Returns:
- True if the name exists in that class, false otherwise.
- Throws:
IllegalArgumentException- if the name is null.
-
getNamesMap
-
getParentNCBITaxID
Returns the parent NCBI taxon ID, if known.- Specified by:
getParentNCBITaxIDin interfaceNCBITaxon- Returns:
- Value of property parent.
-
setParentNCBITaxID
Sets the parent NCBI taxon ID. May be null if not known.- Specified by:
setParentNCBITaxIDin interfaceNCBITaxon- Parameters:
parent- New value of property parent.- Throws:
ChangeVetoException- in case of objections.
-
getNCBITaxID
Gets the NCBI taxon ID. This is never null and is immutable, as otherwise we would have no way of distinguishing between various taxa. It should be set by the constructor of an implementation.- Specified by:
getNCBITaxIDin interfaceNCBITaxon- Returns:
- Value of property NCBITaxID.
-
getNodeRank
Gets the node rank of this taxon. May be null.- Specified by:
getNodeRankin interfaceNCBITaxon- Returns:
- Value of property nodeRank.
-
setNodeRank
Setter for property nodeRank.- Specified by:
setNodeRankin interfaceNCBITaxon- Parameters:
nodeRank- New value of property nodeRank.- Throws:
ChangeVetoException- in case of objections.
-
getGeneticCode
Returns the genetic code of this taxon, which may be null if not known.- Specified by:
getGeneticCodein interfaceNCBITaxon- Returns:
- Value of property geneticCode.
-
setGeneticCode
Sets the genetic code of this taxon, which may be null, which will unset it.- Specified by:
setGeneticCodein interfaceNCBITaxon- Parameters:
geneticCode- New value of property geneticCode.- Throws:
ChangeVetoException- in case of objections.
-
getMitoGeneticCode
Getter for property mitoGeneticCode. Returns Persistent.NULL_INTEGER if null.- Specified by:
getMitoGeneticCodein interfaceNCBITaxon- Returns:
- Value of property mitoGeneticCode.
-
setMitoGeneticCode
Sets the mitochondrial genetic code of this taxon, which may be null, which will unset it.- Specified by:
setMitoGeneticCodein interfaceNCBITaxon- Parameters:
mitoGeneticCode- New value of property mitoGeneticCode.- Throws:
ChangeVetoException- in case of objections.
-
getLeftValue
Gets the left value. May be null.- Specified by:
getLeftValuein interfaceNCBITaxon- Returns:
- Value of property leftValue.
-
setLeftValue
Sets the left value. May be null.- Specified by:
setLeftValuein interfaceNCBITaxon- Parameters:
leftValue- New value of property leftValue.- Throws:
ChangeVetoException- in case of objections.
-
getRightValue
Gets the right value. May be null.- Specified by:
getRightValuein interfaceNCBITaxon- Returns:
- Value of property rightValue.
-
setRightValue
Sets the right value. May be null.- Specified by:
setRightValuein interfaceNCBITaxon- Parameters:
rightValue- New value of property rightValue.- Throws:
ChangeVetoException- in case of objections.
-
getDisplayName
Returns the name of this taxon entry in the form: scientific (common) or if there is no common name: scientific or if there are no scientific names at all, the empty string.- Specified by:
getDisplayNamein interfaceNCBITaxon- Returns:
- the display name as described above.
-
isTaxonHidden
Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific. It follows the chain up the tree as far as it can, and will stop at the first one it comes to that returns null for getParentNCBITaxID(). If this taxon entry has no scientific name, you will get the string ".".- Specified by:
isTaxonHiddenin interfaceNCBITaxon- Returns:
- the display name as described above.
-
setTaxonHidden
Description copied from interface:NCBITaxondetermines whether this taxonomy level is displayed in etNameHierarchy()- Specified by:
setTaxonHiddenin interfaceNCBITaxon- Parameters:
isTaxonHidden- - if true it is displayed- Throws:
ChangeVetoException
-
getNameHierarchy
Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific. It follows the chain up the tree as far as it can, and will stop at the first one it comes to that returns null for getParentNCBITaxID(). If this taxon entry has no scientific name, you will get the string ".".- Specified by:
getNameHierarchyin interfaceNCBITaxon- Returns:
- the display name as described above.
-
toString
Form: "taxid:[name,name...]" -
getId
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
setId
Sets the Hibernate ID. Should be used with caution.- Parameters:
id- the Hibernate ID, if using Hibernate.
-