+package jalview.schemes;
+
+import jalview.api.FeatureColourI;
+import jalview.api.FeatureSettingsI;
+
+import java.awt.Color;
+
+/**
+ * Pre-set configurations for feature settings
+ *
+ * @author gmcarstairs
+ *
+ */
+public enum FeatureColourScheme implements FeatureSettingsI
+{
+ /**
+ * Show sequence variants in red, on top of exons coloured by label
+ */
+ EnsemblVariants
+ {
+
+ @Override
+ public boolean isFeatureDisplayed(String type)
+ {
+ // TODO accept SO sub-types of these features
+ // if (SequenceOntologyFactory.getInstance().isA(SequenceOntologyI.EXON...
+ return (EXON.equals(type) || SEQUENCE_VARIANT.equals(type));
+ }
+
+ @Override
+ public boolean isGroupDisplayed(String group)
+ {
+ return true;
+ }
+
+ @Override
+ public FeatureColourI getFeatureColour(String type)
+ {
+ if (EXON.equals(type))
+ {
+ return new FeatureColourAdapter()
+ {
+ @Override
+ public boolean isColourByLabel()
+ {
+ return true;
+ }
+ };
+ }
+ if (SEQUENCE_VARIANT.equals(type))
+ {
+ return new FeatureColourAdapter()
+ {
+
+ @Override
+ public Color getColour()
+ {
+ return Color.RED;
+ }
+ };
+ }
+ return null;
+ }
+
+ @Override
+ public float getTransparency()
+ {
+ return 1f;
+ }
+
+ /**
+ * Order sequence_variant above exon above the rest
+ */
+ @Override
+ public int compareTo(String feature1, String feature2)
+ {
+ if (SEQUENCE_VARIANT.equals(feature1))
+ {
+ return -1;
+ }
+ if (SEQUENCE_VARIANT.equals(feature2))
+ {
+ return +1;
+ }
+ if (EXON.equals(feature1))
+ {
+ return -1;
+ }
+ if (EXON.equals(feature2))
+ {
+ return +1;
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean optimiseOrder()
+ {
+ return false;
+ };
+
+ };
+
+ // SequenceOntologyI.SEQUENCE_VARIANT
+ private static final String SEQUENCE_VARIANT = "sequence_variant";
+
+ // SequenceOntologyI.EXON
+ private static final String EXON = "exon";
+}