From dadeab44d8d46ef588e326efb69599baa86a083b Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 12 May 2020 14:20:15 +0100 Subject: [PATCH] JAL-3518 tidy method, remove obsolete comment --- src/jalview/ext/jmol/JalviewJmolBinding.java | 42 +++++--------------- .../structures/models/AAStructureBindingModel.java | 1 - 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 061271a..08ea052 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -260,52 +260,32 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbfile) { - if (modelFileNames == null) - { - return; - } - - // look up file model number for this pdbfile - int mdlNum = 0; - // may need to adjust for URLencoding here - we don't worry about that yet. - while (mdlNum < modelFileNames.length - && !pdbfile.equals(modelFileNames[mdlNum])) - { - mdlNum++; - } - if (mdlNum == modelFileNames.length) + String modelId = getModelIdForFile(pdbfile); + if (modelId.isEmpty()) { return; } jmolHistory(false); + StringBuilder selection = new StringBuilder(32); StringBuilder cmd = new StringBuilder(64); - cmd.append("select ").append(String.valueOf(pdbResNum)); // +modelNum - - resetLastRes.append("select ").append(String.valueOf(pdbResNum)); // +modelNum - - cmd.append(":"); - resetLastRes.append(":"); + selection.append("select ").append(String.valueOf(pdbResNum)); + selection.append(":"); if (!chain.equals(" ")) { - cmd.append(chain); - resetLastRes.append(chain); + selection.append(chain); } - { - cmd.append(" /").append(String.valueOf(mdlNum + 1)); - resetLastRes.append("/").append(String.valueOf(mdlNum + 1)); - } - cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;"); + selection.append(" /").append(modelId); - resetLastRes.append(";wireframe 0;" + resetLastRes.toString() - + " and not hetero; spacefill 0;"); + cmd.append(selection).append(";wireframe 100;").append(selection) + .append(" and not hetero;").append("spacefill 200;select none"); - cmd.append("spacefill 200;select none"); + resetLastRes.append(selection).append(";wireframe 0;").append(selection) + .append(" and not hetero; spacefill 0;"); jmolViewer.evalStringQuiet(cmd.toString()); jmolHistory(true); - } private boolean debug = true; diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 7899c40..88c181c 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -1374,7 +1374,6 @@ public abstract class AAStructureBindingModel for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { - // todo indirect this resolution / allow override final String modelId = getModelIdForFile(files[pdbfnum]); StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); -- 1.7.10.2