import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.schemes.Colour;
-import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.util.Map;
*/
colours = af.getFeatureRenderer().getFeatureColours();
assertEquals("26 feature group colours not found", 26, colours.size());
- assertEquals(colours.get("Cath").getColour(), new Color(0x93b1d1));
- assertEquals(colours.get("ASX-MOTIF").getColour(), new Color(0x6addbb));
+ assertEquals(colours.get("Cath").getColour(), new Colour(0x93b1d1));
+ assertEquals(colours.get("ASX-MOTIF").getColour(), new Colour(0x6addbb));
/*
* verify (some) features on sequences
// verify colours read or synthesized
colours = af.getFeatureRenderer().getFeatureColours();
assertEquals("1 feature group colours not found", 1, colours.size());
- assertEquals(colours.get("METAL").getColour(), new Color(0xcc9900));
+ assertEquals(colours.get("METAL").getColour(), new Colour(0xcc9900));
// verify feature on FER_CAPAA
SequenceFeature[] sfs = al.getSequenceAt(0).getDatasetSequence()
}
/**
+ * Test various ways of describing a feature colour scheme
+ *
+ * @throws Exception
+ */
+ @Test(groups = { "Functional" })
+ public void testParseGraduatedColourScheme() throws Exception
+ {
+ FeaturesFile ff = new FeaturesFile();
+
+ // colour by label:
+ FeatureColourI gc = ff.parseGraduatedColourScheme(
+ "BETA-TURN-IR\t9a6a94", "label");
+ assertTrue(gc.isColourByLabel());
+ assertEquals(Colour.white, gc.getMinColour());
+ assertEquals(Colour.black, gc.getMaxColour());
+ assertTrue(gc.isAutoScaled());
+
+ // using colour name, rgb, etc:
+ String spec = "blue|255,0,255|absolute|20.0|95.0|below|66.0";
+ gc = ff.parseGraduatedColourScheme("BETA-TURN-IR\t" + spec, spec);
+ assertFalse(gc.isColourByLabel());
+ assertEquals(Colour.blue, gc.getMinColour());
+ assertEquals(new Colour(255, 0, 255), gc.getMaxColour());
+ assertFalse(gc.isAutoScaled());
+ // assertFalse(gc.getTolow());
+ assertEquals(20.0f, gc.getMin(), 0.001f);
+ assertEquals(95.0f, gc.getMax(), 0.001f);
+ assertTrue(gc.isBelowThreshold());
+ assertEquals(66.0f, gc.getThreshold(), 0.001f);
+
+ // inverse gradient high to low:
+ spec = "blue|255,0,255|95.0|20.0|below|66.0";
+ gc = ff.parseGraduatedColourScheme("BETA-TURN-IR\t" + spec, spec);
+ assertTrue(gc.isAutoScaled());
+ // assertTrue(gc..getTolow());
+ }
+
+ /**
* Test parsing a features file with GFF formatted content only
*
* @throws Exception