From 4c43b10447a141c73446fc2bc368b06245a675c3 Mon Sep 17 00:00:00 2001
From: gmungoc
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 @@
-[label|]<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<thresholdtype>|[<threshold value>]] +[label or score or attribute|attName|]<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<novalue>][|<thresholdtype>|[<threshold value>]]The fields are as follows:
+ Feature Filters +
+This section is optional, and allows one or more filters to be defined for each feature type.
+
Only features that satisfy the filter conditions will be displayed.
+
Begin with a line which is just STARTFILTERS, and end with a line which is just ENDFILTERS.
+
Each line has the format:
+
featureType <tab> (filtercondition1) [and|or] (filtercondition2) [and|or]...+ The parentheses are not needed if there is only one condition. + Combine multiple conditions with either and or or (but not a mixture). +
Label|Score|AttributeName condition [value]+ where condition is not case sensitive, and should be one of +
+ Feature Instances +
+The remaining lines in the file are the sequence annotation definitions, where the now defined features are attached to regions on particular sequences. Each feature can optionally include some descriptive text which is displayed in a tooltip when the mouse is - near the feature on that sequence (and can also be used to generate - a colour the feature).
+ near the feature on that sequence (and may also be used to generate + a colour for the feature).If your sequence annotation is already available in GFF2 (http://gmod.org/wiki/GFF2) or @@ -204,6 +261,13 @@ signal peptide 0,155,165 helix ff0000 strand 00ff00 coil cccccc +kdHydrophobicity ccffcc|333300|-3.9|4.5|above|-2.0 + +STARTFILTERS +metal ion-binding site Label Contains sulfur +kdHydrophobicity (Score LT 1.5) OR (Score GE 2.8) +ENDFILTERS + Your Own description here FER_CAPAA -1 3 93 domain Your Own description here FER_CAPAN -1 48 144 chain Your Own description here FER_CAPAN -1 50 140 domain @@ -211,10 +275,16 @@ Your Own description here FER_CAPAN -1 136 136 modified residue Your Own description here FER1_LYCES -1 1 47 transit peptide Your Own description here Q93XJ9_SOLTU -1 1 48 signal peptide Your Own description here Q93XJ9_SOLTU -1 49 144 chain -startgroup secondarystucture + +STARTGROUP secondarystucture PDB secondary structure annotation FER1_SPIOL -1 52 59 strand PDB secondary structure annotation FER1_SPIOL -1 74 80 helix -endgroup secondarystructure +ENDGROUP secondarystructure + +STARTGROUP kd +Hydrophobicity score by kD Q93XJ9_SOLTU -1 48 48 kdHydrophobicity 1.8 +ENDGROUP kd + GFF FER_CAPAA GffGroup domain 3 93 . . 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