X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fpymol%2FPymolCommands.java;fp=src%2Fjalview%2Fext%2Fpymol%2FPymolCommands.java;h=8bf1c9f09d89a3a21eec30346b7efdcff6b8cafd;hb=fa6411e3c25d907aa46aeb6a0ef2df8e49fe77d2;hp=36957f5548785aec9dc0043eff733c88fad798a8;hpb=76528375c0b220cd59be2127d86b406b220c3e4e;p=jalview.git diff --git a/src/jalview/ext/pymol/PymolCommands.java b/src/jalview/ext/pymol/PymolCommands.java index 36957f5..8bf1c9f 100644 --- a/src/jalview/ext/pymol/PymolCommands.java +++ b/src/jalview/ext/pymol/PymolCommands.java @@ -23,6 +23,12 @@ import jalview.structure.StructureCommandsBase; */ public class PymolCommands extends StructureCommandsBase { + private static final StructureCommand SHOW_RIBBON = new StructureCommand("show", "ribbon"); + + private static final StructureCommand SHOW_CARTOON = new StructureCommand("show", "cartoon"); + + private static final StructureCommand HIDE_EVERYTHING = new StructureCommand("hide", "everything"); + // https://pymol.org/dokuwiki/doku.php?id=command:zoom // not currently documented on // https://pymolwiki.org/index.php/Category:Commands @@ -37,7 +43,6 @@ public class PymolCommands extends StructureCommandsBase // https://pymolwiki.org/index.php/Category:Commands private static final StructureCommand COLOUR_BY_CHAIN = new StructureCommand( "spectrum", "chain"); - private static final List COLOR_BY_CHARGE = Arrays .asList(new StructureCommand("color", "white", "*"), new StructureCommand("color", "red", "resn ASP resn GLU"), @@ -88,23 +93,6 @@ public class PymolCommands extends StructureCommandsBase } @Override - public List showChains(List toShow) - { - // https://pymolwiki.org/index.php/Show - List commands = new ArrayList<>(); - commands.add(new StructureCommand("hide", "everything")); - commands.add(new StructureCommand("show", "lines")); - StringBuilder chains = new StringBuilder(); - for (String chain : toShow) - { - chains.append(" chain ").append(chain); - } - commands.add( - new StructureCommand("show", "cartoon", chains.toString())); - return commands; - } - - @Override public List superposeStructures(AtomSpecModel refAtoms, AtomSpecModel atomSpec) { @@ -326,9 +314,33 @@ public class PymolCommands extends StructureCommandsBase } @Override + public StructureCommandI showStructures(AtomSpecModel restrictTo) + { + if (restrictTo == null) + { + return SHOW_CARTOON; + } + else + { + return new StructureCommand("show", "cartoon", + getAtomSpec(restrictTo, false)); + } + } + + @Override + public StructureCommandI hideChain(String modelId, String chainId) + { + return new StructureCommand("hide", modelId + "//" + chainId + "//"); + } + + @Override + public StructureCommandI hideAll() + { + return HIDE_EVERYTHING; + } + public StructureCommandI closeViewer() { - // https://pymolwiki.org/index.php/Quit return CLOSE_PYMOL; }