Package pal.datatype
Interface DataType
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
AmbiguousDataType
,MolecularDataType
- All Known Implementing Classes:
AminoAcids
,Codons
,GapBalanced
,IUPACNucleotides
,Nucleotides
,NumericDataType
,SimpleDataType
,SpecificAminoAcids
,StateRemover
,TwoStates
interface for sequence data types
History: 21 March 2003, Added gap stuff, to counter frustration and not being
able to differentiat unknowns from gaps. Gap characters should still be treated
as unknowns (for compatibility), but a data type should be able to identify
a gap from other unknowns.
- Version:
- $Id: DataType.java,v 1.24 2004/10/14 02:01:43 matt Exp $
- Author:
- Korbinian Strimmer, Alexei Drummond
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
Some useful methods for implmenting classes and for DataType users -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
amino acid name (for XML and human readability)static final int
static final String
codon name (for XML and human readability)static final int
static final int
static final String
generalized codon name (for XML and human readability)static final String
iupac nucleotide name (for XML and human readability)static final int
static final String
Name of nucleotide data type.static final int
static final int
static final char
A suggested Gap characterstatic final char[]
static final int
The gap state that should generally be used (-2), though the DataType specification makes no requirement that this be the gap statestatic final int
The gap state that should generally be used (-1).static final String
two state name (for XML and human readability)static final int
static final int
static final char
static final String
-
Method Summary
Modifier and TypeMethodDescriptionchar
getChar
(int state) get character corresponding to a given statedescription of data typeint
get number of unique stateschar
getPreferredChar
(char c) get the preferred version of a particular character (eg a -> A) Should not always assume that a DataType only uses Upper case characters!int
int
int
getState
(char c) get state corresponding to a characterint
get numerical code describing the data typeboolean
hasGap()
boolean
boolean
isGapChar
(char c) boolean
isGapState
(int state) boolean
isUnknownChar
(char c) boolean
isUnknownState
(int state)
-
Field Details
-
UNKNOWN_CHARACTER
static final char UNKNOWN_CHARACTER- See Also:
-
UNKNOWN_TLA
- See Also:
-
PRIMARY_SUGGESTED_GAP_CHARACTER
static final char PRIMARY_SUGGESTED_GAP_CHARACTERA suggested Gap character- See Also:
-
SUGGESTED_GAP_CHARACTERS
static final char[] SUGGESTED_GAP_CHARACTERS -
SUGGESTED_GAP_STATE
static final int SUGGESTED_GAP_STATEThe gap state that should generally be used (-2), though the DataType specification makes no requirement that this be the gap state- See Also:
-
SUGGESTED_UNKNOWN_STATE
static final int SUGGESTED_UNKNOWN_STATEThe gap state that should generally be used (-1). Though in general, the unknown state is defined to be anystate that isn't a gap state or a normal state (which makes sense) though the DataType specification makes no requirement that this be the unknown state- See Also:
-
NUCLEOTIDES
static final int NUCLEOTIDES- See Also:
-
AMINOACIDS
static final int AMINOACIDS- See Also:
-
TWOSTATES
static final int TWOSTATES- See Also:
-
IUPACNUCLEOTIDES
static final int IUPACNUCLEOTIDES- See Also:
-
CODONS
static final int CODONS- See Also:
-
GAP_BALANCED
static final int GAP_BALANCED- See Also:
-
NUMERIC
static final int NUMERIC- See Also:
-
UNKNOWN
static final int UNKNOWN- See Also:
-
NUCLEOTIDE_DESCRIPTION
Name of nucleotide data type. For XML and human reading of data type. You should do it yourself :-).- See Also:
-
AMINO_ACID_DESCRIPTION
amino acid name (for XML and human readability)- See Also:
-
TWO_STATE_DESCRIPTION
two state name (for XML and human readability)- See Also:
-
IUPAC_NUCELOTIDES_DESCRIPTION
iupac nucleotide name (for XML and human readability)- See Also:
-
CODON_DESCRIPTION
codon name (for XML and human readability)- See Also:
-
GAP_BALANCED_DESCRIPTION
generalized codon name (for XML and human readability)- See Also:
-
-
Method Details
-
getNumStates
int getNumStates()get number of unique states- Returns:
- number of unique states
-
getState
int getState(char c) get state corresponding to a character- Parameters:
c
- character- Returns:
- state
-
getChar
char getChar(int state) get character corresponding to a given state- Parameters:
state
- state return corresponding character
-
getPreferredChar
char getPreferredChar(char c) get the preferred version of a particular character (eg a -> A) Should not always assume that a DataType only uses Upper case characters! -
getDescription
String getDescription()description of data type- Returns:
- string describing the data type
-
getTypeID
int getTypeID()get numerical code describing the data type- Returns:
- numerical code
-
isUnknownState
boolean isUnknownState(int state) - Returns:
- true if this state is an unknown state (the same as check if a state is >= the number of states... but neater)
-
isUnknownChar
boolean isUnknownChar(char c) - Returns:
- true if this character is a gap
-
getRecommendedUnknownState
int getRecommendedUnknownState() -
hasGap
boolean hasGap()- Returns:
- true if this data type supports having a gap character
-
isGapChar
boolean isGapChar(char c) - Returns:
- true if this data type interprets c as a gap
-
isGapState
boolean isGapState(int state) - Returns:
- true if this data type interprets state as a gap state
-
getRecommendedGapState
int getRecommendedGapState()- Returns:
- the recommended state to use as a gap
-
isAmbiguous
boolean isAmbiguous() -
getAmbiguousVersion
AmbiguousDataType getAmbiguousVersion()
-