* Routines for generating Chimera commands for Jalview/Chimera binding
*
* @author JimP
+ * @see https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/framecommand.html
*
*/
public class ChimeraCommands extends StructureCommandsBase
* </pre>
*
* @param featureMap
+ * @param binding
* @return
*/
@Override
}
@Override
- public List<StructureCommandI> showChains(List<String> toShow)
- {
- /*
- * Construct a chimera command like
- *
- * ~display #*;~ribbon #*;ribbon :.A,:.B
- */
- StringBuilder cmd = new StringBuilder(64);
- boolean first = true;
- for (String chain : toShow)
- {
- String[] tokens = chain.split(":");
- if (tokens.length == 2)
- {
- String showChainCmd = tokens[0] + ":." + tokens[1];
- if (!first)
- {
- cmd.append(",");
- }
- cmd.append(showChainCmd);
- first = false;
- }
- }
-
- /*
- * could append ";focus" to this command to resize the display to fill the
- * window, but it looks more helpful not to (easier to relate chains to the
- * whole)
- */
- final String command = "~display #*; ~ribbon #*; ribbon :"
- + cmd.toString();
- return Arrays.asList(new StructureCommand(command));
- }
-
- @Override
public List<StructureCommandI> superposeStructures(AtomSpecModel ref,
AtomSpecModel spec)
{
}
@Override
+ public StructureCommandI showStructures(AtomSpecModel restrictTo)
+ {
+ if (restrictTo == null)
+ {
+ return new StructureCommand("ribbon");
+ }
+
+ String atomSpec = getAtomSpec(restrictTo, false);
+ String cmd = "ribbon " + atomSpec;
+ return new StructureCommand(cmd);
+ }
+
+ @Override
+ public StructureCommandI hideChain(String modelId, String chainId)
+ {
+ String cmd = "~ribbon #" + modelId + ":." + chainId;
+ return new StructureCommand(cmd);
+ }
+
+ @Override
+ public StructureCommandI hideAll()
+ {
+ return new StructureCommand("~display; ~ribbon");
+ }
public StructureCommandI closeViewer()
{
return CLOSE_CHIMERA;