public void stopListening()
{
- sendChimeraCommand("listen stop models ; listen stop selection ", false);
+ // TODO send this command when viewer connection is closed in Jalview
+ String command = isChimeraX
+ ? "info notify stop models jalview; info notify stop selection jalview"
+ : "listen stop models ; listen stop selection ";
+ sendChimeraCommand(command, false);
}
/**
*/
public void startListening(String uri)
{
- sendChimeraCommand("listen start models url " + uri
- + ";listen start select prefix SelectionChanged url " + uri,
- false);
+ String command = isChimeraX
+ ? ("info notify start models prefix ModelChanged jalview url "
+ + uri
+ + "; info notify start selection jalview prefix SelectionChanged url "
+ + uri)
+ : ("listen start models url " + uri
+ + ";listen start select prefix SelectionChanged url "
+ + uri);
+ sendChimeraCommand(command, false);
}
/**
public List<String> getSelectedResidueSpecs()
{
List<String> selectedResidues = new ArrayList<>();
- List<String> chimeraReply = sendChimeraCommand(
- "list selection level residue", true);
+
+ /*
+ * skip for now if ChimeraX - times out
+ */
+ if (isChimeraX)
+ {
+ return selectedResidues;
+ }
+
+ // in fact 'listinfo' (undocumented) works in ChimeraX
+ String command = (isChimeraX ? "info" : "list")
+ + " selection level residue";
+ List<String> chimeraReply = sendChimeraCommand(command, true);
if (chimeraReply != null)
{
/*
- * expect 0, 1 or more lines of the format
+ * expect 0, 1 or more lines of the format either
+ * Chimera:
* residue id #0:43.A type GLY
- * where we are only interested in the atomspec #0.43.A
+ * ChimeraX:
+ * residue id /A:89 name THR index 88
+ * We are only interested in the atomspec (third token of the reply)
*/
for (String inputLine : chimeraReply)
{
String[] inputLineParts = inputLine.split("\\s+");
- if (inputLineParts.length == 5)
+ if (inputLineParts.length >= 5)
{
selectedResidues.add(inputLineParts[2]);
}
public List<String> getAttrList()
{
List<String> attributes = new ArrayList<>();
- final List<String> reply = sendChimeraCommand("list resattr", true);
+ String command = (isChimeraX ? "info " : "list") + "resattr";
+ final List<String> reply = sendChimeraCommand(command, true);
if (reply != null)
{
for (String inputLine : reply)