From 4c43b10447a141c73446fc2bc368b06245a675c3 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 20 Sep 2018 11:54:31 +0100 Subject: [PATCH] JAL-2843 help text for colour by attribute, feature filters --- help/html/features/featuresFormat.html | 90 ++++++++++++++++++++++++--- src/jalview/schemes/FeatureColour.java | 4 +- test/jalview/schemes/FeatureColourTest.java | 49 +++++++++++++++ 3 files changed, 131 insertions(+), 12 deletions(-) diff --git a/help/html/features/featuresFormat.html b/help/html/features/featuresFormat.html index fd6b99f..171a3d0 100755 --- a/help/html/features/featuresFormat.html +++ b/help/html/features/featuresFormat.html @@ -60,7 +60,10 @@ contains tab separated text fields. No comments are allowed.

-

The first set of lines contain type definitions: +

+ Feature Colours +

+

The first set of lines contain feature type definitions and their colours:

 Feature label	Feature Colour
 
@@ -72,21 +75,37 @@
   
diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index 7d14662..51e7645 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -321,8 +321,8 @@ public class FeatureColour implements FeatureColourI } catch (Exception e) { throw new IllegalArgumentException( - "Couldn't parse the minimum value for graduated colour (" - + descriptor + ")"); + "Couldn't parse the minimum value for graduated colour ('" + + minval + "')"); } try { diff --git a/test/jalview/schemes/FeatureColourTest.java b/test/jalview/schemes/FeatureColourTest.java index 2eb718b..a96caec 100644 --- a/test/jalview/schemes/FeatureColourTest.java +++ b/test/jalview/schemes/FeatureColourTest.java @@ -523,11 +523,60 @@ public class FeatureColourTest assertFalse(fc.hasThreshold()); assertEquals(Color.RED, fc.getMinColour()); assertEquals(Color.GREEN, fc.getMaxColour()); + assertEquals(Color.RED, fc.getNoColour()); assertEquals(10f, fc.getMin()); assertEquals(20f, fc.getMax()); assertTrue(fc.isAutoScaled()); /* + * the same, with 'no value colour' specified as max + */ + fc = FeatureColour + .parseJalviewFeatureColour("red|green|novaluemax|10.0|20.0"); + assertEquals(Color.RED, fc.getMinColour()); + assertEquals(Color.GREEN, fc.getMaxColour()); + assertEquals(Color.GREEN, fc.getNoColour()); + assertEquals(10f, fc.getMin()); + assertEquals(20f, fc.getMax()); + + /* + * the same, with 'no value colour' specified as min + */ + fc = FeatureColour + .parseJalviewFeatureColour("red|green|novalueMin|10.0|20.0"); + assertEquals(Color.RED, fc.getMinColour()); + assertEquals(Color.GREEN, fc.getMaxColour()); + assertEquals(Color.RED, fc.getNoColour()); + assertEquals(10f, fc.getMin()); + assertEquals(20f, fc.getMax()); + + /* + * the same, with 'no value colour' specified as none + */ + fc = FeatureColour + .parseJalviewFeatureColour("red|green|novaluenone|10.0|20.0"); + assertEquals(Color.RED, fc.getMinColour()); + assertEquals(Color.GREEN, fc.getMaxColour()); + assertNull(fc.getNoColour()); + assertEquals(10f, fc.getMin()); + assertEquals(20f, fc.getMax()); + + /* + * the same, with invalid 'no value colour' + */ + try + { + fc = FeatureColour + .parseJalviewFeatureColour("red|green|blue|10.0|20.0"); + fail("expected exception"); + } catch (IllegalArgumentException e) + { + assertEquals( + "Couldn't parse the minimum value for graduated colour ('blue')", + e.getMessage()); + } + + /* * graduated colour (explicitly by 'score') (no threshold) */ fc = FeatureColour -- 1.7.10.2