X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FRNAHelicesColourChooser.java;h=45c374d2f2dab98cd767e6aa0e3cc536f2099447;hb=fe55e5ed429347087cccb692e014f23c01026327;hp=1edca4b2f76198ccd92289ee4242bdb5bc0b9560;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git diff --git a/src/jalview/schemes/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java index 1edca4b..45c374d 100644 --- a/src/jalview/schemes/RNAHelicesColourChooser.java +++ b/src/jalview/schemes/RNAHelicesColourChooser.java @@ -98,8 +98,24 @@ public class RNAHelicesColourChooser return; } - currentAnnotation = av.getAlignment().getAlignmentAnnotation()[0];// annotations.getSelectedIndex()]; - + // This loop will find the first rna structure annotation by which to colour + // the sequences. + AlignmentAnnotation[] annotations = av.getAlignment().getAlignmentAnnotation(); + for (int i = 0; i < annotations.length; i++) { + + // is this a sensible way of determining type of annotation? + if (annotations[i].getRNAStruc() != null) { + currentAnnotation = annotations[i]; + break; + } + } + if (currentAnnotation == null) + { + System.err.println("Jalview is about to try and colour by RNAHelices even" + + " though there are no RNA secondary structure annotations present!"); + currentAnnotation = av.getAlignment().getAlignmentAnnotation()[0];// annotations.getSelectedIndex()]; + } + RNAHelicesColour rhc = null; rhc = new RNAHelicesColour(currentAnnotation);