From: gmungoc Date: Thu, 4 Jun 2015 11:05:55 +0000 (+0100) Subject: JAL-1742 don't offer to align another chain to the same structure X-Git-Tag: Release_2_10_0~639 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=cb7bef47fe49963716fc33285fd4fb733ac95933;p=jalview.git JAL-1742 don't offer to align another chain to the same structure --- 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