X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=examples%2Fgroovy%2FcolourSchemes.groovy;fp=examples%2Fgroovy%2FcolourSchemes.groovy;h=27e179b39235203296e639878cdd0fb2707d0c27;hb=8e1be43e250107a4d86898bd554cf03098fa5957;hp=84eabbfa299ee81e59d111b8480b99843140567e;hpb=8b55eedb9d76a8c65b80f756c4412bf029906bf7;p=jalview.git diff --git a/examples/groovy/colourSchemes.groovy b/examples/groovy/colourSchemes.groovy index 84eabbf..27e179b 100644 --- a/examples/groovy/colourSchemes.groovy +++ b/examples/groovy/colourSchemes.groovy @@ -2,7 +2,6 @@ import java.awt.Color; import jalview.schemes.ResidueColourScheme; import jalview.schemes.ColourSchemes; import jalview.datamodel.AnnotatedCollectionI; -import java.util.Map; import jalview.datamodel.SequenceI; /* @@ -17,13 +16,8 @@ class Stripy extends ResidueColourScheme { Stripy() { } String getSchemeName() { "stripy" } Stripy getInstance(AnnotatedCollectionI coll, Map map) { new Stripy() } - Color findColour(char res, int col, SequenceI seq) { - // determine the colour - Color colour = findColour(res, col) - // let Jalview apply conservation or consensus shading - adjustColour(res, col, colour); - } - Color findColour(char res, int col) { + Color findColour(char res, int col, SequenceI seq) + { if (res == ' ' || res == '-' || res == '.') { Color.yellow @@ -48,17 +42,13 @@ class ByWeight extends ResidueColourScheme { boolean isPeptideSpecific() {true} String getSchemeName() { "By Weight" } ByWeight getInstance(AnnotatedCollectionI coll, Map map) { new ByWeight() } - Color makeColour(int weight) { + Color makeColour(int weight) + { int i = 255 * (weight - min) / (max - min); new Color(i, 0, i); } - Color findColour(char res, int col, SequenceI seq) { - // determine the colour - Color colour = findColour(res, col) - // let Jalview apply any conservation or consensus shading - adjustColour(res, col, colour); - } - Color findColour(char res, int col) { + Color findColour(char res, int col, SequenceI seq) + { switch (res) { case ' ': case '-':