JAL-2360 ColourSchemes holds configured schemes, AlignFrame colour menu
[jalview.git] / src / jalview / schemes / Blosum62ColourScheme.java
index 83a3cd6..5eabc75 100755 (executable)
@@ -20,6 +20,7 @@
  */
 package jalview.schemes;
 
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AnnotatedCollectionI;
 import jalview.datamodel.SequenceCollectionI;
 import jalview.datamodel.SequenceI;
@@ -38,6 +39,17 @@ public class Blosum62ColourScheme extends ResidueColourScheme
     super();
   }
 
+  /**
+   * Returns a new instance of this colour scheme with which the given data may
+   * be coloured
+   */
+  @Override
+  public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+          Map<SequenceI, SequenceCollectionI> hrs)
+  {
+    return new Blosum62ColourScheme();
+  }
+
   @Override
   public Color findColour(char res, int j, SequenceI seq)
   {
@@ -101,14 +113,6 @@ public class Blosum62ColourScheme extends ResidueColourScheme
   }
 
   @Override
-  public ColourSchemeI applyTo(AnnotatedCollectionI sg,
-          Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
-  {
-    ColourSchemeI newcs = super.applyTo(sg, hiddenRepSequences);
-    return newcs;
-  }
-
-  @Override
   public boolean isPeptideSpecific()
   {
     return true;
@@ -119,4 +123,25 @@ public class Blosum62ColourScheme extends ResidueColourScheme
   {
     return JalviewColourScheme.Blosum62.toString();
   }
+
+  /**
+   * Answers true if Conservation annotation is present, else false
+   */
+  @Override
+  public boolean isApplicableTo(AnnotatedCollectionI ac)
+  {
+    AlignmentAnnotation[] anns = ac.getAlignmentAnnotation();
+    if (anns == null)
+    {
+      return false;
+    }
+    for (AlignmentAnnotation ann : anns)
+    {
+      if ("Conservation".equals(ann.label))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
 }