+\r
+ Alignment al = (Alignment) av.getAlignment();\r
+ SequenceGroup sg = av.alignment.findGroup( al.getSequenceAt(i));\r
+ if(sg==null || !(sg.cs instanceof ConservationColourScheme))\r
+ return;\r
+\r
+ Conservation c = sg.getConservation();\r
+\r
+ c = new Conservation("All", al.cons,\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ al.getWidth());\r
+ c.calculate();\r
+ c.verdict(false, 100);\r
+ sg.setConservation(c);\r
+ ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
+ ccs.conserve = c;\r
+ // sg.cs = new ConservationColourScheme(sg);\r
+ }\r
+\r
+ public void setColourScheme(ColourSchemeI cs, boolean showConservation)\r
+ {\r
+ if (av.getSelection().size() == 0)\r
+ {\r
+ seqCanvas.cs = cs;\r
+ for (int i = 0; i < av.alignment.getGroups().size();i++)\r
+ {\r
+ SequenceGroup sg = (SequenceGroup)av.alignment.getGroups().elementAt(i);\r
+ sg.cs = cs;\r
+ if(!showConservation\r
+ && !(sg.cs instanceof Blosum62ColourScheme)\r
+ && sg.cs instanceof ConservationColourScheme)\r
+ {\r
+ // remove ConservationColouring from existing Conservation group\r
+ ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
+ sg.cs = ccs.cs;\r
+ }\r
+ else if(showConservation && !(sg.cs instanceof ConservationColourScheme))\r
+ {\r
+ // add ConservationColouring to new group\r
+ Conservation c = sg.getConservation();\r
+ Alignment al = (Alignment) av.getAlignment();\r
+ c = new Conservation("All", al.cons,\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ al.getWidth() );\r
+ c.calculate();\r
+ c.verdict(false, 100);\r
+ sg.setConservation(c);\r
+ sg.cs = new ConservationColourScheme(sg);\r
+ }\r
+\r
+\r
+ }\r
+ }\r
+ else\r
+ {\r
+ SequenceGroup sg = av.alignment.addGroup();\r
+ sg.cs = cs;\r
+\r
+ for (int i=0; i < av.getSelection().size(); i++)\r
+ {\r
+ av.alignment.removeFromGroup(av.alignment.findGroup((Sequence)av.sel.sequenceAt(i)),\r
+ (Sequence)av.sel.sequenceAt(i));\r
+ av.alignment.addToGroup(sg,(Sequence)av.sel.sequenceAt(i));\r
+ }\r
+\r
+ // Selection is made, we only want to change the conservationColour for selected group\r
+ if( showConservation\r
+ && !(sg.cs instanceof ConservationColourScheme)\r
+ && !(sg.cs instanceof Blosum62ColourScheme))\r
+ {\r
+ Conservation c = sg.getConservation();\r
+ Alignment al = (Alignment) av.getAlignment();\r
+\r
+ c = new Conservation("All", al.cons,\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ al.getWidth() );\r
+ c.calculate();\r
+ c.verdict(false, 100);\r
+ sg.setConservation(c);\r
+ sg.cs = new ConservationColourScheme(sg);\r
+ }\r
+ else if( !showConservation && sg.cs instanceof ConservationColourScheme)\r
+ {\r
+ ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
+ sg.cs = ccs.cs;\r
+ }\r
+\r
+\r
+\r
+ }\r