From b19880049cdb11882e68c75d7960465be4aa8665 Mon Sep 17 00:00:00 2001 From: James Procter Date: Mon, 23 Oct 2023 09:24:43 +0100 Subject: [PATCH 1/1] JAL-4308 reduce number of refs to 5, always have canonical reference first. --- src/jalview/io/SequenceAnnotationReport.java | 11 ++++++++++- test/jalview/io/SequenceAnnotationReportTest.java | 3 +-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 721cd47..0a1172c 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -55,7 +55,7 @@ public class SequenceAnnotationReport private static final int MAX_REFS_PER_SOURCE = 4; - private static final int MAX_SOURCES = 40; + private static final int MAX_SOURCES = 5; private static String linkImageURL; @@ -79,10 +79,19 @@ public class SequenceAnnotationReport { return 1; } + String s1 = ref1.getSource(); String s2 = ref2.getSource(); boolean s1Primary = DBRefSource.isPrimarySource(s1); boolean s2Primary = DBRefSource.isPrimarySource(s2); + if (ref1.isCanonical() && !ref2.isCanonical()) + { + return -1; + } + if (!ref1.isCanonical() && ref2.isCanonical()) + { + return 1; + } if (s1Primary && !s2Primary) { return -1; diff --git a/test/jalview/io/SequenceAnnotationReportTest.java b/test/jalview/io/SequenceAnnotationReportTest.java index bb5d1c4..9391eb1 100644 --- a/test/jalview/io/SequenceAnnotationReportTest.java +++ b/test/jalview/io/SequenceAnnotationReportTest.java @@ -432,8 +432,7 @@ public class SequenceAnnotationReportTest assertTrue(report.startsWith("\n" + "
\n" + "UNIPROT P30410,\n" + " P30411,\n" + " P30412,\n" + " P30413,...
\n" + "PDB0 3iu1
\n" + "PDB1 3iu1
")); - assertTrue(report.endsWith("PDB5 3iu1
\n" + "PDB6 3iu1
\n" - + "PDB7 3iu1
\n" + "PDB8,...
\n" + assertTrue(report.endsWith("PDB3 3iu1
\n"+"PDB4,...
\n" + "(Output Sequence Details to list all database references)\n" + "
")); } -- 1.7.10.2