JAL-2371 pull up isNucleotide to SequenceCollectionI
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 9 Jan 2017 12:02:33 +0000 (12:02 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 9 Jan 2017 12:02:33 +0000 (12:02 +0000)
examples/groovy/colourSchemes.groovy
src/jalview/datamodel/AlignmentI.java
src/jalview/datamodel/SequenceCollectionI.java
src/jalview/datamodel/SequenceGroup.java

index a5b60c8..d5ca973 100644 (file)
@@ -82,7 +82,8 @@ def byWeight
 byWeight = { ->
   [
     getSchemeName: { 'By Weight' },
-    isApplicableTo: { coll -> true },
+    // this colour scheme is peptide-specific:
+    isApplicableTo: { coll -> !coll.isNucleotide() },
     alignmentChanged: { coll, map -> },
     getInstance: { coll, map -> byWeight() },
     isSimple: { true },
index a0b3ff1..752235b 100755 (executable)
@@ -285,13 +285,6 @@ public interface AlignmentI extends AnnotatedCollectionI
   char getGapCharacter();
 
   /**
-   * Test for all nucleotide alignment
-   * 
-   * @return true if alignment is nucleotide sequence
-   */
-  boolean isNucleotide();
-
-  /**
    * Test if alignment contains RNA structure
    * 
    * @return true if RNA structure AligmnentAnnotation was added to alignment
index aca79c8..f681f11 100644 (file)
@@ -64,4 +64,10 @@ public interface SequenceCollectionI
    */
   int getEndRes();
 
+  /**
+   * Answers true if sequence data is nucleotide (according to some heuristic)
+   * 
+   * @return
+   */
+  boolean isNucleotide();
 }
index aa2e1c5..8218ba7 100755 (executable)
@@ -1390,4 +1390,14 @@ public class SequenceGroup implements AnnotatedCollectionI
   {
     return cs;
   }
+
+  @Override
+  public boolean isNucleotide()
+  {
+    if (context != null && context instanceof AlignmentI)
+    {
+      return ((AlignmentI) context).isNucleotide();
+    }
+    return false;
+  }
 }