From cac1ed6669adb3fc93af536cfe3c5a5301e7b2ad Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 18 Apr 2014 10:56:53 +0100 Subject: [PATCH] JAL-1476 - don't send broken commands to Jmol when no columns exist to superimpose structures --- src/jalview/ext/jmol/JalviewJmolBinding.java | 43 ++++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 8dfb9fd..46c94c4 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -543,22 +543,27 @@ public abstract class JalviewJmolBinding implements StructureListener, molsel.append(chainCd); molsel.append("}"); } - selcom[pdbfnum] = molsel.toString(); - selectioncom.append("(("); - selectioncom.append(selcom[pdbfnum].substring(1, - selcom[pdbfnum].length() - 1)); - selectioncom.append(" )& "); - selectioncom.append(pdbfnum + 1); - selectioncom.append(".1)"); - if (pdbfnum < files.length - 1) + if (molsel.length() > 1) { - selectioncom.append("|"); + selcom[pdbfnum] = molsel.toString(); + selectioncom.append("(("); + selectioncom.append(selcom[pdbfnum].substring(1, + selcom[pdbfnum].length() - 1)); + selectioncom.append(" )& "); + selectioncom.append(pdbfnum + 1); + selectioncom.append(".1)"); + if (pdbfnum < files.length - 1) + { + selectioncom.append("|"); + } + } else { + selcom[pdbfnum] = null; } } } for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { - if (pdbfnum == refStructure) + if (pdbfnum == refStructure || selcom[pdbfnum]==null || selcom[refStructure]==null) { continue; } @@ -582,13 +587,17 @@ public abstract class JalviewJmolBinding implements StructureListener, } command.append(" ROTATE TRANSLATE;\n"); } - System.out.println("Select regions:\n" + selectioncom.toString()); - evalStateCommand("select *; cartoons off; backbone; select (" - + selectioncom.toString() + "); cartoons; "); - // selcom.append("; ribbons; "); - System.out.println("Superimpose command(s):\n" + command.toString()); - - evalStateCommand(command.toString()); + if (selectioncom.length() > 0) + { + System.out.println("Select regions:\n" + selectioncom.toString()); + evalStateCommand("select *; cartoons off; backbone; select (" + + selectioncom.toString() + "); cartoons; "); + // selcom.append("; ribbons; "); + System.out + .println("Superimpose command(s):\n" + command.toString()); + + evalStateCommand(command.toString()); + } } if (selectioncom.length() > 0) {// finally, mark all regions that were superposed. -- 1.7.10.2