protected boolean ignoreGapsInConsensusCalculation = false;
- protected CollectionColourScheme globalColourScheme;
+ protected CollectionColourSchemeI globalColourScheme;
@Override
public void setGlobalColourScheme(ColourSchemeI cs)
/*
* only instantiate colour scheme once, thereafter update it
+ * this means that any conservation or PID threshold settings
+ * persist when the alignment colour scheme is changed
*/
if (globalColourScheme == null)
{
}
globalColourScheme.setColourScheme(cs);
- boolean recalc = false;
+ // boolean recalc = false;
+ // TODO: do threshold and increment belong in ViewStyle or colour scheme?
+ // problem: groups need this but do not currently have a ViewStyle
+
if (cs != null)
{
- recalc = getConservationSelected();
- if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
+ if (getConservationSelected() || getAbovePIDThreshold()
+ || cs instanceof PIDColourScheme
|| cs instanceof Blosum62ColourScheme)
{
- recalc = true;
- globalColourScheme.setThreshold(viewStyle.getThreshold(),
- ignoreGapsInConsensusCalculation);
- }
- else
- {
- globalColourScheme
- .setThreshold(0, ignoreGapsInConsensusCalculation);
- }
- if (recalc)
- {
- globalColourScheme.setConsensus(hconsensus);
globalColourScheme.setConservation(hconservation);
+ globalColourScheme
+ .setConservationApplied(getConservationSelected());
}
- globalColourScheme.setConservationApplied(getConservationSelected());
globalColourScheme.alignmentChanged(alignment, hiddenRepSequences);
}
+
+ /*
+ * if 'apply colour to all groups' is selected... do so
+ * (but don't transfer any colour threshold settings to groups)
+ */
if (getColourAppliesToAllGroups())
{
for (SequenceGroup sg : getAlignment().getGroups())
{
- if (cs == null)
- {
- sg.setColourScheme(null);
- continue;
- }
- CollectionColourScheme groupColour = new CollectionColourScheme(cs.getInstance(sg,
- getHiddenRepSequences()));
- sg.setGroupColourScheme(groupColour);
- sg.setConsPercGaps(ConsPercGaps);
- if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
- || cs instanceof Blosum62ColourScheme)
- {
- groupColour.setThreshold(viewStyle.getThreshold(),
- isIgnoreGapsConsensus());
- recalc = true;
- }
- else
- {
- groupColour.setThreshold(0, isIgnoreGapsConsensus());
- }
-
- if (getConservationSelected())
- {
- groupColour.setConservationApplied(true);
- recalc = true;
- }
- else
- {
- groupColour.setConservation(null);
- // sg.cs.setThreshold(0, getIgnoreGapsConsensus());
- }
- if (recalc)
- {
- sg.recalcConservation();
- }
- else
+ /*
+ * retain any colour thresholds per group while
+ * changing choice of colour scheme (JAL-2386)
+ */
+ sg.setColourScheme(cs);
+ if (cs != null)
{
- groupColour.alignmentChanged(sg, hiddenRepSequences);
+ sg.getGroupColourScheme()
+ .alignmentChanged(sg, hiddenRepSequences);
}
}
}
*/
void resetAllColourSchemes()
{
- CollectionColourScheme cs = globalColourScheme;
+ CollectionColourSchemeI cs = globalColourScheme;
if (cs != null)
{
cs.alignmentChanged(alignment, hiddenRepSequences);