JAL-2755 put chromosomal dbref first in report
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 19 Oct 2017 14:01:56 +0000 (15:01 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 19 Oct 2017 14:01:56 +0000 (15:01 +0100)
src/jalview/io/SequenceAnnotationReport.java

index f1ebcac..13f41d4 100644 (file)
@@ -58,7 +58,7 @@ public class SequenceAnnotationReport
 
   /*
    * Comparator to order DBRefEntry by Source + accession id (case-insensitive),
-   * with 'Primary' sources placed before others
+   * with 'Primary' sources placed before others, and 'chromosome' first of all
    */
   private static Comparator<DBRefEntry> comparator = new Comparator<DBRefEntry>()
   {
@@ -66,6 +66,14 @@ public class SequenceAnnotationReport
     @Override
     public int compare(DBRefEntry ref1, DBRefEntry ref2)
     {
+      if (ref1.isChromosome())
+      {
+        return -1;
+      }
+      if (ref2.isChromosome())
+      {
+        return 1;
+      }
       String s1 = ref1.getSource();
       String s2 = ref2.getSource();
       boolean s1Primary = isPrimarySource(s1);