<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear Tom, <div class=""><br class=""></div><div class="">Many thanks. It is working very well.<div class=""><br class=""></div><div class="">I am wondering if it is fine to add two more arguments for this command which are chains of list and color.  For example: chainimages #1/X,Y,Z Blue</div><div class=""><br class=""></div><div class="">Kind regards,</div><div class="">Yong Liu<br class=""><div><blockquote type="cite" class=""><div class="">On Dec 11, 2020, at 22:29, Tom Goddard <<a href="mailto:goddard@sonic.net" class="">goddard@sonic.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Here is what the saved images look like for 2bbv.<div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>Tom</div><div class=""><br class=""></div><div class=""><span id="cid:55F14BDB-B4FE-49A8-B9F1-621425162EBA"><2bbv.jpg></span><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 11, 2020, at 11:41 AM, Tom Goddard <<a href="mailto:goddard@sonic.net" class="">goddard@sonic.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Yong Liu,<div class=""><br class=""></div><div class="">  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</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>open 2bbv</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span>show #1/A only</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>view</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>save ~/Desktop/2bbv_chain_A.png</div><div class=""><br class=""></div><div class="">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</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>chainimages #1</div><div class=""><br class=""></div><div class="">to make the images.  I've put this example Python code on the ChimeraX Recipes web site</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://rbvi.github.io/chimerax-recipes/chain_images/chain_images.html" class="">https://rbvi.github.io/chimerax-recipes/chain_images/chain_images.html</a></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">  Tom</div><div class=""><br class=""></div><div class=""></div></div><span id="cid:F2DE6BE1-FE17-43C3-B496-C404EB65482B" class=""><chain_images.py></span><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""></div><div class=""><br class=""></div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 10, 2020, at 10:29 PM, Yong Liu <<a href="mailto:liuyongbox@gmail.com" class="">liuyongbox@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi All,<br class="">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?<br class=""><br class=""><br class=""># save the image of each chain<br class=""><br class="">def batchSave(session):<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span>chainID_list = info chains <br class="">for x in chainID_list:<br class=""><br class="">chainID = chainID_list.split()<br class=""><br class="">ID = chainID[-1]<br class=""><br class="">save "Desktop/ID.png" width 4000 height 4000 transparentBackground true<br class=""><br class=""><br class="">def register_command(session):<br class="">  from chimerax.core.commands import CmdDesc, register<br class="">  desc = CmdDesc()<br class="">  register('batchSave', desc, batchSave, logger=session.logger)<br class=""><br class="">register_command(session)<br class=""><br class="">Best,<br class="">Yong Liu<br class="">_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""><br class=""></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></body></html>