Merge branch 'develop' into bug/JAL-2255_seq-fetcher-broken-on-linux
[jalview.git] / src / jalview / schemes / RNAHelicesColour.java
index 9729a83..056a167 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.schemes;
 
 import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AnnotatedCollectionI;
 import jalview.datamodel.SequenceCollectionI;
 import jalview.datamodel.SequenceI;
@@ -54,6 +55,14 @@ public class RNAHelicesColour extends ResidueColourScheme
   public AlignmentAnnotation annotation;
 
   /**
+   * Default constructor (required for ColourSchemes cache)
+   */
+  public RNAHelicesColour()
+  {
+
+  }
+
+  /**
    * Creates a new RNAHelicesColour object.
    */
   public RNAHelicesColour(AlignmentAnnotation annotation)
@@ -197,9 +206,44 @@ public class RNAHelicesColour extends ResidueColourScheme
   }
 
   @Override
-  public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+  public ColourSchemeI getInstance(AnnotatedCollectionI sg,
           Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
   {
-    return new RNAHelicesColour(this);
+    return new RNAHelicesColour(sg);
+  }
+
+  @Override
+  public boolean isNucleotideSpecific()
+  {
+    return true;
+  }
+
+  /**
+   * Answers true if the data has RNA secondary structure annotation
+   */
+  @Override
+  public boolean isApplicableTo(AnnotatedCollectionI ac)
+  {
+    if (ac instanceof AlignmentI && ((AlignmentI) ac).hasRNAStructure())
+    {
+      return true;
+    }
+
+    /*
+     * not currently supporting this option for group annotation / colouring
+     */
+    return false;
+  }
+
+  @Override
+  public String getSchemeName()
+  {
+    return JalviewColourScheme.RNAHelices.toString();
+  }
+
+  @Override
+  public boolean isSimple()
+  {
+    return false;
   }
-}
\ No newline at end of file
+}