contains tab separated text fields. <strong>No comments are
allowed</strong>.
</p>
- <p>The first set of lines contain type definitions:
+ <p>
+ <strong>Feature Colours</strong>
+ </p>
+ <p>The first set of lines contain feature type definitions and their colours:
<pre>
<strong><em>Feature label</em>	<em>Feature Colour</em>
<!-- 	<em>Feature links</em> --></strong>
<ul>
<li>A single colour specified as either a red,green,blue 24 bit
triplet in hexadecimal (eg. 00ff00) or as comma separated numbers
- (ranging from 0 to 255))</li>
+ (ranging from 0 to 255))<br>
+ (For help with colour values, see <a href="https://www.w3schools.com/colors/colors_converter.asp">https://www.w3schools.com/colors/colors_converter.asp</a>.)</li>
<li>A <a href="featureschemes.html">graduated colourscheme</a>
specified as a "|" separated list of fields: <pre>
-[label|]<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<thresholdtype>|[<threshold value>]]
+[label <em>or</em> score<em> or</em> attribute|attName|]<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<novalue>][|<thresholdtype>|[<threshold value>]]
</pre> The fields are as follows:
<ul>
- <li><em>label</em><br> Indicate that the feature
+ <li><em>label</em><br> Indicates that the feature
description should be used to create a colour for features of
this type.<br> <em>Note: if no threshold value is
- needed then the final '|' may be omitted.<br> This
+ needed then only 'label' is required.<br> This
keyword was added in Jalview 2.6
</em></li>
+ <li><em>score</em><br> Indicates that the feature
+ score should be used to create a graduated colour for features of
+ this type, in conjunction with mincolor, maxcolor.<br><em>This keyword was added in Jalview 2.11.
+ It may be omitted (score is the default) if mincolor and maxcolor are specified.
+ </em></li>
+
+ <li><em>attribute|attName</em><br> Indicates that the value of feature
+ attribute 'attName' should be used to create a colour for features of
+ this type.
+ <br>For example, <em>attribute|clinical_significance</em> to colour by clinical_significance.
+ <br>To colour by range of a numeric attribute, include <em>mincolor</em> and <em>maxcolor</em>, or omit to colour by text (category).
+ <br>(Note: the value of the attribute used for colouring will also be shown in the tooltip as you mouse over features.)
+ <br>A sub-attribute should be written as, for example, CSQ:IMPACT.
+ <br><em>This keyword was added in Jalview 2.11</em></li>
+
<li><em>mincolor</em> and <em>maxcolor</em><br> Colour
triplets specified as hexadecimal or comma separated values
(may be left blank for a <em>label</em> style colourscheme,
<li><em>minvalue</em> and <em>maxvalue</em><br>
Minimum and maximum values defining the range of scores for
- which the colour range will be defined over. If minvalue is
+ which the colour range will be defined over.<br>If minvalue is
greater than maxvalue then the linear mapping will have
negative gradient.</li>
+ <li><em>novalue</em> <br>
+ Specifies the colour to use if colouring by attribute, when the attribute is absent.
+ Valid options are <em>novaluemin, novaluemax, novaluenone</em>, to use mincolor, maxcolor, or no colour.
+ <br>If not specified this will default to novaluemin.</li>
+
<li><em>thresholdtype</em><br> Either
"none", "below", or "above". <em>below</em>
and <em>above</em> require an additional <em>threshold
</ul>
</p>
+ <p>
+ <strong>Feature Filters</strong>
+ </p>
+ <p>This section is optional, and allows one or more filters to be defined for each feature type.
+ <br>Only features that satisfy the filter conditions will be displayed.
+ <br>Begin with a line which is just STARTFILTERS, and end with a line which is just ENDFILTERS.
+ <br>Each line has the format:
+ <pre>featureType <em><tab></em> (filtercondition1) [and|or] (filtercondition2) [and|or]...<br></pre>
+ The parentheses are not needed if there is only one condition.
+ Combine multiple conditions with either <em>and</em> or <em>or</em> (but not a mixture).
+ <br>Each condition is written as:
+ <pre>Label|Score|AttributeName condition [value]</pre>
+ where <em>condition</em> is not case sensitive, and should be one of
+ <ul>
+ <li><em>Contains</em> - value should contain the given text (not case sensitive); example <em>clinical_significance contains Pathogenic</em></li>
+ <li><em>NotContains</em> - value should not contain the given text</li>
+ <li><em>Matches</em> - value should match the given text (not case sensitive)</li>
+ <li><em>NotMatches</em> - value should not match the given text (not case sensitive)</li>
+ <li><em>Present</em> - specified attribute is present on the feature (no value required); example <em>CSQ:SIFT present</em></li>
+ <li><em>NotPresent</em> - specified attribute is not present on the feature (no value required)</li>
+ <li><em>EQ</em> - feature score, or specified attribute, is equal to the (numeric) value</li>
+ <li><em>NE, LT, LE, GT, GE</em> - tests for not equal to / less than / less than or equal to / greater than / greater than or equal to the value</li>
+ </ul>
+ A non-numeric value always fails a numeric test.<br>If either attribute name, or value to compare, contains spaces, then enclose in single quotes:
+ <em>'mutagenesis site' contains 'decreased affinity'</em>
+ <br>Tip: to see examples of valid syntax, first configure colours and filters in Jalview, then <em>File | Export Features</em> to Textbox in Jalview Format.
+ <br><em>Feature filters were added in Jalview 2.11</em>
+ </p>
+
+ <p>
+ <strong>Feature Instances</strong>
+ </p>
+
<p>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).</p>
+ near the feature on that sequence (and may also be used to generate
+ a colour for the feature).</p>
<p>
If your sequence annotation is already available in <a href="http://gmod.org/wiki/GFF2">GFF2</a> (http://gmod.org/wiki/GFF2) or
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
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	.	.
</pre>
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