Class State

  • All Implemented Interfaces:
    java.lang.Comparable
    Direct Known Subclasses:
    AminoAcidState, CodonState, NucleotideState

    public abstract class State
    extends java.lang.Object
    implements java.lang.Comparable
    Version:
    $Id: State.java 1002 2009-05-27 03:33:19Z matt_kearse $
    Author:
    Andrew Rambaut, Alexei Drummond
    • Method Detail

      • getCode

        public java.lang.String getCode()
        Returns the 1 letter code for this state.
        Returns:
        the 1 letter code for this state.
      • getIndex

        public int getIndex()
      • getFullName

        public java.lang.String getFullName()
        A descriptive name for this state. e.g. "Phenylalanine" or "Adenine".
        Returns:
        A descriptive name for this state. e.g. "Phenylalanine" or "Adenine".
      • getName

        @Deprecated
        public java.lang.String getName()
        Deprecated.
        you probably want to use getFullName() or getCode().
        The 1 letter code (for legacy purposes). Same as getCode()
        Returns:
        The 1 letter code (for legacy purposes). Same as getCode()
        See Also:
        getFullName()
      • isAmbiguous

        public boolean isAmbiguous()
      • getCanonicalStates

        public java.util.Set<State> getCanonicalStates()
      • possiblyEqual

        public boolean possiblyEqual​(State other)
        Parameters:
        other - another state to check for the equality with.
        Returns:
        true if the other state is or possibly is equal to this state, taking ambiguities into account, i.e. if the ambiguity sets of this and the other state intersect.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Specified by:
        compareTo in interface java.lang.Comparable
      • toString

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

        public abstract boolean isGap()
      • fractionEqual

        public double fractionEqual​(State other)
        Determine how much in common these potentially ambigous states have as a fraction between 0 and 1 2 non-ambiguous states will return 0. 2 identical non-ambiguous states will return 1. e.g. for Nucleotides R,A = 0.5 R,G = 0.5 R,M = 0.25
        Parameters:
        other - another state to compare with
        Returns:
        the fraction of canonical states that the 2 potentially ambiguous states have in common between 0 and 1.