From: Jim Procter Date: Mon, 19 Nov 2018 15:56:53 +0000 (+0000) Subject: JAL-3127 tidier tree group colour -> view propagation X-Git-Tag: Release_2_11_0~17^2~46^2~8 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3f9e523aac2d14e9ce68e186365008bf6a62fcce;p=jalview.git JAL-3127 tidier tree group colour -> view propagation --- diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 67ddbd1..f1bdd31 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -28,8 +28,6 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.datamodel.SequenceNode; import jalview.schemes.ColourSchemeI; -import jalview.schemes.ColourSchemeProperty; -import jalview.schemes.UserColourScheme; import jalview.structure.SelectionSource; import jalview.util.Format; import jalview.util.MessageManager; @@ -994,54 +992,41 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } ColourSchemeI cs = null; - SequenceGroup sg = new SequenceGroup(sequences, null, cs, true, true, + SequenceGroup _sg = new SequenceGroup(sequences, null, cs, true, true, false, 0, av.getAlignment().getWidth() - 1); - if (av.getGlobalColourScheme() != null) - { - if (av.getGlobalColourScheme() instanceof UserColourScheme) - { - cs = new UserColourScheme( - ((UserColourScheme) av.getGlobalColourScheme()) - .getColours()); - - } - else - { - cs = ColourSchemeProperty.getColourScheme(av, sg, - ColourSchemeProperty - .getColourName(av.getGlobalColourScheme())); - } - // cs is null if shading is an annotationColourGradient - // if (cs != null) - // { - // cs.setThreshold(av.getViewportColourScheme().getThreshold(), - // av.isIgnoreGapsConsensus()); - // } - } - sg.setColourScheme(cs); - sg.getGroupColourScheme().setThreshold( - av.getResidueShading().getThreshold(), - av.isIgnoreGapsConsensus()); - // sg.recalcConservation(); - sg.setName("JTreeGroup:" + sg.hashCode()); - sg.setIdColour(col); + _sg.setName("JTreeGroup:" + _sg.hashCode()); + _sg.setIdColour(col); for (int a = 0; a < aps.length; a++) { - if (aps[a].av.getGlobalColourScheme() != null - && aps[a].av.getResidueShading().conservationApplied()) + SequenceGroup sg = new SequenceGroup(_sg); + AlignViewport viewport = aps[a].av; + + // Propagate group colours in each view + if (viewport.getGlobalColourScheme() != null) { - Conservation c = new Conservation("Group", sg.getSequences(null), - sg.getStartRes(), sg.getEndRes()); - c.calculate(); - c.verdict(false, aps[a].av.getConsPercGaps()); - sg.cs.setConservation(c); + cs = viewport.getGlobalColourScheme().getInstance(viewport, sg, + null); + sg.setColourScheme(cs); + sg.getGroupColourScheme().setThreshold( + viewport.getResidueShading().getThreshold(), + viewport.isIgnoreGapsConsensus()); + + if (viewport.getResidueShading().conservationApplied()) + { + Conservation c = new Conservation("Group", + sg.getSequences(null), sg.getStartRes(), + sg.getEndRes()); + c.calculate(); + c.verdict(false, viewport.getConsPercGaps()); + sg.cs.setConservation(c); + } } // indicate that associated structure views will need an update - aps[a].av.setUpdateStructures(true); + viewport.setUpdateStructures(true); // propagate structure view update and sequence group to complement view - aps[a].av.addSequenceGroup(new SequenceGroup(sg)); + viewport.addSequenceGroup(sg); } }