From: James Procter Date: Mon, 17 Apr 2023 08:46:23 +0000 (+0100) Subject: JAL-4047 JAL-4948 show count of each dbref authority and 'first' reference X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=265e81c0b3599a09c312f17188e3a892e9d96c4e;p=jalview.git JAL-4047 JAL-4948 show count of each dbref authority and 'first' reference --- diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 47da7fc..f50b72b 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -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(), diff --git a/src/jalview/viewmodel/seqfeatures/IdColumns.java b/src/jalview/viewmodel/seqfeatures/IdColumns.java index 5b16b1a..a938d63 100644 --- a/src/jalview/viewmodel/seqfeatures/IdColumns.java +++ b/src/jalview/viewmodel/seqfeatures/IdColumns.java @@ -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 refs = new ArrayList(); 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