From 1d17220cc3868f513b5e310a5d09b0f419f13d84 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 15 Mar 2016 15:19:46 +0000 Subject: [PATCH] JAL-2016 corrected Javadoc, added test for anonymous instance --- src/jalview/api/FeatureSettingsModelI.java | 9 ++++++-- test/jalview/ext/ensembl/EnsemblGeneTest.java | 29 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/jalview/api/FeatureSettingsModelI.java b/src/jalview/api/FeatureSettingsModelI.java index 28f5c77..c0fc523 100644 --- a/src/jalview/api/FeatureSettingsModelI.java +++ b/src/jalview/api/FeatureSettingsModelI.java @@ -68,8 +68,13 @@ public interface FeatureSettingsModelI extends Comparator 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. + * + *
+ * 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 diff --git a/test/jalview/ext/ensembl/EnsemblGeneTest.java b/test/jalview/ext/ensembl/EnsemblGeneTest.java index d1c7e2f..5cf296c 100644 --- a/test/jalview/ext/ensembl/EnsemblGeneTest.java +++ b/test/jalview/ext/ensembl/EnsemblGeneTest.java @@ -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()); + } } -- 1.7.10.2