if (pos > 0)
{
pos = sequence[s].findIndex(pos);
- tmp.startCol = sr.getResidueBoxColour(sequence[s], pos);
- if (showFeatures)
- {
- tmp.startCol = finder.findFeatureColour(tmp.startCol,
- sequence[s], pos);
- }
+ tmp.startCol = sr.getResidueColour(sequence[s], pos,
+ finder);
}
pos = mapping[m].getSeqPos(tmp.at2.resNumber) - 1;
if (pos > 0)
{
pos = sequence[s].findIndex(pos);
- tmp.endCol = sr.getResidueBoxColour(sequence[s], pos);
- if (showFeatures)
- {
- tmp.endCol = finder.findFeatureColour(tmp.endCol,
- sequence[s], pos);
- }
+ tmp.endCol = sr
+ .getResidueColour(sequence[s], pos, finder);
}
}
}
if (pos > 0)
{
pos = sequence[s].findIndex(pos);
- tmp.startCol = sr.getResidueBoxColour(sequence[s], pos);
- if (showFeatures)
- {
- tmp.startCol = finder.findFeatureColour(tmp.startCol,
- sequence[s], pos);
- }
+ tmp.startCol = sr.getResidueColour(sequence[s], pos,
+ finder);
}
pos = mapping[m].getSeqPos(tmp.at2.resNumber) - 1;
if (pos > 0)
{
pos = sequence[s].findIndex(pos);
- tmp.endCol = sr.getResidueBoxColour(sequence[s], pos);
- if (showFeatures)
- {
- tmp.endCol = finder.findFeatureColour(tmp.endCol,
- sequence[s], pos);
- }
+ tmp.endCol = sr
+ .getResidueColour(sequence[s], pos, finder);
}
}
public interface SequenceRenderer
{
- Color getResidueBoxColour(SequenceI sequenceI, int r);
-
Color getResidueColour(SequenceI seq, int position,
FeatureColourFinder finder);
if (seq.getLength() > lastcol)
{
- color = sr.getResidueBoxColour(seq, lastcol);
-
- if (av.isShowSequenceFeatures())
- {
- color = finder.findFeatureColour(color, seq, lastcol);
- }
+ color = sr.getResidueColour(seq, lastcol, finder);
}
else
{
- color = Color.white; // White
+ color = Color.white;
}
if (hiddenRow
this.renderGaps = renderGaps;
}
- @Override
- public Color getResidueBoxColour(SequenceI seq, int i)
+ protected Color getResidueBoxColour(SequenceI seq, int i)
{
allGroups = av.getAlignment().findAllGroups(seq);
lastPos = pos;
- Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
-
- if (fr != null)
- {
- col = finder
- .findFeatureColour(col, sequence[pdbfnum][s], r);
- }
+ Color col = sr.getResidueColour(sequence[pdbfnum][s], r,
+ finder);
/*
* shade hidden regions darker
public static String[] getColourBySequenceCommand(
StructureSelectionManager ssm, String[] files,
SequenceI[][] sequence, SequenceRenderer sr,
- FeatureColourFinder fr,
+ FeatureColourFinder finder,
AlignmentI alignment)
{
ArrayList<String> str = new ArrayList<String>();
lastPos = pos;
- Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
+ Color col = sr.getResidueColour(sequence[pdbfnum][s], r,
+ finder);
- if (fr != null)
- {
- col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);
- }
String newSelcom = (mapping[m].getChain() != " " ? ":"
+ mapping[m].getChain() : "")
+ "/"
if (seq.getLength() > lastcol)
{
- color = sr.getResidueBoxColour(seq, lastcol);
-
- if (av.isShowSequenceFeatures())
- {
- color = finder.findFeatureColour(color, seq, lastcol);
- }
+ color = sr.getResidueColour(seq, lastcol, finder);
}
else
{
boolean forOverview = false;
/**
- * Creates a new SequenceRenderer object.
+ * Creates a new SequenceRenderer object
*
- * @param av
- * DOCUMENT ME!
+ * @param viewport
*/
- public SequenceRenderer(AlignViewport av)
+ public SequenceRenderer(AlignViewport viewport)
{
- this.av = av;
+ this.av = viewport;
}
/**
this.renderGaps = renderGaps;
}
- @Override
- public Color getResidueBoxColour(SequenceI seq, int i)
+ protected Color getResidueBoxColour(SequenceI seq, int i)
{
// rate limiting step when rendering overview for lots of groups
allGroups = av.getAlignment().findAllGroups(seq);
public Color getResidueColour(final SequenceI seq, int position,
FeatureColourFinder finder)
{
- // TODO replace 8 or so code duplications with calls to this method
- // (refactored as needed)
Color col = getResidueBoxColour(seq, position);
if (finder != null)
av.setGlobalColourScheme(new ZappoColourScheme());
// @see ResidueProperties.zappo
- assertEquals(Color.pink, sr.getResidueColour(seq, 0, null)); // M
- assertEquals(Color.green, sr.getResidueColour(seq, 2, null)); // T
- assertEquals(Color.magenta, sr.getResidueColour(seq, 5, null)); // G
- assertEquals(Color.orange, sr.getResidueColour(seq, 12, null)); // F
+ assertEquals(Color.pink, sr.getResidueBoxColour(seq, 0)); // M
+ assertEquals(Color.green, sr.getResidueBoxColour(seq, 2)); // T
+ assertEquals(Color.magenta, sr.getResidueBoxColour(seq, 5)); // G
+ assertEquals(Color.orange, sr.getResidueBoxColour(seq, 12)); // F
}
// TODO more tests for getResidueBoxColour covering groups, feature rendering,
// gaps, overview...
* set and check Taylor colours
*/
af.changeColour_actionPerformed(JalviewColourScheme.Taylor.toString());
- Color taylor1 = sr.getResidueBoxColour(seq, 88); // E 255,0,102
- Color taylor2 = sr.getResidueBoxColour(seq, 89); // A 204,255,0
- Color taylor3 = sr.getResidueBoxColour(seq, 90); // G 255,153,0
+ Color taylor1 = sr.getResidueColour(seq, 88, null); // E 255,0,102
+ Color taylor2 = sr.getResidueColour(seq, 89, null); // A 204,255,0
+ Color taylor3 = sr.getResidueColour(seq, 90, null); // G 255,153,0
assertEquals(taylor1, new Color(255, 0, 102));
assertEquals(taylor2, new Color(204, 255, 0));
assertEquals(taylor3, new Color(255, 153, 0));
* set and check Zappo colours
*/
af.changeColour_actionPerformed(JalviewColourScheme.Zappo.toString());
- Color zappo1 = sr.getResidueBoxColour(seq, 88); // E red
- Color zappo2 = sr.getResidueBoxColour(seq, 89); // A pink
- Color zappo3 = sr.getResidueBoxColour(seq, 90); // G magenta
+ Color zappo1 = sr.getResidueColour(seq, 88, null); // E red
+ Color zappo2 = sr.getResidueColour(seq, 89, null); // A pink
+ Color zappo3 = sr.getResidueColour(seq, 90, null); // G magenta
assertEquals(zappo1, Color.red);
assertEquals(zappo2, Color.pink);
assertEquals(zappo3, Color.magenta);
* set 'stripy' colours - odd columns are Taylor and even are Zappo
*/
af.changeColour_actionPerformed("stripy");
- Color stripy1 = sr.getResidueBoxColour(seq, 88);
- Color stripy2 = sr.getResidueBoxColour(seq, 89);
- Color stripy3 = sr.getResidueBoxColour(seq, 90);
+ Color stripy1 = sr.getResidueColour(seq, 88, null);
+ Color stripy2 = sr.getResidueColour(seq, 89, null);
+ Color stripy3 = sr.getResidueColour(seq, 90, null);
assertEquals(stripy1, zappo1);
assertEquals(stripy2, taylor2);
assertEquals(stripy3, zappo3);
* set and check Clustal colours
*/
af.changeColour_actionPerformed(JalviewColourScheme.Clustal.toString());
- Color clustal1 = sr.getResidueBoxColour(seq, 88);
- Color clustal2 = sr.getResidueBoxColour(seq, 89);
- Color clustal3 = sr.getResidueBoxColour(seq, 90);
+ Color clustal1 = sr.getResidueColour(seq, 88, null);
+ Color clustal2 = sr.getResidueColour(seq, 89, null);
+ Color clustal3 = sr.getResidueColour(seq, 90, null);
assertEquals(clustal1, ClustalColour.MAGENTA.colour);
assertEquals(clustal2, ClustalColour.BLUE.colour);
assertEquals(clustal3, ClustalColour.ORANGE.colour);
* set 'MyClustal' colours - uses AWT colour equivalents
*/
af.changeColour_actionPerformed("MyClustal");
- Color myclustal1 = sr.getResidueBoxColour(seq, 88);
- Color myclustal2 = sr.getResidueBoxColour(seq, 89);
- Color myclustal3 = sr.getResidueBoxColour(seq, 90);
+ Color myclustal1 = sr.getResidueColour(seq, 88, null);
+ Color myclustal2 = sr.getResidueColour(seq, 89, null);
+ Color myclustal3 = sr.getResidueColour(seq, 90, null);
assertEquals(myclustal1, Color.MAGENTA);
assertEquals(myclustal2, Color.BLUE);
assertEquals(myclustal3, Color.ORANGE);