git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9be780b
)
JAL-2624 additional tests for FeatureColour.getColour(),
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Mon, 24 Jul 2017 08:24:48 +0000
(09:24 +0100)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Mon, 24 Jul 2017 08:24:48 +0000
(09:24 +0100)
filterFeaturesForDisplay
src/jalview/schemes/FeatureColour.java
patch
|
blob
|
history
test/jalview/renderer/seqfeatures/FeatureRendererTest.java
patch
|
blob
|
history
test/jalview/schemes/FeatureColourTest.java
patch
|
blob
|
history
diff --git
a/src/jalview/schemes/FeatureColour.java
b/src/jalview/schemes/FeatureColour.java
index
ed3e02d
..
b748d9e
100644
(file)
--- a/
src/jalview/schemes/FeatureColour.java
+++ b/
src/jalview/schemes/FeatureColour.java
@@
-553,9
+553,13
@@
public class FeatureColour implements FeatureColourI
/*
* graduated colour case, optionally with threshold
/*
* graduated colour case, optionally with threshold
- * (treating Float.NaN as within visible range here)
+ * Float.NaN is assigned minimum visible score colour
*/
float scr = feature.getScore();
*/
float scr = feature.getScore();
+ if (Float.isNaN(scr))
+ {
+ return getMinColour();
+ }
if (isAboveThreshold() && scr <= threshold)
{
return null;
if (isAboveThreshold() && scr <= threshold)
{
return null;
@@
-568,10
+572,6
@@
public class FeatureColour implements FeatureColourI
{
return getMaxColour();
}
{
return getMaxColour();
}
- if (Float.isNaN(scr))
- {
- return getMinColour();
- }
float scl = (scr - base) / range;
if (isHighToLow)
{
float scl = (scr - base) / range;
if (isHighToLow)
{
diff --git
a/test/jalview/renderer/seqfeatures/FeatureRendererTest.java
b/test/jalview/renderer/seqfeatures/FeatureRendererTest.java
index
3e27aba
..
dc86605
100644
(file)
--- a/
test/jalview/renderer/seqfeatures/FeatureRendererTest.java
+++ b/
test/jalview/renderer/seqfeatures/FeatureRendererTest.java
@@
-267,15
+267,20
@@
public class FeatureRendererTest
fr.filterFeaturesForDisplay(features, null); // empty list, does nothing
SequenceI seq = av.getAlignment().getSequenceAt(0);
fr.filterFeaturesForDisplay(features, null); // empty list, does nothing
SequenceI seq = av.getAlignment().getSequenceAt(0);
- SequenceFeature sf1 = new SequenceFeature("Cath", "", 6, 8, "group1");
+ SequenceFeature sf1 = new SequenceFeature("Cath", "", 6, 8, Float.NaN,
+ "group1");
seq.addSequenceFeature(sf1);
seq.addSequenceFeature(sf1);
- SequenceFeature sf2 = new SequenceFeature("Cath", "", 5, 11, "group2");
+ SequenceFeature sf2 = new SequenceFeature("Cath", "", 5, 11, 2f,
+ "group2");
seq.addSequenceFeature(sf2);
seq.addSequenceFeature(sf2);
- SequenceFeature sf3 = new SequenceFeature("Cath", "", 5, 11, "group3");
+ SequenceFeature sf3 = new SequenceFeature("Cath", "", 5, 11, 3f,
+ "group3");
seq.addSequenceFeature(sf3);
seq.addSequenceFeature(sf3);
- SequenceFeature sf4 = new SequenceFeature("Cath", "", 6, 8, "group4");
+ SequenceFeature sf4 = new SequenceFeature("Cath", "", 6, 8, 4f,
+ "group4");
seq.addSequenceFeature(sf4);
seq.addSequenceFeature(sf4);
- SequenceFeature sf5 = new SequenceFeature("Cath", "", 6, 9, "group4");
+ SequenceFeature sf5 = new SequenceFeature("Cath", "", 6, 9, 5f,
+ "group4");
seq.addSequenceFeature(sf5);
fr.findAllFeatures(true);
seq.addSequenceFeature(sf5);
fr.findAllFeatures(true);
@@
-329,6
+334,7
@@
public class FeatureRendererTest
/*
* no filtering of co-located features with graduated colour scheme
/*
* no filtering of co-located features with graduated colour scheme
+ * filterFeaturesForDisplay does _not_ check colour threshold
* sf2 is removed as its group is hidden
*/
features = seq.getSequenceFeatures();
* sf2 is removed as its group is hidden
*/
features = seq.getSequenceFeatures();
diff --git
a/test/jalview/schemes/FeatureColourTest.java
b/test/jalview/schemes/FeatureColourTest.java
index
03f7efa
..
7a72c15
100644
(file)
--- a/
test/jalview/schemes/FeatureColourTest.java
+++ b/
test/jalview/schemes/FeatureColourTest.java
@@
-128,17
+128,28
@@
public class FeatureColourTest
150f);
SequenceFeature sf = new SequenceFeature("type", "desc", 0, 20, 70f,
null);
150f);
SequenceFeature sf = new SequenceFeature("type", "desc", 0, 20, 70f,
null);
+
+ /*
+ * feature with score of Float.NaN is always assigned minimum colour
+ */
+ SequenceFeature sf2 = new SequenceFeature("type", "desc", 0, 20,
+ Float.NaN, null);
+
fc.setThreshold(100f); // ignore for now
assertEquals(new Color(204, 204, 204), fc.getColor(sf));
fc.setThreshold(100f); // ignore for now
assertEquals(new Color(204, 204, 204), fc.getColor(sf));
+ assertEquals(Color.white, fc.getColor(sf2));
fc.setAboveThreshold(true); // feature lies below threshold
assertNull(fc.getColor(sf));
fc.setAboveThreshold(true); // feature lies below threshold
assertNull(fc.getColor(sf));
+ assertEquals(Color.white, fc.getColor(sf2));
fc.setBelowThreshold(true);
fc.setThreshold(70f);
assertNull(fc.getColor(sf)); // feature score == threshold - hidden
fc.setBelowThreshold(true);
fc.setThreshold(70f);
assertNull(fc.getColor(sf)); // feature score == threshold - hidden
+ assertEquals(Color.white, fc.getColor(sf2));
fc.setThreshold(69f);
assertNull(fc.getColor(sf)); // feature score > threshold - hidden
fc.setThreshold(69f);
assertNull(fc.getColor(sf)); // feature score > threshold - hidden
+ assertEquals(Color.white, fc.getColor(sf2));
}
/**
}
/**