From 232cf5553922cdce72a86336e9278c4c455d73a5 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 14 Nov 2018 15:18:23 +0000 Subject: [PATCH] JAL-3152 holding patch for colour Jmol by sequence --- src/jalview/ext/jmol/JmolCommands.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 8fb0de6..603202a 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -68,7 +68,7 @@ public class JmolCommands for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); - StringBuffer command = new StringBuffer(); + StringBuilder command = new StringBuilder(); StructureMappingcommandSet smc; ArrayList str = new ArrayList(); @@ -125,9 +125,12 @@ public class JmolCommands col = Color.GRAY; } - String newSelcom = (mapping[m].getChain() != " " + // todo JAL-3152 handle 'no chain' case without errors + boolean hasChain = true || mapping[m].getChain() != " "; + String chainSpec = hasChain ? ":" + mapping[m].getChain() - : "") + "/" + (pdbfnum + 1) + ".1" + ";color[" + : ""; + String newSelcom = chainSpec + "/" + (pdbfnum + 1) + ".1" + ";color[" + col.getRed() + "," + col.getGreen() + "," + col.getBlue() + "]"; if (command.length() > newSelcom.length() && command @@ -172,7 +175,7 @@ public class JmolCommands return cset.toArray(new StructureMappingcommandSet[cset.size()]); } - public static StringBuffer condenseCommand(StringBuffer command, int pos) + public static StringBuilder condenseCommand(StringBuilder command, int pos) { // work back to last 'select' @@ -187,7 +190,7 @@ public class JmolCommands ; } while ((q = command.indexOf("select", p)) == -1 && p > 0); - StringBuffer sb = new StringBuffer(command.substring(0, q + 7)); + StringBuilder sb = new StringBuilder(command.substring(0, q + 7)); command = command.delete(0, q + 7); -- 1.7.10.2