From bf10bf9b8f2f4b680cceb1db258e65a2ecc84293 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 7 Feb 2018 12:50:36 +0000 Subject: [PATCH 1/1] =?utf8?q?JAL-2780=20JAL-2781=20don=E2=80=99t=20assume=20?= =?utf8?q?contiguous=20mapping=20to=20PDB=20residue=20numbering=20when=20gen?= =?utf8?q?erating=20Jmol=20colour=20commands=20(unmapped=20PDB=20residue=20d?= =?utf8?q?ata=20shouldn=E2=80=99t=20receive=20colour=20if=20mapped=20positio?= =?utf8?q?ns=20either=20side=20receive=20the=20same=20colour).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/ext/jmol/JmolCommands.java | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 6bf7010..7a52ba9 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -77,7 +77,6 @@ public class JmolCommands continue; } - int lastPos = -1; for (int s = 0; s < sequence[pdbfnum].length; s++) { for (int sp, m = 0; m < mapping.length; m++) @@ -85,6 +84,7 @@ public class JmolCommands if (mapping[m].getSequence() == sequence[pdbfnum][s] && (sp = al.findIndex(sequence[pdbfnum][s])) > -1) { + int lastPos = StructureMapping.UNASSIGNED_VALUE; SequenceI asp = al.getSequenceAt(sp); for (int r = 0; r < asp.getLength(); r++) { @@ -95,10 +95,22 @@ public class JmolCommands } int pos = mapping[m].getPDBResNum(asp.findPosition(r)); - if (pos < 1 || pos == lastPos) + if (pos == lastPos) { continue; } + if (pos == StructureMapping.UNASSIGNED_VALUE) + { + // terminate current colour op + if (command.length() > 0 + && command.charAt(command.length() - 1) != ';') + { + command.append(";"); + } + // reset lastPos + lastPos = StructureMapping.UNASSIGNED_VALUE; + continue; + } lastPos = pos; @@ -128,7 +140,12 @@ public class JmolCommands // TODO: deal with case when buffer is too large for Jmol to parse // - execute command and flush - command.append(";"); + if (command.length() > 0 + && command.charAt(command.length() - 1) == ';') + { + command.append(";"); + } + if (command.length() > 51200) { // add another chunk -- 1.7.10.2