From: gmungoc Date: Wed, 14 Nov 2018 15:18:23 +0000 (+0000) Subject: JAL-3152 holding patch for colour Jmol by sequence X-Git-Tag: Release_2_11_4_0~45^2~18^2~404 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=232cf5553922cdce72a86336e9278c4c455d73a5;p=jalview.git JAL-3152 holding patch for colour Jmol by sequence --- 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);