|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uconn.mcb.lineageevolver.AATranslator
Serves as a translator between AminoAcid naming schemes.
Nested Class Summary | |
static class |
AATranslator.InvalidAminoAcid
Base class for exceptions generated during amino acid encoding/decoding. |
Field Summary | |
private static char[] |
_intToChar
Provides mapping between char and int encodings for AminoAcids. |
Constructor Summary | |
AATranslator()
|
Method Summary | |
static byte |
getByte(char aa)
Returns the byte encoding for the AminoAcid encoded by the provided character. |
static byte |
getByte(int aa)
Returns the byte encoding for the AminoAcid encoded by the provided integer. |
static char |
getChar(byte aa)
Returns the character encoding for the AminoAcid encoded by the provided byte. |
static char |
getChar(int aa)
Returns the character encoding for the AminoAcid encoded by the provided integer. |
static int |
getInt(byte aa)
Returns the integer encoding for the AminoAcid encoded by the provided byte. |
static int |
getInt(char aa)
Returns the integer encoding for the AminoAcid encoded by the provided character. |
static void |
sanityCheck(byte aa)
Checks if a byte encodes for a given amino acid. |
static void |
sanityCheck(char aa)
Checks if a character encodes for a given amino acid. |
static void |
sanityCheck(int aa)
Checks if an integer encodes for a given amino acid. |
private static byte |
toByte(char aa)
Returns the byte representation of a given char , without error checking. |
private static byte |
toByte(int aa)
Converts an int AminoAcid encoding to its corresponding byte encoding, without error checking. |
private static char |
toChar(byte aa)
Returns the char representation of a given byte , without error checking. |
private static char |
toChar(int aa)
Converts an int AminoAcid encoding to its corresponding char encoding, without error checking. |
private static int |
toInt(byte aa)
Converts a byte AminoAcid encoding to its corresponding int encoding, without error checking. |
private static int |
toInt(char aa)
Converts a char AminoAcid encoding to its corresponding int encoding, without error checking. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final char[] _intToChar
char
and int
encodings for AminoAcids.
Constructor Detail |
public AATranslator()
Method Detail |
private static int toInt(char aa)
char
AminoAcid encoding to its corresponding int
encoding, without error checking.
Uses a simple switch statement.
aa
- the char
encoding for a given AminoAcid. Should be upper-case, as always.
int
encoding corresponding to the AminoAcid encoded by the provided char
, or -1
if there was a decoding error.private static int toInt(byte aa)
byte
AminoAcid encoding to its corresponding int
encoding, without error checking.
Delegates to toInt(char)
via toChar(byte)
.
aa
- the byte
encoding for a given AminoAcid.
int
encoding corresponding to the AminoAcid encoded by the provided byte
, or -1
if there was a decoding error.toChar(byte)
,
toInt(char)
private static char toChar(int aa) throws java.lang.ArrayIndexOutOfBoundsException
int
AminoAcid encoding to its corresponding char
encoding, without error checking.
Uses the _intToChar
array.
aa
- the int
encoding for a given AminoAcid.
char
encoding corresponding to the AminoAcid encoded by the provided byte
.
java.lang.ArrayIndexOutOfBoundsException
- if the provided integer is < 0 or > 19._intToChar
private static char toChar(byte aa)
char
representation of a given byte
, without error checking.
Uses a simple cast.
aa
- any byte
.
char
representation of the given byte
.private static byte toByte(int aa)
int
AminoAcid encoding to its corresponding byte
encoding, without error checking.
Delegates to toByte(char)
via toChar(int)
.
aa
- the int
encoding for a given AminoAcid.
byte
encoding corresponding to the AminoAcid encoded by the provided int
.toChar(int)
,
toByte(char)
private static byte toByte(char aa)
byte
representation of a given char
, without error checking.
Uses a simple cast.
aa
- any char
.
byte
representation of the given char
.public static void sanityCheck(int aa) throws AATranslator.InvalidAminoAcid
aa
- the integer to check.
AATranslator.InvalidAminoAcid
- If the integer does not correctly encode an AminoAcid.public static void sanityCheck(byte aa) throws AATranslator.InvalidAminoAcid
aa
- the byte to check.
AATranslator.InvalidAminoAcid
- If the byte does not correctly encode an AminoAcid.toChar(byte)
,
sanityCheck(char)
public static void sanityCheck(char aa) throws AATranslator.InvalidAminoAcid
toInt(char)
method.
aa
- the character to check.
AATranslator.InvalidAminoAcid
- If the character does not correctly encode an AminoAcid.toInt(char)
public static char getChar(int aa)
aa
- the integer encoding of an AminoAcid.
aa
parameter.public static int getInt(char aa)
aa
- the character encoding of an AminoAcid.
aa
parameter.public static byte getByte(int aa)
aa
- the integer encoding of an AminoAcid.
aa
parameter.public static int getInt(byte aa)
aa
- the byte encoding of an AminoAcid.
aa
parameter.public static char getChar(byte aa)
aa
- the byte encoding of an AminoAcid.
aa
parameter.public static byte getByte(char aa)
aa
- the character encoding of an AminoAcid.
aa
parameter.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |