From cb7bef47fe49963716fc33285fd4fb733ac95933 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 4 Jun 2015 12:05:55 +0100 Subject: [PATCH] JAL-1742 don't offer to align another chain to the same structure --- src/jalview/gui/ChimeraViewFrame.java | 13 ++++++++++++ .../structures/models/AAStructureBindingModel.java | 21 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index fda4afb..4372617 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -272,6 +272,14 @@ public class ChimeraViewFrame extends StructureViewerBase for (ChimeraViewFrame topView : existingViews) { // TODO: highlight topView in view somehow + /* + * JAL-1742 exclude view with this structure already mapped (don't offer + * to align chain B to chain A of the same structure) + */ + if (topView.hasPdbId(pdbentry.getId())) + { + continue; + } int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop, MessageManager.formatMessage("label.add_pdbentry_to_view", new Object[] @@ -296,6 +304,11 @@ public class ChimeraViewFrame extends StructureViewerBase { seq }); } + protected boolean hasPdbId(String pdbId) + { + return jmb.hasPdbId(pdbId); + } + private void openNewChimera(AlignmentPanel ap, PDBEntry[] pdbentrys, SequenceI[][] seqs) { diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 3602056..9186024 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -104,6 +104,27 @@ public abstract class AAStructureBindingModel extends } /** + * Answers true if this binding includes the given PDB id, else false + * + * @param pdbId + * @return + */ + public boolean hasPdbId(String pdbId) + { + if (pdbEntry != null) + { + for (PDBEntry pdb : pdbEntry) + { + if (pdb.getId().equals(pdbId)) + { + return true; + } + } + } + return false; + } + + /** * Returns the number of modelled PDB file entries. * * @return -- 1.7.10.2