X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemes%2FRNAHelicesColour.java;h=056a1676a4801cebe663a150a07e60437ce94af1;hb=424f6f03e8fb5e40cceca09fc8ffd72b41e3a9e4;hp=ffc013d654ced7a2ad6b1e113356cbcc33070553;hpb=60b63ec67604be95d1be4ff04e51c5705b05b109;p=jalview.git diff --git a/src/jalview/schemes/RNAHelicesColour.java b/src/jalview/schemes/RNAHelicesColour.java index ffc013d..056a167 100644 --- a/src/jalview/schemes/RNAHelicesColour.java +++ b/src/jalview/schemes/RNAHelicesColour.java @@ -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; @@ -40,7 +41,6 @@ import java.util.Map; public class RNAHelicesColour extends ResidueColourScheme { - /** * Maps sequence positions to the RNA helix they belong to. Key: position, * Value: helix TODO: Revise or drop in favour of annotation position numbers @@ -55,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) @@ -92,6 +100,10 @@ public class RNAHelicesColour extends ResidueColourScheme // This loop will find the first rna structure annotation by which to colour // the sequences. AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation(); + if (annotations == null) + { + return; + } for (int i = 0; i < annotations.length; i++) { @@ -194,9 +206,44 @@ public class RNAHelicesColour extends ResidueColourScheme } @Override - public ColourSchemeI applyTo(AnnotatedCollectionI sg, + public ColourSchemeI getInstance(AnnotatedCollectionI sg, Map 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 +}