Individual nucleotides including an unknown value.
| 35 | * Individual nucleotides including an unknown value. |
| 36 | */ |
| 37 | public abstract class DNA implements Residue, PseudoEnum { |
| 38 | //It is important that the ordinal of the unknown value be 0 (it is used in the hashing code). |
| 39 | //Do not modify unless you have really thought about it |
| 40 | /** Unknown. */ |
| 41 | public static final DNA N = new DNA(0, DNASimple.N) { |
| 42 | @Override |
| 43 | public boolean ignore() { |
| 44 | return true; |
| 45 | } |
| 46 | @Override |
| 47 | public DNA complement() { |
| 48 | return N; |
| 49 | } |
| 50 | }; |
| 51 | |
| 52 | /** adenine. */ |
| 53 | public static final DNA A = new DNA(1, DNASimple.A) { |
| 54 | @Override |
| 55 | public DNA complement() { |
| 56 | return T; |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | /** cytosine */ |
| 61 | public static final DNA C = new DNA(2, DNASimple.C) { |
| 62 | @Override |
| 63 | public DNA complement() { |
| 64 | return G; |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | /** guanine */ |
| 69 | public static final DNA G = new DNA(3, DNASimple.G) { |
| 70 | @Override |
| 71 | public DNA complement() { |
| 72 | return C; |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | /** thymine or in RNA uracil (no distinction is drawn here). */ |
| 77 | public static final DNA T = new DNA(4, DNASimple.T) { |
| 78 | @Override |
| 79 | public DNA complement() { |
| 80 | return A; |
| 81 | } |
| 82 | }; |
| 83 | |
| 84 | |
| 85 | private static final DNA[] VALUES = {N, A, C, G, T}; |
| 86 | |
| 87 | /** |
| 88 | * Record fast way of getting complements directly from codes. |
| 89 | */ |
| 90 | static final byte[] COMPLEMENT = new byte[DNA.values().length]; |
| 91 | static { |
| 92 | populateComplementArray(COMPLEMENT, DNA.values()); |
| 93 | } |
| 94 |
nothing calls this directly
no test coverage detected