Package pal.datatype
Class Nucleotides
- java.lang.Object
-
- pal.datatype.SimpleDataType
-
- pal.datatype.Nucleotides
-
- All Implemented Interfaces:
java.io.Serializable
,DataType
,MolecularDataType
public class Nucleotides extends SimpleDataType implements MolecularDataType
implements DataType for nucleotides- Version:
- $Id: Nucleotides.java,v 1.20 2004/09/13 05:20:47 matt Exp $
- Author:
- Korbinian Strimmer, 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 int
A_STATE
static int
C_STATE
static Nucleotides
DEFAULT_INSTANCE
static int
G_STATE
static int
UT_STATE
-
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, NUCLEOTIDES, 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 Nucleotides()
Nucleotides(boolean isRNA)
If isRNA is true than getChar(state) will return a U instead of a T
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
complementSequence(int[] sequence)
Complement of a sequence of nucleotides (or IUPACNucleotides - but IUPAC ness is lost)protected char
getCharImpl(int state)
Get character corresponding to a given statestatic int
getComplementState(int baseState)
Obtain the complement statejava.lang.String
getDescription()
description of data typeint[]
getMolecularStatesFromIUPACNucleotides(int[] nucleotideStates, int startingIndex)
int[]
getMolecularStatesFromSimpleNucleotides(int[] nucleotideStates, int startingIndex)
int
getNucleotideLength()
int[]
getNucleotideStates(int[] residueStates)
int
getNumStates()
get number of unique statesint
getRelavantLength(int numberOfStates)
static int[]
getSequenceComplement(int[] sequence)
Obtain the complement of a sequence of nucleotides (or IUPACNucleotides - but IUPAC ness is lost)protected int
getStateImpl(char c)
Get state corresponding to character c
NOTE: IF YOU CHANGE THIS IT MAY STOP THE NUCLEOTIDE TRANSLATOR FROM WORKING! - It relies on the fact that all the states for 'ACGTU' are between [0, 3]int
getTypeID()
get numerical code describing the data typeboolean
isCreatesIUPACNuecleotides()
boolean
isTransitionByChar(char firstChar, char secondChar)
boolean
isTransitionByState(int firstState, int secondState)
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
-
A_STATE
public static final int A_STATE
- See Also:
- Constant Field Values
-
C_STATE
public static final int C_STATE
- See Also:
- Constant Field Values
-
G_STATE
public static final int G_STATE
- See Also:
- Constant Field Values
-
UT_STATE
public static final int UT_STATE
- See Also:
- Constant Field Values
-
DEFAULT_INSTANCE
public static final Nucleotides 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
-
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
- Returns:
- true if this state is an unknown state
-
getStateImpl
protected int getStateImpl(char c)
Get state corresponding to character c
NOTE: IF YOU CHANGE THIS IT MAY STOP THE NUCLEOTIDE TRANSLATOR FROM WORKING! - It relies on the fact that all the states for 'ACGTU' are between [0, 3]- 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:
- a string describing the data type
-
getTypeID
public int getTypeID()
Description copied from interface:DataType
get numerical code describing the data type
-
isTransitionByState
public final boolean isTransitionByState(int firstState, int secondState)
- Returns:
- true if A->G, G->A, C->T, or T->C if firstState equals secondState returns FALSE!
-
isTransitionByChar
public final boolean isTransitionByChar(char firstChar, char secondChar)
- Returns:
- true if A->G, G->A, C->T, or T->C if firstState equals secondState returns FALSE! (I've renamed things to avoid confusion between java typing of ints and chars)
-
getNucleotideStates
public int[] getNucleotideStates(int[] residueStates)
- Specified by:
getNucleotideStates
in interfaceMolecularDataType
- Parameters:
residueStates
- an array of states corresponding to states ofthis datatype- Returns:
- a copy of the input
-
getRelavantLength
public int getRelavantLength(int numberOfStates)
- Returns:
- the input
-
getMolecularStatesFromSimpleNucleotides
public int[] getMolecularStatesFromSimpleNucleotides(int[] nucleotideStates, int startingIndex)
- Specified by:
getMolecularStatesFromSimpleNucleotides
in interfaceMolecularDataType
- Returns:
- a copy of the input
-
getMolecularStatesFromIUPACNucleotides
public int[] getMolecularStatesFromIUPACNucleotides(int[] nucleotideStates, int startingIndex)
- Specified by:
getMolecularStatesFromIUPACNucleotides
in interfaceMolecularDataType
- Returns:
- a copy of the input
-
isCreatesIUPACNuecleotides
public boolean isCreatesIUPACNuecleotides()
- Specified by:
isCreatesIUPACNuecleotides
in interfaceMolecularDataType
- Returns:
- false Nucleotide data will suffice
-
getNucleotideLength
public final int getNucleotideLength()
- Specified by:
getNucleotideLength
in interfaceMolecularDataType
- Returns:
- 1
-
getComplementState
public static final int getComplementState(int baseState)
Obtain the complement state- Parameters:
baseState
- the base state to complement (may be IUPAC but IUPACness is lost)- Returns:
- the complement state
-
getSequenceComplement
public static final int[] getSequenceComplement(int[] sequence)
Obtain the complement of a sequence of nucleotides (or IUPACNucleotides - but IUPAC ness is lost)- Parameters:
sequence
- the sequence (of nucleotide states)- Returns:
- the complement
-
complementSequence
public static final void complementSequence(int[] sequence)
Complement of a sequence of nucleotides (or IUPACNucleotides - but IUPAC ness is lost)- Parameters:
sequence
- the sequence (of nucleotide states) (is modified)
-
-