JAL-4048 fix disappearing sequence IDs, and non-positional feature descriptions
authorJim Procter <j.procter@dundee.ac.uk>
Fri, 22 Jul 2022 15:37:33 +0000 (16:37 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Fri, 22 Jul 2022 15:37:33 +0000 (16:37 +0100)
src/jalview/gui/IdCanvas.java
src/jalview/viewmodel/seqfeatures/IdColumns.java

index e284bbe..68a7a1e 100755 (executable)
@@ -321,11 +321,11 @@ public class IdCanvas extends JPanel implements ViewportListenerI
     int colWid = 20;
     int panelWidth = Math.max(fullPanelWidth / 2,
             fullPanelWidth - (colWid * visible.size()));
-    int xPos = 0;
 
     // Now draw the id strings
     for (int i = startSeq; i <= endSeq; i++)
     {
+      int xPos = 0;
       SequenceI sequence = alignViewport.getAlignment().getSequenceAt(i);
 
       if (sequence == null)
@@ -377,28 +377,33 @@ public class IdCanvas extends JPanel implements ViewportListenerI
 
       if (visible != null && visible.size() > 0)
       {
-        xPos = panelWidth + 2;
-        for (IdColumn col : visible)
+        try
         {
-          ColumnCell col_cell = id_cols.getCellFor(sequence, col);
-          if (col_cell == null)
-          {
-            g.setColor(Color.gray);
-            g.fillRect(xPos, (i - startSeq) * charHeight, xPos + colWid - 4,
-                    charHeight);
-          }
-          else
+          xPos = panelWidth + 2;
+          for (IdColumn col : visible)
           {
-            g.setColor(col_cell.bg);
-            g.fillRect(xPos, (i - startSeq) * charHeight, xPos + colWid - 4,
-                    charHeight);
-            g.setColor(col_cell.fg);
-            g.drawString(col_cell.label, xPos,
-                    (((i - startSeq) * charHeight) + charHeight)
-                            - (charHeight / 5));
+            ColumnCell col_cell = id_cols.getCellFor(sequence, col);
+            if (col_cell == null)
+            {
+              g.setColor(Color.gray);
+              g.fillRect(xPos + 1, (i - startSeq) * charHeight,
+                      xPos + colWid - 3, charHeight);
+            }
+            else
+            {
+              g.setColor(col_cell.bg);
+              g.fillRect(xPos + 1, (i - startSeq) * charHeight,
+                      xPos + colWid - 3, charHeight);
+              g.setColor(col_cell.fg);
+              g.drawString(col_cell.label, xPos,
+                      (((i - startSeq) * charHeight) + charHeight)
+                              - (charHeight / 5));
+            }
+            xPos += colWid;
+            g.setColor(currentTextColor);
           }
-          xPos += colWid;
-          g.setColor(currentTextColor);
+        } catch (Exception q)
+        {
         }
       }
       if (hasHiddenRows && av.getShowHiddenMarkers())
index 2f113f2..b375941 100644 (file)
@@ -148,13 +148,14 @@ public class IdColumns
     ColumnCell cell = null;
     if (col != null)
     {
+      SequenceI dseq = seq;
+      while (dseq.getDatasetSequence() != null)
+      {
+        dseq = dseq.getDatasetSequence();
+      }
       if (col == STRUCTURES_NUM)
       {
-        while (seq.getDatasetSequence() != null)
-        {
-          seq = seq.getDatasetSequence();
-        }
-        Vector pdbE = seq.getAllPDBEntries();
+        Vector pdbE = dseq.getAllPDBEntries();
         if (pdbE == null)
         {
           return null;
@@ -163,7 +164,7 @@ public class IdColumns
       }
       if (col.featureTypeName != null)
       {
-        List<SequenceFeature> np = seq.getFeatures()
+        List<SequenceFeature> np = dseq.getFeatures()
                 .getNonPositionalFeatures(col.featureTypeName);
         if (np != null)
         {
@@ -183,7 +184,7 @@ public class IdColumns
       }
       if (col.DbRefName != null)
       {
-        for (DBRefEntryI dbr : seq.getDBRefs())
+        for (DBRefEntryI dbr : dseq.getDBRefs())
         {
           if (dbr.getSource().equals(col.DbRefName))
           {