[chimerax-users] Running ChimeraX and a REPL

Tom Goddard goddard at sonic.net
Thu Oct 21 15:12:33 PDT 2021


Hi Tom,

  Chimera has a tool called ReadStdin which allows it to be run from a terminal and have commands typed into the terminal and output messages go to the terminal while the GUI shows the molecules or other data.

	https://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/readstdin/readstdin.html

But we have not added that tool to ChimeraX.  It seems like this is what you want for ChimeraX.

  There is a ChimeraX "remotecontrol" command

	https://www.cgl.ucsf.edu/chimerax/docs/user/commands/remotecontrol.html

that allows sending commands to ChimeraX using http for example, doing an http request via a browser or command-line program (wget / curl)

	http://127.0.0.1:60958/run?command=open+1a0m <http://127.0.0.1:60958/run?command=open+1a0m>

would run the command "open 1a0m".  Probably emacs is not going to support that mechanism.

  As Eric mentioned your problem with the

	IPython.terminal.embed.embed()

is it seems to run its own event loop.  If you type exit to that terminal all of sudden the ChimeraX gui displays and works because IPython exits its event loop and ChimeraX gets its going.  In fact I suspect that the above embed() call simply does not return until IPython is exit, and ChimeraX only starts its event loop after the script completes. I don't know how to remedy this.

	Tom



> On Oct 21, 2021, at 4:00 AM, Tom Mulvaney via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
> 
> Hi all,
> 
> I'm wondering if anyone has any experience running ChimeraX with either a standard REPL or IPython REPL?
> 
> ChimeraX already has a 'shell' tool that allows interacting with ChimeraX through a Python REPL which I've found invaluable for testing out ideas and poking around in ChimeraX in general.
> 
> It would be really nice though if I could send Python code directly from my IDE to be evaluated.  In order to make this work, it would be great if ChimeraX could be run from a terminal and provide a Python (or preferably IPython) REPL.  As it stands, I've managed to nearly make this work with the following script:
> 
>  import IPython.terminal.embed
>  IPython.terminal.embed.embed()
> 
> I then run:
> 
>  ChimeraX --script repl.py
> 
> After typing, `%gui qt5`, the ChimeraX GUI appears.  
> 
> I can then interact with the REPL directly from the comfort of Emacs and evaluate things - but! - the main 3D view does not end up being displayed.
> 
> Does anyone know how to get the REPL and 3D stuff to work side-by-side?
> 
> 
> Kind regards,
> 
> Tom
> 
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20211021/ead25e82/attachment-0001.html>


More information about the ChimeraX-users mailing list