Package jebl.evolution.sequences
Class CanonicalSequence
java.lang.Object
jebl.evolution.sequences.CanonicalSequence
- All Implemented Interfaces:
Comparable,Sequence,Attributable
A default implementation of the Sequence interface
that converts sequence characters to
States such that calling getString() will always return
uppercase residues with nucleotide U residues converted to T
- Version:
- $Id: BasicSequence.java 641 2007-02-16 11:56:21Z rambaut $
- Author:
- Andrew Rambaut, Alexei Drummond
-
Nested Class Summary
Nested classes/interfaces inherited from interface jebl.util.Attributable
Attributable.Utils -
Constructor Summary
ConstructorsConstructorDescriptionCanonicalSequence(SequenceType sequenceType, Taxon taxon, CharSequence sequenceString) Creates a sequence with a name corresponding to the taxon name.CanonicalSequence(SequenceType sequenceType, Taxon taxon, State[] states) Creates a sequence with a name corresponding to the taxon name -
Method Summary
Modifier and TypeMethodDescriptionintSequences are compared by their taxagetAttribute(String name) Gets the entire attribute map.intReturns the length of the sequencegetState(int site) byte[]State[]getTaxon()voidremoveAttribute(String name) voidsetAttribute(String name, Object value) Sets an named attribute for this object.toString()
-
Constructor Details
-
CanonicalSequence
Creates a sequence with a name corresponding to the taxon name. Use CharSequence so both a String and a StringBuilder are fine- Parameters:
taxon-sequenceString-
-
CanonicalSequence
Creates a sequence with a name corresponding to the taxon name- Parameters:
sequenceType-taxon-states-
-
-
Method Details
-
getSequenceType
- Specified by:
getSequenceTypein interfaceSequence- Returns:
- the type of symbols that this sequence is made up of.
-
getString
-
getCleanString
-
getStates
-
getStateIndices
public byte[] getStateIndices()- Specified by:
getStateIndicesin interfaceSequence- Returns:
- an array of state indices.
-
getState
-
getLength
public int getLength()Returns the length of the sequence -
getTaxon
-
compareTo
Sequences are compared by their taxa- Specified by:
compareToin interfaceComparable- Parameters:
o- another sequence- Returns:
- an integer
-
toString
-
setAttribute
Description copied from interface:AttributableSets an named attribute for this object.- Specified by:
setAttributein interfaceAttributable- Parameters:
name- the name of the attribute.value- the new value of the attribute.
-
getAttribute
- Specified by:
getAttributein interfaceAttributable- Parameters:
name- the name of the attribute of interest, or null if the attribute doesn't exist.- Returns:
- an object representing the named attributed for this object.
-
removeAttribute
- Specified by:
removeAttributein interfaceAttributable- Parameters:
name- name of attribute to remove
-
getAttributeNames
- Specified by:
getAttributeNamesin interfaceAttributable- Returns:
- an array of the attributeNames that this object has.
-
getAttributeMap
Description copied from interface:AttributableGets the entire attribute map.- Specified by:
getAttributeMapin interfaceAttributable- Returns:
- an unmodifiable map
-