| 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.app.beauti.alignmentviewer; |
| 27 |
|
| 28 |
import jebl.evolution.sequences.Nucleotides; |
| 29 |
|
| 30 |
import java.awt.*; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public class NucleotideDecorator implements StateDecorator { |
| 37 |
|
| 38 |
public static final NucleotideDecorator INSTANCE = new NucleotideDecorator(); |
| 39 |
|
| 40 |
Paint[] paints = new Paint[Nucleotides.getStateCount()]; |
| 41 |
|
| 42 |
public NucleotideDecorator() { |
| 43 |
paints[Nucleotides.A_STATE.getIndex()] = Color.RED; |
| 44 |
paints[Nucleotides.C_STATE.getIndex()] = Color.BLUE; |
| 45 |
paints[Nucleotides.G_STATE.getIndex()] = Color.BLACK; |
| 46 |
paints[Nucleotides.T_STATE.getIndex()] = Color.GREEN; |
| 47 |
paints[Nucleotides.R_STATE.getIndex()] = Color.MAGENTA; |
| 48 |
paints[Nucleotides.Y_STATE.getIndex()] = Color.DARK_GRAY; |
| 49 |
paints[Nucleotides.M_STATE.getIndex()] = Color.DARK_GRAY; |
| 50 |
paints[Nucleotides.W_STATE.getIndex()] = Color.DARK_GRAY; |
| 51 |
paints[Nucleotides.S_STATE.getIndex()] = Color.DARK_GRAY; |
| 52 |
paints[Nucleotides.K_STATE.getIndex()] = Color.DARK_GRAY; |
| 53 |
paints[Nucleotides.B_STATE.getIndex()] = Color.DARK_GRAY; |
| 54 |
paints[Nucleotides.D_STATE.getIndex()] = Color.DARK_GRAY; |
| 55 |
paints[Nucleotides.H_STATE.getIndex()] = Color.DARK_GRAY; |
| 56 |
paints[Nucleotides.V_STATE.getIndex()] = Color.DARK_GRAY; |
| 57 |
paints[Nucleotides.N_STATE.getIndex()] = Color.GRAY; |
| 58 |
paints[Nucleotides.UNKNOWN_STATE.getIndex()] = Color.GRAY; |
| 59 |
paints[Nucleotides.GAP_STATE.getIndex()] = Color.GRAY; |
| 60 |
} |
| 61 |
|
| 62 |
public Paint getStatePaint(int stateIndex) { |
| 63 |
if (stateIndex >= paints.length) { |
| 64 |
return paints[paints.length - 1]; |
| 65 |
} |
| 66 |
return paints[stateIndex]; |
| 67 |
} |
| 68 |
} |