JAL-4308 reduce number of refs to 5, always have canonical reference first.
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 23 Oct 2023 08:24:43 +0000 (09:24 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 23 Oct 2023 08:24:43 +0000 (09:24 +0100)
src/jalview/io/SequenceAnnotationReport.java
test/jalview/io/SequenceAnnotationReportTest.java

index 721cd47..0a1172c 100644 (file)
@@ -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;
index bb5d1c4..9391eb1 100644 (file)
@@ -432,8 +432,7 @@ public class SequenceAnnotationReportTest
     assertTrue(report.startsWith("<i>\n" + "<br/>\n" + "UNIPROT P30410,\n"
             + " P30411,\n" + " P30412,\n" + " P30413,...<br/>\n"
             + "PDB0 3iu1<br/>\n" + "PDB1 3iu1<br/>"));
-    assertTrue(report.endsWith("PDB5 3iu1<br/>\n" + "PDB6 3iu1<br/>\n"
-            + "PDB7 3iu1<br/>\n" + "PDB8,...<br/>\n"
+    assertTrue(report.endsWith("PDB3 3iu1<br/>\n"+"PDB4,...<br/>\n"
             + "(Output Sequence Details to list all database references)\n"
             + "</i>"));
   }