X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Frbvi%2Fchimera%2FChimeraXCommands.java;h=ad04fc9d4d3ffe754004cedf9aec1c41bb2f48ba;hb=8b5473a7ae1f9175c6ff66a013fa342636bdfd11;hp=b7d9ce3ef9cd869905123149cc2c94b8a54d0f76;hpb=2107a91322a1988a8a6b724c74f9d244795341e3;p=jalview.git diff --git a/src/jalview/ext/rbvi/chimera/ChimeraXCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraXCommands.java index b7d9ce3..ad04fc9 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraXCommands.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraXCommands.java @@ -20,23 +20,39 @@ */ package jalview.ext.rbvi.chimera; -import jalview.structure.AtomSpecModel; -import jalview.structure.StructureCommand; -import jalview.structure.StructureCommandI; -import jalview.util.ColorUtils; - import java.awt.Color; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import jalview.structure.AtomSpecModel; +import jalview.structure.StructureCommand; +import jalview.structure.StructureCommandI; + /** * Routines for generating ChimeraX commands for Jalview/ChimeraX binding */ public class ChimeraXCommands extends ChimeraCommands { + // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/info.html#resattr + private static final StructureCommand LIST_RESIDUE_ATTRIBUTES = new StructureCommand("info resattr"); + + // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/exit.html + private static final StructureCommand CLOSE_CHIMERAX = new StructureCommand("exit"); + + // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/info.html#notify + private static final StructureCommand STOP_NOTIFY_SELECTION = new StructureCommand("info notify stop selection jalview"); + + private static final StructureCommand STOP_NOTIFY_MODELS = new StructureCommand("info notify stop models jalview"); + + // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/info.html#selection + private static final StructureCommand GET_SELECTION = new StructureCommand( + "info selection level residue"); + private static final StructureCommand SHOW_BACKBONE = new StructureCommand( "~display all;~ribbon;show @CA|P atoms"); + // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/view.html private static final StructureCommand FOCUS_VIEW = new StructureCommand( "view"); @@ -56,13 +72,6 @@ public class ChimeraXCommands extends ChimeraCommands } @Override - public StructureCommandI setBackgroundColour(Color col) - { - // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/set.html - return new StructureCommand("set bgColor " + ColorUtils.toTkCode(col)); - } - - @Override public StructureCommandI colourResidues(String atomSpec, Color colour) { // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/color.html @@ -74,7 +83,6 @@ public class ChimeraXCommands extends ChimeraCommands @Override public StructureCommandI focusView() { - // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/view.html return FOCUS_VIEW; } @@ -125,7 +133,8 @@ public class ChimeraXCommands extends ChimeraCommands public StructureCommandI saveSession(String filepath) { // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/save.html - return new StructureCommand("save session " + filepath); + // note ChimeraX will append ".cxs" to the filepath! + return new StructureCommand("save " + filepath + " format session"); } /** @@ -222,4 +231,47 @@ public class ChimeraXCommands extends ChimeraCommands return Arrays.asList(new StructureCommand(cmd.toString())); } + @Override + public StructureCommandI openSession(String filepath) + { + // https://www.cgl.ucsf.edu/chimerax/docs/user/commands/open.html#composite + // this version of the command has no dependency on file extension + return new StructureCommand("open " + filepath + " format session"); + } + + @Override + public StructureCommandI closeViewer() + { + return CLOSE_CHIMERAX; + } + + @Override + public List startNotifications(String uri) + { + List cmds = new ArrayList<>(); + cmds.add(new StructureCommand("info notify start models jalview prefix ModelChanged url " + uri)); + cmds.add(new StructureCommand("info notify start selection jalview prefix SelectionChanged url " + uri)); + return cmds; + } + + @Override + public List stopNotifications() + { + List cmds = new ArrayList<>(); + cmds.add(STOP_NOTIFY_MODELS); + cmds.add(STOP_NOTIFY_SELECTION); + return cmds; + } + + @Override + public StructureCommandI getSelectedResidues() + { + return GET_SELECTION; + } + + @Override + public StructureCommandI listResidueAttributes() + { + return LIST_RESIDUE_ATTRIBUTES; + } }