Package pal.alignment

Class DataTranslator

java.lang.Object
pal.alignment.DataTranslator

public class DataTranslator extends Object
  • Constructor Details

    • DataTranslator

      public DataTranslator(Alignment base)
      Parameters:
      base - the base alignment that will be translated. The data type of this alignment must be of type MolecularDataType
      Throws:
      IllegalArgumentException - if base DataType not of type MolecularDataType
    • DataTranslator

      public DataTranslator(int[][] stateData)
      Base DataType is assumed to be IUPAC
    • DataTranslator

      public DataTranslator(int[][] stateData, MolecularDataType dt)
    • DataTranslator

      public DataTranslator(int[][] stateData, MolecularDataType dt, IdGroup ids)
    • DataTranslator

      public DataTranslator(MolecularDataType dt, char[][] charData)
  • Method Details

    • toStates

      public int[][] toStates(MolecularDataType dt, int startingIndex)
      Returns:
      an array of states, where the states are of the form dictated by dt, and based on the base alignment
    • getFrequencies

      public double[] getFrequencies(MolecularDataType dt, int startingIndex)
    • ensureUnknownState

      public void ensureUnknownState(int[] states, int unknownState)
      Ensures that all states that are "unknown" get set to the value of 'unknownState'
    • toChars

      public char[][] toChars(MolecularDataType dt, int startingIndex)
      Returns:
      an array of characters, where the characters are of the form dictated by dt, and based on the base alignment
    • toAlignment

      public Alignment toAlignment(MolecularDataType dt, int startingIndex)
    • toReverseComplementNucleotides

      public Alignment toReverseComplementNucleotides(int startingIndex)
    • toLeftAlignedReverseComplementNucleotides

      public Alignment toLeftAlignedReverseComplementNucleotides(int startingIndex)
    • toStates

      public static final int[][] toStates(Alignment a)
      Converts an alignment to a state matrix Stored as [sequnce][site]
    • toStates

      public static final int[][] toStates(Alignment a, int gapUnknownState)
      Converts an alignment to a state matrix Stored as [sequnce][site]
    • toNucleotides

      public static final int[][] toNucleotides(int[][] dtStates, MolecularDataType dt)
      Converts an alignment to a state matrix Stored as [sequnce][site]
    • toStates

      public static final int[][] toStates(char[][] dtChars, DataType dt)
      Converts an alignment to a state matrix Stored as [sequnce][site]
    • toChars

      public static final char[][] toChars(int[][] dtStates, DataType dt)
      Converts an state matrix to a char matrix Stored as [sequnce][site]
    • ensureUnknownState

      public static final void ensureUnknownState(DataType dt, int[] states, int unknownState)
      Ensures that all states that are "unknown" (according to a certain DataType) get set to the value of 'unknownState'