Alignments
Class Site

java.lang.Object
  extended by Alignments.Site
All Implemented Interfaces:
java.io.Serializable

public class Site
extends java.lang.Object
implements java.io.Serializable

Represents a "site" in an "alignment". Both terms used generously.

Version:
1.0
See Also:
Serialized Form

Constructor Summary
Site(java.util.LinkedHashMap<java.lang.String,java.lang.String> sites)
          Creates a site in a alignment with no ambiguous data
Site(java.util.LinkedHashMap<java.lang.String,java.lang.String> sites, Ambiguous ambig)
          Creates a site in a alignment with ambiguous data
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.util.Set<java.lang.String> getCharacter(java.lang.String taxa)
          Gets the possible characters for a given taxa.
 int getNum()
          Get the number of taxa
 java.lang.String getRawCharacter(java.lang.String taxa)
          Gets the raw charcater for a given taxa.
 java.util.Set<java.lang.String> getTaxa()
          Get the set of taxa
 int hashCode()
           
 Site recode(java.util.Map<java.lang.String,java.lang.String> recode)
          Recodes the site and returns it
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Site

public Site(java.util.LinkedHashMap<java.lang.String,java.lang.String> sites)
Creates a site in a alignment with no ambiguous data

Parameters:
sites - Map from taxa name to state

Site

public Site(java.util.LinkedHashMap<java.lang.String,java.lang.String> sites,
            Ambiguous ambig)
Creates a site in a alignment with ambiguous data

Parameters:
sites - Map from taxa name to state
ambig - Description of ambiguous data
Method Detail

getCharacter

public java.util.Set<java.lang.String> getCharacter(java.lang.String taxa)
Gets the possible characters for a given taxa. This returns a set as it takes into account ambiguous data. For example if N is defined to be A, C, T or G then this function will return a set containing A, C, T and G if the raw data contains a N

Parameters:
taxa - Taxa to return the character for
Returns:
The character for the given taxa

getRawCharacter

public java.lang.String getRawCharacter(java.lang.String taxa)
Gets the raw charcater for a given taxa. This no account of ambiguous data and will just return the raw character

Parameters:
taxa - Taxa to return the character for
Returns:
The character for the given taxa

getNum

public int getNum()
Get the number of taxa

Returns:
The number of taxa

getTaxa

public java.util.Set<java.lang.String> getTaxa()
Get the set of taxa

Returns:
Set containing taxa names

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

recode

public Site recode(java.util.Map<java.lang.String,java.lang.String> recode)
Recodes the site and returns it

Parameters:
recode - A map from original state to new state, e.g. to recode DNA to RY it would contains A -> R, G -> R, C -> Y, T -> Y
Returns:
A recoded site