From: Jim Procter Date: Thu, 22 Jul 2021 19:36:13 +0000 (+0100) Subject: JAL-3853 patch sequence annotation report code and tweak the test. When merging from... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f6cb90d43782ca99cf2b1cbee2dc76bca3d1d466;p=jalview.git JAL-3853 patch sequence annotation report code and tweak the test. When merging from 2.11.2 develop there will be conflicts that need merging re HTMLXML tags --- diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index d5c3ed3..6adc419 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -488,20 +488,27 @@ public class SequenceAnnotationReport ds = ds.getDatasetSequence(); } + /* * add any annotation scores */ AlignmentAnnotation[] anns = ds.getAnnotation(); - for (int i = 0; anns != null && i < anns.length; i++) - { - AlignmentAnnotation aa = anns[i]; - if (aa != null && aa.hasScore() && aa.sequenceRef != null) + if (anns!=null && anns.length>0) { + boolean first=true; + for (int i = 0; anns != null && i < anns.length; i++) { - sb.append("
").append(aa.label).append(": ") - .append(aa.getScore()); + AlignmentAnnotation aa = anns[i]; + if (aa != null && aa.hasScore() && aa.sequenceRef != null) + { + if (first) { + sb.append("
").append("Annotation Scores
"); + first=false; + } + sb.append("
").append(aa.label).append(": ") + .append(aa.getScore()); + } } } - if (showDbRefs) { maxWidth = Math.max(maxWidth, appendDbRefs(sb, ds, summary)); @@ -535,8 +542,8 @@ public class SequenceAnnotationReport sb.append(bitScore); maxWidth = Math.max(maxWidth, eValue.length()); maxWidth = Math.max(maxWidth, bitScore.length()); + sb.append("
"); } - sb.append("
"); sb.append(""); return maxWidth; diff --git a/test/jalview/io/SequenceAnnotationReportTest.java b/test/jalview/io/SequenceAnnotationReportTest.java index f3a7586..35317c6 100644 --- a/test/jalview/io/SequenceAnnotationReportTest.java +++ b/test/jalview/io/SequenceAnnotationReportTest.java @@ -290,7 +290,7 @@ public class SequenceAnnotationReportTest seq.addSequenceFeature(new SequenceFeature("Domain", "Ferredoxin", 5, 10, 1f, null)); sar.createSequenceAnnotationReport(sb, seq, true, true, null); - assertEquals("SeqDesc", sb.toString()); + assertEquals("SeqDesc
", sb.toString()); /* * non-positional feature