jebl.evolution.alignments
Class ConsensusSequence

java.lang.Object
  extended by jebl.evolution.alignments.ConsensusSequence
All Implemented Interfaces:
Comparable, Sequence, Attributable

public abstract class ConsensusSequence
extends Object
implements Sequence

Author:
rambaut, Alexei Drummond

Nested Class Summary
 
Nested classes/interfaces inherited from interface jebl.util.Attributable
Attributable.Utils
 
Constructor Summary
ConsensusSequence(Taxon taxon, Alignment source)
          Creates a FilteredSequence wrapper to the given source sequence.
 
Method Summary
 int compareTo(Object o)
          Sequences are compared by their taxa
static State[] constructConsensus(Alignment source)
           
 Object getAttribute(String name)
           
 Set<String> getAttributeNames()
           
 int getLength()
          Returns the length of the sequence
 SequenceType getSequenceType()
           
 State getState(int site)
           
 byte[] getStateIndices()
           
 State[] getStates()
           
 String getString()
           
 Taxon getTaxon()
           
 void setAttribute(String name, Object value)
          Sets an named attribute for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jebl.util.Attributable
getAttributeMap, removeAttribute
 

Constructor Detail

ConsensusSequence

public ConsensusSequence(Taxon taxon,
                         Alignment source)
Creates a FilteredSequence wrapper to the given source sequence.

Parameters:
source -
Method Detail

getSequenceType

public SequenceType getSequenceType()
Specified by:
getSequenceType in interface Sequence
Returns:
the type of symbols that this sequence is made up of.

getString

public String getString()
Specified by:
getString in interface Sequence
Returns:
a string representing the sequence of symbols.

getStates

public State[] getStates()
Specified by:
getStates in interface Sequence
Returns:
an array of state objects.

getStateIndices

public byte[] getStateIndices()
Specified by:
getStateIndices in interface Sequence
Returns:
an array of state indices.

getState

public State getState(int site)
Specified by:
getState in interface Sequence
Returns:
the state at site.

getLength

public int getLength()
Returns the length of the sequence

Specified by:
getLength in interface Sequence
Returns:
the length

constructConsensus

public static State[] constructConsensus(Alignment source)

getTaxon

public Taxon getTaxon()
Specified by:
getTaxon in interface Sequence
Returns:
that taxon that this sequence represents (primarily used to match sequences with tree nodes)

compareTo

public int compareTo(Object o)
Sequences are compared by their taxa

Specified by:
compareTo in interface Comparable
Parameters:
o - another sequence
Returns:
an integer

setAttribute

public void setAttribute(String name,
                         Object value)
Description copied from interface: Attributable
Sets an named attribute for this object.

Specified by:
setAttribute in interface Attributable
Parameters:
name - the name of the attribute.
value - the new value of the attribute.

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface Attributable
Parameters:
name - the name of the attribute of interest.
Returns:
an object representing the named attributed for this object.

getAttributeNames

public Set<String> getAttributeNames()
Specified by:
getAttributeNames in interface Attributable
Returns:
an array of the attributeNames that this object has.