
Here is what the saved images look like for 2bbv. Tom
On Dec 11, 2020, at 11:41 AM, Tom Goddard <goddard@sonic.net> wrote:
Hi Yong Liu,
First start by figuring out the ChimeraX commands to do what you want. For example, the commands to save an image of chain A shown as atoms could be
open 2bbv
show #1/A only view save ~/Desktop/2bbv_chain_A.png
Now the trick is we want to do that for all chains. The ChimeraX command language has not looping methods so we have to use some Python. Also you wanted to create a new command that does the 3 commands above with the right chain id and model number substituted in. I've attached some Python code chain_images.py that does that makes the command. If you open that Python file in ChimeraX it will define the command then type
chainimages #1
to make the images. I've put this example Python code on the ChimeraX Recipes web site
https://rbvi.github.io/chimerax-recipes/chain_images/chain_images.html <https://rbvi.github.io/chimerax-recipes/chain_images/chain_images.html>
If you want ChimeraX to define this command each time you start you can put command "open ~/scripts/chain_images.py" in ChimeraX startup preferences.
Tom
<chain_images.py>
On Dec 10, 2020, at 10:29 PM, Yong Liu <liuyongbox@gmail.com <mailto:liuyongbox@gmail.com>> wrote:
Hi All, I would like to save the image of each chain in one command. I have wrote following python code, but it is not working. Is anybody know how to fix it?
# save the image of each chain
def batchSave(session): chainID_list = info chains for x in chainID_list:
chainID = chainID_list.split()
ID = chainID[-1]
save "Desktop/ID.png" width 4000 height 4000 transparentBackground true
def register_command(session): from chimerax.core.commands import CmdDesc, register desc = CmdDesc() register('batchSave', desc, batchSave, logger=session.logger)
register_command(session)
Best, Yong Liu _______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu <mailto:ChimeraX-users@cgl.ucsf.edu> Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users