Package pal.alignment
Class DataTranslator
- java.lang.Object
-
- pal.alignment.DataTranslator
-
public class DataTranslator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DataTranslator(int[][] stateData)
Base DataType is assumed to be IUPACDataTranslator(int[][] stateData, MolecularDataType dt)
DataTranslator(int[][] stateData, MolecularDataType dt, IdGroup ids)
DataTranslator(Alignment base)
DataTranslator(MolecularDataType dt, char[][] charData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
ensureUnknownState(int[] states, int unknownState)
Ensures that all states that are "unknown" get set to the value of 'unknownState'static 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'double[]
getFrequencies(MolecularDataType dt, int startingIndex)
Alignment
toAlignment(MolecularDataType dt, int startingIndex)
static char[][]
toChars(int[][] dtStates, DataType dt)
Converts an state matrix to a char matrix Stored as [sequnce][site]char[][]
toChars(MolecularDataType dt, int startingIndex)
Alignment
toLeftAlignedReverseComplementNucleotides(int startingIndex)
static int[][]
toNucleotides(int[][] dtStates, MolecularDataType dt)
Converts an alignment to a state matrix Stored as [sequnce][site]Alignment
toReverseComplementNucleotides(int startingIndex)
static int[][]
toStates(char[][] dtChars, DataType dt)
Converts an alignment to a state matrix Stored as [sequnce][site]static int[][]
toStates(Alignment a)
Converts an alignment to a state matrix Stored as [sequnce][site]static int[][]
toStates(Alignment a, int gapUnknownState)
Converts an alignment to a state matrix Stored as [sequnce][site]int[][]
toStates(MolecularDataType dt, int startingIndex)
-
-
-
Constructor Detail
-
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:
java.lang.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 Detail
-
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'
-
-