From: Jim Procter Date: Fri, 18 Apr 2014 09:56:53 +0000 (+0100) Subject: JAL-1476 - don't send broken commands to Jmol when no columns exist to superimpose... X-Git-Tag: Jalview_2_9~123^2~38 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cac1ed6669adb3fc93af536cfe3c5a5301e7b2ad;p=jalview.git JAL-1476 - don't send broken commands to Jmol when no columns exist to superimpose structures --- 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.