From 244520d01226040ec02eb8560bf0b181932797cf Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 9 Jan 2017 12:02:33 +0000 Subject: [PATCH] JAL-2371 pull up isNucleotide to SequenceCollectionI --- examples/groovy/colourSchemes.groovy | 3 ++- src/jalview/datamodel/AlignmentI.java | 7 ------- src/jalview/datamodel/SequenceCollectionI.java | 6 ++++++ src/jalview/datamodel/SequenceGroup.java | 10 ++++++++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/examples/groovy/colourSchemes.groovy b/examples/groovy/colourSchemes.groovy index a5b60c8..d5ca973 100644 --- a/examples/groovy/colourSchemes.groovy +++ b/examples/groovy/colourSchemes.groovy @@ -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 }, diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index a0b3ff1..752235b 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -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 diff --git a/src/jalview/datamodel/SequenceCollectionI.java b/src/jalview/datamodel/SequenceCollectionI.java index aca79c8..f681f11 100644 --- a/src/jalview/datamodel/SequenceCollectionI.java +++ b/src/jalview/datamodel/SequenceCollectionI.java @@ -64,4 +64,10 @@ public interface SequenceCollectionI */ int getEndRes(); + /** + * Answers true if sequence data is nucleotide (according to some heuristic) + * + * @return + */ + boolean isNucleotide(); } diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index aa2e1c5..8218ba7 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -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; + } } -- 1.7.10.2