From ee5064ad5cba56f7b2423e8023e5c60204ba0878 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 3 Jun 2010 15:13:49 +0000 Subject: [PATCH] patch ensuring annotation is output correctly re * JAL-554 --- src/jalview/gui/PopupMenu.java | 10 ++++++---- src/jalview/io/FormatAdapter.java | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 96e61e9..a98c1da 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -1698,10 +1698,12 @@ public class PopupMenu extends JPopupMenu omitHidden = ap.av.getViewAsString(true); Alignment oal = new Alignment(ap.av.getSequenceSelection()); AlignmentAnnotation[] nala = ap.av.alignment.getAlignmentAnnotation(); - for (int i = 0; i < nala.length; i++) - { - AlignmentAnnotation na = nala[i]; - oal.addAnnotation(na); + if (nala!=null) { + for (int i = 0; i < nala.length; i++) + { + AlignmentAnnotation na = nala[i]; + oal.addAnnotation(na); + } } cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), oal, omitHidden, csel, sg)); diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index dc0526d..3c741f4 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -198,19 +198,22 @@ public class FormatAdapter extends AppletFormatAdapter Alignment alv = new Alignment(replaceStrings(alignment .getSequencesArray(), omitHidden)); AlignmentAnnotation[] ala = alignment.getAlignmentAnnotation(); - for (int i = 0; i < ala.length; i++) + if (ala != null) { - AlignmentAnnotation na = new AlignmentAnnotation(ala[i]); - if (selgp != null) + for (int i = 0; i < ala.length; i++) { - colSel.makeVisibleAnnotation(selgp.getStartRes(), selgp - .getEndRes(), na); + AlignmentAnnotation na = new AlignmentAnnotation(ala[i]); + if (selgp != null) + { + colSel.makeVisibleAnnotation(selgp.getStartRes(), selgp + .getEndRes(), na); + } + else + { + colSel.makeVisibleAnnotation(na); + } + alv.addAnnotation(na); } - else - { - colSel.makeVisibleAnnotation(na); - } - alv.addAnnotation(na); } return this.formatSequences(format, alv, suffix); } -- 1.7.10.2