| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.evolution.datatype; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public class HiddenCodons extends Codons implements HiddenDataType { |
| 32 |
|
| 33 |
public static final String DESCRIPTION = "hiddenCodon"; |
| 34 |
|
| 35 |
public static final HiddenCodons UNIVERSAL_HIDDEN_2 = new HiddenCodons(GeneticCode.UNIVERSAL,2); |
| 36 |
public static final HiddenCodons UNIVERSAL_HIDDEN_3 = new HiddenCodons(GeneticCode.UNIVERSAL,3); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
private HiddenCodons(GeneticCode geneticCode, int hiddenClassCount) { |
| 42 |
super(geneticCode); |
| 43 |
this.hiddenClassCount = hiddenClassCount; |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
public boolean[] getStateSet(int state) { |
| 50 |
|
| 51 |
boolean[] stateSet = new boolean[stateCount*hiddenClassCount]; |
| 52 |
|
| 53 |
if (!isAmbiguousState(state)) { |
| 54 |
for(int h=0; h<hiddenClassCount; h++) |
| 55 |
stateSet[h*stateCount + state] = true; |
| 56 |
} else { |
| 57 |
for (int i = 0; i < stateCount; i++) { |
| 58 |
stateSet[i] = true; |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
return stateSet; |
| 63 |
} |
| 64 |
|
| 65 |
public int getStateCount() { |
| 66 |
return stateCount*hiddenClassCount; |
| 67 |
} |
| 68 |
|
| 69 |
private int hiddenClassCount; |
| 70 |
|
| 71 |
public int getHiddenClassCount() { |
| 72 |
return hiddenClassCount; |
| 73 |
} |
| 74 |
} |