- private Color getResidueColour(SequenceGroup[] allGroups,
- final SequenceI seq, int position,
- FeatureColourFinder finder)
- {
- Color col = getResidueBoxColour(allGroups, seq, position);
-
- if (finder != null)
- {
- col = finder.findFeatureColour(col, seq, position);
- }
- return col;
- }
-
- protected Color getResidueBoxColour(SequenceGroup[] allGroups,
- SequenceI seq, int i)
- {
-
- ResidueShaderI currentShader;
-
- SequenceGroup currentSequenceGroup = inCurrentSequenceGroup(allGroups,
- i);
- if (currentSequenceGroup != null)
- {
- currentShader = currentSequenceGroup.getGroupColourScheme();
- }
- else
- {
- currentShader = shader;
- }
-
- return getBoxColour(currentShader, seq, i);
- }
-
- SequenceGroup inCurrentSequenceGroup(SequenceGroup[] allGroups, int res)
- {
- if (allGroups == null)
- {
- return null;
- }
-
- for (int i = 0; i < allGroups.length; i++)
- {
- if ((allGroups[i].getStartRes() <= res)
- && (allGroups[i].getEndRes() >= res))
- {
- return (allGroups[i]);
- }
- }
-
- return null;
- }
-
- Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
- {
- Color resBoxColour = Color.white;
- char currentChar = seq.getCharAt(i);
-
- if (shader.getColourScheme() != null)
- {
- if (Comparison.isGap(currentChar)
- && !shader.getColourScheme().hasGapColour())
- {
- resBoxColour = Color.lightGray;
- }
- else
- {
- resBoxColour = shader.findColour(currentChar, i, seq);
- }
- }
- else if (Comparison.isGap(currentChar))
- {
- resBoxColour = Color.lightGray;
- }
-
- return resBoxColour;
- }
-