public class Alphabet
extends java.lang.Object
If you need to add a new static Alphabet object to this class, there are some comments in the source code to help you out. (Look for "HOW TO ADD AN ALPHABET".) The internal representation of this class is a bit awkward in order to make the methods as fast as possible.
Note: ALF_SUPERSETS is only defined for a, c, g, and t because that's how it was in version2. This should eventually get changed.
Modifier and Type | Field and Description |
---|---|
private static int |
_N |
private static int |
A |
static Alphabet |
ACGTRY |
private static char[] |
ACGTRY_ARRAY |
private static int[] |
ACGTRY_BIN_ARRAY |
private static int[] |
ACGTRY_BIN_INDICES |
private static char[] |
ACGTRY_COMPLEMENT |
private static java.lang.String[] |
ACGTRY_EXPANSION |
private static int |
ACGTRY_ID |
private static int[] |
ACGTRY_INDICES |
private static java.lang.String[] |
ACGTRY_SUPERSETS |
private static char[][] |
ALF_ARRAY |
private static int[][] |
ALF_BIN_ARRAY |
private static int[][] |
ALF_BIN_INDICES |
private static char[][] |
ALF_COMPLEMENT |
private static java.lang.String[][] |
ALF_EXPANSION |
private static int[][] |
ALF_INDICES |
private static java.lang.String[][] |
ALF_SUPERSETS |
private int |
alfID |
private static int |
B |
private static int |
C |
private static int |
D |
static Alphabet |
DEFAULT
The default full alphabet.
|
static Alphabet |
DEFAULT_PRIMARY
The default primary alphabet-- useful if we ever wanted to use RNA or nucleic acid alphabets.
|
static char |
FILLER
For filling space in biological sequences so that breaks come at regular intervals in the string.
|
static Alphabet |
FULL |
private static char[] |
FULL_ARRAY |
private static int[] |
FULL_BIN_ARRAY |
private static int[] |
FULL_BIN_INDICES |
private static char[] |
FULL_COMPLEMENT |
private static java.lang.String[] |
FULL_EXPANSION |
private static int |
FULL_ID |
private static int[] |
FULL_INDICES |
private static java.lang.String[] |
FULL_SUPERSETS |
private static int |
G |
private static int |
H |
private static int |
K |
private static int |
M |
static java.lang.String |
MOTIF_SEPARATOR |
static char |
N
For representing unknown bases.
|
static java.lang.String[] |
N_STRING
N_STRING[i] is a string of i
N 's. |
static char |
NO_VALID_BASE |
static Alphabet |
PRIMARY |
private static char[] |
PRIMARY_ARRAY |
private static int[] |
PRIMARY_BIN_ARRAY |
private static int[] |
PRIMARY_BIN_INDICES |
private static char[] |
PRIMARY_COMPLEMENT |
private static java.lang.String[] |
PRIMARY_EXPANSION |
private static int |
PRIMARY_ID |
private static int[] |
PRIMARY_INDICES |
private static java.lang.String[] |
PRIMARY_SUPERSETS |
private static int |
R |
private static int |
S |
static char |
SEQUENCE_BREAK
For marking breaks in biological sequences.
|
private static int |
T |
private static int |
V |
private static int |
W |
private static int |
Y |
Modifier | Constructor and Description |
---|---|
private |
Alphabet(int alphabetID)
Creates an alphabet object for the specified alphabet; alphabetID should be set to one of the
Alphabet.*_ID
constants. |
Modifier and Type | Method and Description |
---|---|
boolean |
areEquivalent(char c1,
char c2)
Returns true if one of the chars is a subset of the other.
|
private int |
binIndexOf(int i) |
private int |
binValOf(char c) |
char |
complementOf(char c) |
char |
compressToChar(java.lang.String s)
Returns the char that represents the given string of primary bases; the inverse of
expansionOf(char) . |
char[] |
expansionOf(char c)
Returns the set of primary bases in c.
|
java.lang.String |
getCharacters() |
char[] |
getChars() |
char |
getRandomChar() |
char |
getRandomChar(double p)
Returns a random char from the alphabet, where p is the probability that one of the standard 4 bases will be returned.
|
int |
indexOf(char c)
Returns the index of c in the array returned by
getChars() . |
char |
intersectionOf(char c1,
char c2)
Returns the char representing the set of bases that is the intersection of c1 and c2.
|
char |
inverseOf(char c)
Returns the char that represents the bases that aren't in c.
|
boolean |
isAmbiguous(char c) |
static boolean |
isN(char c)
Returns true if c is the
N character. |
char[] |
supersetsOf(char c)
Returns the set of letters that contain all of the primary bases in c.
|
java.lang.String |
toString() |
char |
unionOf(char c1,
char c2)
Returns the char representing the set of bases that is the union of c1 and c2.
|
public static final char N
public static final java.lang.String[] N_STRING
N
's.public static final char NO_VALID_BASE
public static final char SEQUENCE_BREAK
public static final char FILLER
public static final java.lang.String MOTIF_SEPARATOR
private static final int FULL_ID
private static final int PRIMARY_ID
private static final int ACGTRY_ID
public static final Alphabet FULL
public static final Alphabet PRIMARY
public static final Alphabet ACGTRY
public static final Alphabet DEFAULT
public static final Alphabet DEFAULT_PRIMARY
private static final int A
private static final int C
private static final int G
private static final int T
private static final int M
private static final int R
private static final int W
private static final int S
private static final int Y
private static final int K
private static final int V
private static final int H
private static final int D
private static final int B
private static final int _N
private static final char[] FULL_ARRAY
private static final int[] FULL_INDICES
private static final int[] FULL_BIN_ARRAY
private static final int[] FULL_BIN_INDICES
private static final char[] FULL_COMPLEMENT
private static final java.lang.String[] FULL_EXPANSION
private static final java.lang.String[] FULL_SUPERSETS
private static final char[] PRIMARY_ARRAY
private static final int[] PRIMARY_INDICES
private static final int[] PRIMARY_BIN_ARRAY
private static final int[] PRIMARY_BIN_INDICES
private static final char[] PRIMARY_COMPLEMENT
private static final java.lang.String[] PRIMARY_EXPANSION
private static final java.lang.String[] PRIMARY_SUPERSETS
private static final char[] ACGTRY_ARRAY
private static final int[] ACGTRY_INDICES
private static final int[] ACGTRY_BIN_ARRAY
private static final int[] ACGTRY_BIN_INDICES
private static final char[] ACGTRY_COMPLEMENT
private static final java.lang.String[] ACGTRY_EXPANSION
private static final java.lang.String[] ACGTRY_SUPERSETS
private static final char[][] ALF_ARRAY
private static final int[][] ALF_INDICES
private static final int[][] ALF_BIN_ARRAY
private static final int[][] ALF_BIN_INDICES
private static final char[][] ALF_COMPLEMENT
private static final java.lang.String[][] ALF_EXPANSION
private static final java.lang.String[][] ALF_SUPERSETS
private final int alfID
private Alphabet(int alphabetID)
Alphabet.*_ID
constants.public static boolean isN(char c)
N
character.public boolean areEquivalent(char c1, char c2)
private int binIndexOf(int i)
private int binValOf(char c)
public char complementOf(char c)
public char compressToChar(java.lang.String s)
expansionOf(char)
.public char[] expansionOf(char c)
public java.lang.String getCharacters()
public char[] getChars()
public char getRandomChar()
public char getRandomChar(double p)
public int indexOf(char c)
getChars()
.{@link
- edu.dartmouth.bglab.motif.UnknownBaseException} (a RuntimeException) if the base is not in the alphabet.public char intersectionOf(char c1, char c2)
NO_VALID_BASE
if the intersection is the empty set.public char inverseOf(char c)
public boolean isAmbiguous(char c)
public char[] supersetsOf(char c)
public java.lang.String toString()
toString
in class java.lang.Object
public char unionOf(char c1, char c2)