[chimerax-users] Query regarding plugin development
Tom Goddard
goddard at sonic.net
Wed Mar 23 10:50:07 PDT 2022
Hi Kushagra,
ChimeraX has a Python shell, menu Tools / General / Shell. That brings up a separate panel where you can type Python code. To get the list of open models
mlist = session.models.list()
To make a molecular surface for each chain
from chimerax.surface.surfacecmds import surface
m = mlist[0]
surfs = surface(session, m.atoms)
To hide the surface of the first chain
surfs[0].display = False
To list the methods of a ChimeraX class
from chimerax.atomic import Structure
dir(Structure)
But you might find it easier to read the ChimeraX Python API documentation, for instance for atomic structures
https://www.cgl.ucsf.edu/chimerax/docs/devel/bundles/atomic/src/atomic.html <https://www.cgl.ucsf.edu/chimerax/docs/devel/bundles/atomic/src/atomic.html>
Here are low level surface related functions
https://www.cgl.ucsf.edu/chimerax/docs/devel/bundles/surface/src/surface.html <https://www.cgl.ucsf.edu/chimerax/docs/devel/bundles/surface/src/surface.html>
For the Python functions used by the typed ChimeraX commands
https://www.cgl.ucsf.edu/chimerax/docs/devel/core/commands/user_commands.html <https://www.cgl.ucsf.edu/chimerax/docs/devel/core/commands/user_commands.html>
for instance, the "surface" command
https://www.cgl.ucsf.edu/chimerax/docs/devel/core/commands/user_commands.html#surface <https://www.cgl.ucsf.edu/chimerax/docs/devel/core/commands/user_commands.html#surface>
If the API documentation does not give all the details you want, then look at the Python code which is included in ChimeraX. For instance, on Mac it is in
ChimeraX.app/Contents/lib/python3.9/site-packages/chimerax
for instance the surface command Python code is here
ChimeraX.app/Contents/lib/python3.9/site-packages/chimerax/surface/surfacecmds.py
Or if you prefer look at that same code in the ChimeraX Github repository
https://github.com/RBVI/ChimeraX/blob/develop/src/bundles/surface/src/surfacecmds.py <https://github.com/RBVI/ChimeraX/blob/develop/src/bundles/surface/src/surfacecmds.py>
If all else fails, ask us on this ChimeraX mailing list your specific programming questions. We'd love to have you develop plugins.
Tom
> On Mar 23, 2022, at 12:09 AM, KUSHAGRA RUSTAGI via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Greetings,
>
> I am Kushagra Rustagi an undergraduate student at IIT Roorkee who is working on developing a ChimeraX plugin. I had some doubts:
>
> 1. Can we open a session in ipython? Basically while developing codes for chimerax is there a way to open chimera command line in ipython?
>
> 2. For example if we want to run an inbuilt function of any particular class in ChimeraX and we want to find all methods associated with that class. How do we go about doing it?
>
> 3. How to go about exploring surface generation functions in ChimeraX?
>
>
> Regards,
> Kushagra Rustagi
>
> _______________________________________________
> 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://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20220323/6658d18c/attachment.html>
More information about the ChimeraX-users
mailing list