{
if (viewport.getAbovePIDThreshold())
{
- threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
- "Background");
-
- cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
-
- viewport.setGlobalColourScheme(cs);
- }
- else
- {
- cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
- }
+ viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel, cs,
+ "Background"));
+ }
if (viewport.getConservationSelected())
{
-
- Alignment al = (Alignment) viewport.getAlignment();
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
-
- c.calculate();
- c.verdict(false, viewport.getConsPercGaps());
-
- cs.setConservation(c);
-
- cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
+ cs.setConservationApplied(true);
+ viewport.setIncrement(SliderPanel.setConservationSlider(alignPanel,
cs, "Background"));
-
}
else
{
- cs.setConservation(null);
+ cs.setConservationApplied(false);
}
-
- cs.setConsensus(viewport.getSequenceConsensusHash());
-
}
viewport.setGlobalColourScheme(cs);
}
/**
- * Max Gaps Threshold for performing a conservation calculation TODO: make
- * this a configurable property - or global to an alignment view
+ * Max Gaps Threshold (percent) for performing a conservation calculation
*/
private int consPercGaps = 25;
/**
+ * @return Max Gaps Threshold for performing a conservation calculation
+ */
+ public int getConsPercGaps()
+ {
+ return consPercGaps;
+ }
+
+ /**
+ * set Max Gaps Threshold (percent) for performing a conservation calculation
+ * @param consPercGaps
+ */
+ public void setConsPercGaps(int consPercGaps)
+ {
+ this.consPercGaps = consPercGaps;
+ }
+
+ /**
* calculate residue conservation for group - but only if necessary.
*/
public void recalcConservation()
// calculation till later or to do all calculations in thread.
// via changecolour
globalColourScheme = cs;
+ boolean recalc=false;
+ if (cs!=null)
+ {
+ cs.setConservationApplied(recalc = getConservationSelected());
+ if (getAbovePIDThreshold() || cs instanceof PIDColourScheme || cs instanceof Blosum62ColourScheme)
+ {
+ recalc = true;
+ cs.setThreshold(threshold, ignoreGapsInConsensusCalculation);
+ } else {
+ cs.setThreshold(0, ignoreGapsInConsensusCalculation);
+ }
+ if (recalc)
+ {
+ cs.setConsensus(hconsensus);
+ cs.setConservation(hconservation);
+ }
+ cs.alignmentChanged(alignment, hiddenRepSequences);
+ }
if (getColourAppliesToAllGroups())
{
for (SequenceGroup sg : getAlignment().getGroups())
sg.cs = null;
continue;
}
- if (cs instanceof ClustalxColourScheme)
- {
- sg.cs = new ClustalxColourScheme(sg, getHiddenRepSequences());
- }
- else
- {
- try
- {
- sg.cs = cs.getClass().newInstance();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- sg.cs = cs;
- }
- }
-
+ sg.cs = cs.applyTo(sg, getHiddenRepSequences());
+ sg.setConsPercGaps(ConsPercGaps);
if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
|| cs instanceof Blosum62ColourScheme)
{
sg.cs.setThreshold(threshold, getIgnoreGapsConsensus());
- sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(getHiddenRepSequences()), 0,
- sg.getWidth()));
+ recalc=true;
}
else
{
if (getConservationSelected())
{
- Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(getHiddenRepSequences()), 0,
- getAlignment().getWidth() - 1);
- c.calculate();
- c.verdict(false, getConsPercGaps());
- sg.cs.setConservation(c);
+ sg.cs.setConservationApplied(true);
+ recalc=true;
}
else
{
sg.cs.setConservation(null);
- sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+ // sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+ }
+ if (recalc) {
+ sg.recalcConservation();
+ } else {
+ sg.cs.alignmentChanged(sg, hiddenRepSequences);
}
-
}
}
ColourSchemeI cs = globalColourScheme;
if (cs != null)
{
- cs.alignmentChanged(alignment, null);
+ cs.alignmentChanged(alignment, hiddenRepSequences);
cs.setConsensus(hconsensus);
if (cs.conservationApplied())