From: jprocter Date: Thu, 3 Jun 2010 15:12:42 +0000 (+0000) Subject: patch and error reports re JAL-554 X-Git-Tag: Release_2_5_1~35 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=10e588500da51e79f255e000a46e65065a49f8aa;p=jalview.git patch and error reports re JAL-554 --- diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index aeaf2f3..2721fb2 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -982,45 +982,55 @@ public class AnnotationFile int graphGroup = -1; String group = st.nextToken(); // First make sure we are not overwriting the graphIndex - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) - { - if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) - { - graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1; - al.getAlignmentAnnotation()[i].graphGroup = graphGroup; - break; - } - } - - // Now update groups - while (st.hasMoreTokens()) + if (al.getAlignmentAnnotation() != null) { - group = st.nextToken(); for (int i = 0; i < al.getAlignmentAnnotation().length; i++) { if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) { + graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1; al.getAlignmentAnnotation()[i].graphGroup = graphGroup; break; } } + + // Now update groups + while (st.hasMoreTokens()) + { + group = st.nextToken(); + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + { + if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) + { + al.getAlignmentAnnotation()[i].graphGroup = graphGroup; + break; + } + } + } + } + else + { + System.err + .println("Couldn't combine annotations. None are added to alignment yet!"); } } void addLine(AlignmentI al, StringTokenizer st) { String group = st.nextToken(); - AlignmentAnnotation annotation = null; - - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + AlignmentAnnotation annotation = null, alannot[] = al + .getAlignmentAnnotation(); + if (alannot != null) { - if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) + for (int i = 0; i < alannot.length; i++) { - annotation = al.getAlignmentAnnotation()[i]; - break; + if (alannot[i].label.equalsIgnoreCase(group)) + { + annotation = alannot[i]; + break; + } } } - if (annotation == null) { return; @@ -1153,13 +1163,16 @@ public class AnnotationFile centerlab = Boolean.valueOf(value).booleanValue(); } AlignmentAnnotation[] alr = al.getAlignmentAnnotation(); - for (int i = 0; i < alr.length; i++) + if (alr != null) { - if (alr[i].label.equalsIgnoreCase(label)) + for (int i = 0; i < alr.length; i++) { - alr[i].centreColLabels = centerlab; - alr[i].scaleColLabel = scaletofit; - alr[i].showAllColLabels = showalllabs; + if (alr[i].label.equalsIgnoreCase(label)) + { + alr[i].centreColLabels = centerlab; + alr[i].scaleColLabel = scaletofit; + alr[i].showAllColLabels = showalllabs; + } } } } @@ -1290,19 +1303,35 @@ public class AnnotationFile void setBelowAlignment(AlignmentI al, StringTokenizer st) { String token; - AlignmentAnnotation aa; + AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation(); + if (ala == null) + { + System.err + .print("Warning - no annotation to set below for sequence associated annotation:"); + } while (st.hasMoreTokens()) { token = st.nextToken(); - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + if (ala == null) + { + System.err.print(" "+token); + } + else { - aa = al.getAlignmentAnnotation()[i]; - if (aa.sequenceRef == refSeq && aa.label.equals(token)) + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) { - aa.belowAlignment = true; + aa = al.getAlignmentAnnotation()[i]; + if (aa.sequenceRef == refSeq && aa.label.equals(token)) + { + aa.belowAlignment = true; + } } } } + if (ala==null) + { + System.err.print("\n"); + } } void addAlignmentDetails(AlignmentI al, StringTokenizer st)