From: gmungoc Date: Mon, 16 Mar 2020 10:11:38 +0000 (+0000) Subject: JAL-3551 the correct PyMOL colour by chain command X-Git-Tag: Release_2_11_2_0~37^2~24 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8c29d4d93761896bb75c6c3b24c3fdd0612c7bb3;p=jalview.git JAL-3551 the correct PyMOL colour by chain command --- diff --git a/src/jalview/ext/pymol/PymolCommands.java b/src/jalview/ext/pymol/PymolCommands.java index 1638644..910aae1 100644 --- a/src/jalview/ext/pymol/PymolCommands.java +++ b/src/jalview/ext/pymol/PymolCommands.java @@ -10,19 +10,19 @@ import java.util.ArrayList; import java.util.List; /** - * A class that generates commands to send to PyMol + * A class that generates commands to send to PyMol over its XML-RPC interface. + *

+ * Note that because the xml-rpc interface can only accept one command at a + * time, we can't concatenate commands, and must instead form and send them + * individually. * * @see https://pymolwiki.org/index.php/Category:Commands + * @see https://pymolwiki.org/index.php/RPC */ public class PymolCommands extends StructureCommandsBase { - private static final StructureCommandI COLOUR_BY_CHAIN = new StructureCommand( - "util.cbc"); + private static final StructureCommand COLOUR_BY_CHAIN = new StructureCommand("spectrum", "chain"); - /* - * because the xml-rpc interface can only accept one command at a time, we can't - * concatenate commands and must instead form and send them individually - */ private static final List COLOR_BY_CHARGE = new ArrayList<>(); private static final List SHOW_BACKBONE = new ArrayList<>(); @@ -33,7 +33,8 @@ public class PymolCommands extends StructureCommandsBase .add(new StructureCommand("color", "red", "resn ASP resn GLU")); COLOR_BY_CHARGE.add( new StructureCommand("color", "blue", "resn LYS resn ARG")); - COLOR_BY_CHARGE.add(new StructureCommand("color")); + COLOR_BY_CHARGE + .add(new StructureCommand("color", "yellow", "resn CYS")); SHOW_BACKBONE.add(new StructureCommand("hide", "everything")); SHOW_BACKBONE.add(new StructureCommand("show", "ribbon")); } @@ -41,8 +42,6 @@ public class PymolCommands extends StructureCommandsBase @Override public StructureCommandI colourByChain() { - // https://pymolwiki.org/index.php/CBC - // TODO this doesn't execute as an xml-rpc command return COLOUR_BY_CHAIN; } diff --git a/test/jalview/ext/pymol/PymolCommandsTest.java b/test/jalview/ext/pymol/PymolCommandsTest.java index a66f809..9dc107e 100644 --- a/test/jalview/ext/pymol/PymolCommandsTest.java +++ b/test/jalview/ext/pymol/PymolCommandsTest.java @@ -186,6 +186,18 @@ public class PymolCommandsTest } @Test(groups = "Functional") + public void testColourByCharge() + { + PymolCommands testee = new PymolCommands(); + List cmds = testee.colourByCharge(); + assertEquals(cmds.size(), 4); + assertEquals(cmds.get(0).toString(), "color(white,*)"); + assertEquals(cmds.get(1).toString(), "color(red,resn ASP resn GLU)"); + assertEquals(cmds.get(2).toString(), "color(blue,resn LYS resn ARG)"); + assertEquals(cmds.get(3).toString(), "color(yellow,resn CYS)"); + } + + @Test(groups = "Functional") public void testOpenCommandFile() { PymolCommands testee = new PymolCommands(); @@ -202,6 +214,13 @@ public class PymolCommandsTest } @Test(groups = "Functional") + public void testColourByChain() + { + PymolCommands testee = new PymolCommands(); + assertEquals(testee.colourByChain().toString(), "spectrum(chain)"); + } + + @Test(groups = "Functional") public void testGetColourCommand() { PymolCommands testee = new PymolCommands();