JAL-2016 corrected Javadoc, added test for anonymous instance
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 15 Mar 2016 15:19:46 +0000 (15:19 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 15 Mar 2016 15:19:46 +0000 (15:19 +0000)
src/jalview/api/FeatureSettingsModelI.java
test/jalview/ext/ensembl/EnsemblGeneTest.java

index 28f5c77..c0fc523 100644 (file)
@@ -68,8 +68,13 @@ public interface FeatureSettingsModelI extends Comparator<String>
   float getTransparency();
 
   /**
-   * Returns -1 if feature1 'precedes' (is displayed on top of) feature 2, +1 if
-   * feature2 is on top of feature1, or 0 if we don't care
+   * Returns -1 if feature1 is displayed before (below) feature 2, +1 if
+   * feature2 is displayed after (on top of) feature1, or 0 if we don't care.
+   * 
+   * <br>
+   * Note that this is the opposite ordering to how features are displayed in
+   * the feature settings dialogue. FeatureRendererModel.setFeaturePriority
+   * takes care of converting between the two.
    * 
    * @param feature1
    * @param feature2
index d1c7e2f..5cf296c 100644 (file)
@@ -5,6 +5,7 @@ import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertSame;
 import static org.testng.AssertJUnit.assertTrue;
 
+import jalview.api.FeatureSettingsModelI;
 import jalview.datamodel.SequenceDummy;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
@@ -12,6 +13,7 @@ import jalview.io.gff.SequenceOntologyFactory;
 import jalview.io.gff.SequenceOntologyLite;
 import jalview.util.MapList;
 
+import java.awt.Color;
 import java.util.List;
 
 import org.testng.annotations.AfterClass;
@@ -233,4 +235,31 @@ public class EnsemblGeneTest
     sf.setType("exon");
     assertFalse(testee.identifiesSequence(sf, accId));
   }
+
+  /**
+   * Check behaviour of feature colour scheme for EnsemblGene sequences.
+   * Currently coded to display exon and sequence_variant (or sub-types) only,
+   * with sequence_variant in red above exon coloured by label.
+   */
+  @Test(groups = "Functional")
+  public void testGetFeatureColourScheme()
+  {
+    FeatureSettingsModelI fc = new EnsemblGene().getFeatureColourScheme();
+    assertTrue(fc.isFeatureDisplayed("exon"));
+    assertTrue(fc.isFeatureDisplayed("coding_exon")); // subtype of exon
+    assertTrue(fc.isFeatureDisplayed("sequence_variant"));
+    assertTrue(fc.isFeatureDisplayed("feature_variant")); // subtype
+    assertFalse(fc.isFeatureDisplayed("transcript"));
+    assertEquals(Color.RED, fc.getFeatureColour("sequence_variant")
+            .getColour());
+    assertEquals(Color.RED, fc.getFeatureColour("feature_variant")
+            .getColour());
+    assertTrue(fc.getFeatureColour("exon").isColourByLabel());
+    assertTrue(fc.getFeatureColour("coding_exon").isColourByLabel());
+    assertEquals(1, fc.compare("sequence_variant", "exon"));
+    assertEquals(-1, fc.compare("exon", "sequence_variant"));
+    assertEquals(1, fc.compare("feature_variant", "coding_exon"));
+    assertEquals(-1, fc.compare("coding_exon", "feature_variant"));
+    assertEquals(1f, fc.getTransparency());
+  }
 }