<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Tom,<div class=""><br class=""></div><div class="">Thanks for your help. Unfortunately I can’t seem to pass the models/molecules into the function:</div><div class=""><br class=""></div><div class="">For example, if I have two models open such that:</div><div class=""><br class=""></div><div class=""><font face="Courier" class="">mollist=chimera.openModels.list()</font></div><div class=""><font face="Courier" class="">m0=mollist[0]</font></div><div class=""><font face="Courier" class="">m1=mollist[1]</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">MoleculeCopy.molecule_copy(m0,m1)</font></div><div class=""><br class=""></div><div class="">I get the error:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">Traceback (most recent call last):</font></div><div class=""><font face="Courier" class=""> File "<pyshell#42>", line 1, in <module></font></div><div class=""><font face="Courier" class=""> MoleculeCopy.molecule_copy(m1,m2)</font></div><div class=""><font face="Courier" class=""> File "/Applications/Chimera.app/Contents/Resources/share/MoleculeCopy/mcopy.py", line 18, in molecule_copy</font></div><div class=""><font face="Courier" class=""> matchResidues)</font></div><div class=""><font face="Courier" class=""> File "/Applications/Chimera.app/Contents/Resources/share/MoleculeCopy/mcopy.py", line 42, in match_objects</font></div><div class=""><font face="Courier" class=""> fms = set([a.molecule for a in from_atoms])</font></div><div class=""><font face="Courier" class="">TypeError: '_molecule.Molecule' object is not iterable</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class="">I guess I’m passing in the wrong kind of object into this function. What should I be passing into it?</div><div class=""><br class=""></div><div class="">Additionally, would I be right in thinking that this copies the visualisation settings atom-for-atom, so I could run into problems if the first molecule has fewer or more atoms in it than the second molecule?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Gordon</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">-----------------------------------------------</div><div class="">Dr Gordon P S Gibb</div><div class="">EPCC, The University of Edinburgh</div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 7 Feb 2017, at 17: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=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Gordon,<div class=""><br class=""></div><div class=""> The Chimera mcopy command copies molecule colors, styles, visibility, position, atom coordinates...</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><a href="https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/mcopy.html" class="">https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/mcopy.html</a></div><div class=""><br class=""></div><div class="">and the equivalent Python function</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>from MoleculeCopy import molecule_copy</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>molecule_copy(from_atoms, to_atoms, settings = 'csv', matchResidues = True)</div><div class=""><br class=""></div><div class="">with code in</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>chimera/share/MoleculeCopy/mcopy.py</div><div class=""><br class=""></div><div class="">To use this in your Python script I suggest opening the new Tetr model before closing the old one. (You can open it with the same model id.) Then use molecule_copy() to copy the display attributes from the old molecule to the new one. The close the old molecule.</div><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=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 7, 2017, at 8:24 AM, Gordon Gibb wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear developers,<div class=""><br class=""></div><div class="">I have been working on integrating Tetr (a command line tool to construct/modify molecular systems for use in computational chemistry codes such as CASTEP and CP2K - <a href="http://nms.kcl.ac.uk/lev.kantorovitch/codes/lev00/index.html" class="">http://nms.kcl.ac.uk/lev.kantorovitch/codes/lev00/index.html</a>) with Chimera. </div><div class=""><br class=""></div><div class="">To do this we have written a plugin to Chimera that runs an instance of Tetr in a console, with the user being able to type commands into Tetr. The aim is to have Chimera visualise the system being constructed in Tetr, and to update the visualisation based to changes made in Tetr. </div><div class=""><br class=""></div><div class="">At present whenever a command is send to Tetr (which in response to this command may re-write a file containing the molecular system), the plugin looks to see if this file has changed, and if so gets Chimera to reload this file and visualise it. As far as I can tell, there isn’t a ‘reload’ option in Chimera, so instead I close the model (saving its xform matrix first), then open the modified file, and set its xform matrix to restore the old viewing angle etc. For example:</div><div class=""><br class=""></div><div class=""><font face="Courier" class="">#save xform matrix and close model</font></div><div class=""><font face="Courier" class="">xf=model.openState.xform</font></div><div class=""><font face="Courier" class="">chimera.openModels.close(model)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">#open updated file into model number baseId</font></div><div class=""><font face="Courier" class="">chimera.openModels.open(filename,baseId=baseId)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">#retrieve model from the list of open models</font></div><div class=""><font face="Courier" class="">modlist=chimera.openModels.list()</font></div><div class=""><font face="Courier" class="">for mod in modlist:</font></div><div class=""><font face="Courier" class=""> if mod.id == baseId:</font></div><div class=""><font face="Courier" class=""> model=mod</font></div><div class=""><font face="Courier" class=""> break</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">#set the xform matrix</font></div><div class=""><font face="Courier" class="">model.openState.xform=xf</font></div><div class=""><br class=""></div><div class="">What I was wondering was 1) if this is a sensible way to go about things, and 2) if there is a way to retrieve and store visualisation information such as displaying the molecule as ball and stick, wireframe etc such that this can be re-applied to the newly opened model, since at present any visualisation information is not retained when re-opening a file.</div><div class=""><br class=""></div><div class="">Thanks in advance,</div><div class=""><br class=""></div><div class="">Gordon</div><div class=""><br class=""></div><div class=""> </div><div class=""><div class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">-----------------------------------------------</div><div class="">Dr Gordon P S Gibb</div><div class="">EPCC, The University of Edinburgh</div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></div></div>The University of Edinburgh is a charitable body, registered in<br class="">Scotland, with registration number SC005336.<br class="">_______________________________________________<br class="">Chimera-dev mailing list<br class=""><a href="mailto:Chimera-dev@cgl.ucsf.edu" class="">Chimera-dev@cgl.ucsf.edu</a><br class=""><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>