JAL-4047 JAL-4948 show count of each dbref authority and 'first' reference
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 17 Apr 2023 08:46:23 +0000 (09:46 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 17 Apr 2023 08:46:23 +0000 (09:46 +0100)
src/jalview/gui/PopupMenu.java
src/jalview/viewmodel/seqfeatures/IdColumns.java

index 47da7fc..f50b72b 100644 (file)
@@ -741,6 +741,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
     JMenu dis_cols = new JMenu(
             MessageManager.getString("action.displayed_columns"));
     final IdColumns id_cols = ap.av.getIdColumns();
+    id_cols.updateTypeList();
     for (final IdColumn col : id_cols.getIdColumns())
     {
       JMenuItem col_entry = new JCheckBoxMenuItem(col.getLabel(),
index 5b16b1a..a938d63 100644 (file)
@@ -8,6 +8,7 @@ import java.util.Vector;
 
 import jalview.api.DBRefEntryI;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.features.SequenceFeaturesI;
@@ -90,9 +91,12 @@ public class IdColumns
           updateListForFeature(sf);
         }
       }
-      for (DBRefEntryI dbr : seq.getDBRefs())
+      if (seq.getDBRefs() != null)
       {
-        updateListForDbxref(dbr);
+        for (DBRefEntryI dbr : seq.getDBRefs())
+        {
+          updateListForDbxref(dbr);
+        }
       }
     }
   }
@@ -184,14 +188,26 @@ public class IdColumns
       }
       if (col.DbRefName != null)
       {
+        List<DBRefEntryI> refs = new ArrayList<DBRefEntryI>();
         for (DBRefEntryI dbr : dseq.getDBRefs())
         {
           if (dbr.getSource().equals(col.DbRefName))
           {
-            return new ColumnCell(dbr.getAccessionId(), Color.black,
-                    Color.white);
+            refs.add(dbr);
           }
         }
+        if (refs.size()==0)
+        {
+          return null;
+        }
+        StringBuilder dbr = new StringBuilder();
+        dbr.append(refs.size());
+        for (DBRefEntryI ref : refs)
+        {
+          dbr.append(" "+ref.getAccessionId());
+        }
+        return new ColumnCell(dbr.toString(), Color.black, Color.white);
+
       }
     }
     // no value for this sequence in given column