Package pal.datatype
Class Codons
- java.lang.Object
-
- pal.datatype.SimpleDataType
-
- pal.datatype.Codons
-
- All Implemented Interfaces:
java.io.Serializable
,DataType
,MolecularDataType
public class Codons extends SimpleDataType implements MolecularDataType
implements DataType for all Codons (including terminators). Characters are defined as 'A-Z' followed by 'a-z' followed by '0-9' followed by '@' and '%' Now incorporates the ungeneral code from GeneralizedCodons (which has died due to it's limited use)- Version:
- $Id: Codons.java,v 1.21 2004/03/10 04:42:54 matt Exp $
- Author:
- Matthew Goode, Alexei Drummond
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pal.datatype.DataType
DataType.Utils
-
Nested classes/interfaces inherited from interface pal.datatype.MolecularDataType
MolecularDataType.Utils
-
-
Field Summary
Fields Modifier and Type Field Description static Codons
DEFAULT_INSTANCE
-
Fields inherited from interface pal.datatype.DataType
AMINO_ACID_DESCRIPTION, AMINOACIDS, CODON_DESCRIPTION, CODONS, GAP_BALANCED, GAP_BALANCED_DESCRIPTION, IUPAC_NUCELOTIDES_DESCRIPTION, IUPACNUCLEOTIDES, NUCLEOTIDE_DESCRIPTION, NUMERIC, PRIMARY_SUGGESTED_GAP_CHARACTER, SUGGESTED_GAP_CHARACTERS, SUGGESTED_GAP_STATE, SUGGESTED_UNKNOWN_STATE, TWO_STATE_DESCRIPTION, TWOSTATES, UNKNOWN, UNKNOWN_CHARACTER, UNKNOWN_TLA
-
-
Constructor Summary
Constructors Constructor Description Codons()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected char
getCharImpl(int state)
Get character corresponding to a given statestatic int
getCodonIndexFromIUPACNucleotideStates(int[] codon)
The codon index is a number between 0 and 64 assigned to each different codon typestatic int
getCodonIndexFromIUPACNucleotideStates(int[] codon, int startingPosition)
The codon index is a number between 0 and 64 assigned to each different codon typestatic int
getCodonIndexFromNucleotides(char[] codon)
The codon index is a number between 0 and 64 assigned to each different codon typestatic int
getCodonIndexFromNucleotideStates(int[] codon)
The codon index is a number between 0 and 64 assigned to each different codon typestatic int
getCodonIndexFromNucleotideStates(int[] codon, int startingPosition)
The codon index is a number between 0 and 64 assigned to each different codon typejava.lang.String
getDescription()
description of data typestatic double[]
getF1X4CodonFrequencies(double[] nucleotideFrequencies)
static double[]
getF3X4CodonFrequencies(double[][] nucleotideTripletFrequencies)
int[]
getMolecularStatesFromIUPACNucleotides(int[] nucleotideStates, int startingIndex)
int[]
getMolecularStatesFromSimpleNucleotides(int[] nucleotideStates, int startingIndex)
int
getNucleotideLength()
static char[]
getNucleotidesFromCodonIndex(int index)
Translates an index into a codonint[]
getNucleotideStates(int[] residueStates)
static int[]
getNucleotideStatesFromCodonIndex(int codonIndex)
Translates an index into a codonint
getNumStates()
get number of unique statesint
getStateImpl(char c)
For sub classes to implement main functionality of getState.static java.lang.String
getTLA(int state)
int
getTypeID()
get numerical code describing the data typeboolean
isCreatesIUPACNuecleotides()
protected boolean
isUnknownStateImpl(int state)
For subclasses to handle, without regard for gaps-
Methods inherited from class pal.datatype.SimpleDataType
getAmbiguousVersion, getChar, getPreferredChar, getPreferredCharImpl, getRecommendedGapState, getRecommendedUnknownState, getState, hasGap, isAmbiguous, isGapChar, isGapState, isUnknownChar, isUnknownState, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface pal.datatype.DataType
getAmbiguousVersion, getChar, getPreferredChar, getRecommendedGapState, getRecommendedUnknownState, getState, hasGap, isAmbiguous, isGapChar, isGapState, isUnknownChar, isUnknownState
-
-
-
-
Field Detail
-
DEFAULT_INSTANCE
public static final Codons DEFAULT_INSTANCE
-
-
Method Detail
-
getNumStates
public int getNumStates()
Description copied from interface:DataType
get number of unique states- Specified by:
getNumStates
in interfaceDataType
- Returns:
- number of unique states
-
getStateImpl
public int getStateImpl(char c)
Description copied from class:SimpleDataType
For sub classes to implement main functionality of getState. Gaps do not need to be considered- Specified by:
getStateImpl
in classSimpleDataType
-
getCharImpl
protected char getCharImpl(int state)
Get character corresponding to a given state- Specified by:
getCharImpl
in classSimpleDataType
-
getDescription
public java.lang.String getDescription()
Description copied from interface:DataType
description of data type- Specified by:
getDescription
in interfaceDataType
- Returns:
- string describing the data type
-
isUnknownStateImpl
protected final boolean isUnknownStateImpl(int state)
Description copied from class:SimpleDataType
For subclasses to handle, without regard for gaps- Specified by:
isUnknownStateImpl
in classSimpleDataType
-
getTypeID
public int getTypeID()
Description copied from interface:DataType
get numerical code describing the data type
-
getNucleotideStates
public int[] getNucleotideStates(int[] residueStates)
- Specified by:
getNucleotideStates
in interfaceMolecularDataType
- Parameters:
residue
- states an array of states corresponding to states ofthis datatype- Returns:
- the corresponding IUPAC states
-
getMolecularStatesFromIUPACNucleotides
public final int[] getMolecularStatesFromIUPACNucleotides(int[] nucleotideStates, int startingIndex)
- Specified by:
getMolecularStatesFromIUPACNucleotides
in interfaceMolecularDataType
-
getMolecularStatesFromSimpleNucleotides
public final int[] getMolecularStatesFromSimpleNucleotides(int[] nucleotideStates, int startingIndex)
- Specified by:
getMolecularStatesFromSimpleNucleotides
in interfaceMolecularDataType
- Returns:
-
isCreatesIUPACNuecleotides
public boolean isCreatesIUPACNuecleotides()
- Specified by:
isCreatesIUPACNuecleotides
in interfaceMolecularDataType
- Returns:
- false
-
getNucleotideLength
public final int getNucleotideLength()
- Specified by:
getNucleotideLength
in interfaceMolecularDataType
- Returns:
- 3
-
getTLA
public static final java.lang.String getTLA(int state)
- Returns:
- a three letter acronym for an AminoAcid, according to state
-
getCodonIndexFromNucleotides
public static final int getCodonIndexFromNucleotides(char[] codon)
The codon index is a number between 0 and 64 assigned to each different codon type- Parameters:
codon
- a 3 element array of characters which contain Nucleotide characters- Returns:
- -1 if the codon has unknowns, or gaps in it, or is length is less than 3
-
getCodonIndexFromNucleotideStates
public static final int getCodonIndexFromNucleotideStates(int[] codon)
The codon index is a number between 0 and 64 assigned to each different codon type- Parameters:
codon
- a 3 element array of characters which contain Nucleotide states- Returns:
- -1 if the codon has unknowns, or gaps in it, or is length is less than 3
-
getCodonIndexFromNucleotideStates
public static final int getCodonIndexFromNucleotideStates(int[] codon, int startingPosition)
The codon index is a number between 0 and 64 assigned to each different codon type- Parameters:
codon
- a 3 element array of characters which contain Nucleotide statesstartingPosition
- an offset into the array to start examining- Returns:
- -1 if the codon has unknowns, or gaps in it, or is length is less than 3
-
getCodonIndexFromIUPACNucleotideStates
public static final int getCodonIndexFromIUPACNucleotideStates(int[] codon)
The codon index is a number between 0 and 64 assigned to each different codon type- Parameters:
codon
- a 3 element array of characters which contain Nucleotide statesstartingPosition
- an offset into the array to start examining- Returns:
- -1 if the codon has unknowns, or gaps in it, or is length is less than 3
-
getCodonIndexFromIUPACNucleotideStates
public static final int getCodonIndexFromIUPACNucleotideStates(int[] codon, int startingPosition)
The codon index is a number between 0 and 64 assigned to each different codon type- Parameters:
codon
- a 3 element array of characters which contain Nucleotide statesstartingPosition
- an offset into the array to start examining- Returns:
- -1 if the codon has unknowns, or gaps in it, or is length is less than 3
-
getNucleotidesFromCodonIndex
public static final char[] getNucleotidesFromCodonIndex(int index)
Translates an index into a codon- Parameters:
index
- the codon index- Returns:
- a char array contain 3 nucleotide characters
-
getNucleotideStatesFromCodonIndex
public static final int[] getNucleotideStatesFromCodonIndex(int codonIndex)
Translates an index into a codon- Parameters:
index
- the codon index- Returns:
- an int array contain 3 nucleotide states
-
getF1X4CodonFrequencies
public static final double[] getF1X4CodonFrequencies(double[] nucleotideFrequencies)
-
getF3X4CodonFrequencies
public static final double[] getF3X4CodonFrequencies(double[][] nucleotideTripletFrequencies)
-
-