On Feb 8, 2017, at 10:02 AM, Tom Goddard <goddard@sonic.net> wrote:Hi Gordon,_______________________________________________The from_atoms and to_atoms arguments of molecule_copy() are lists of Atom objects, not Molecule objects.molecule_copy(from_atoms, to_atoms, settings = 'csv', matchResidues = True)So usemolecule_copy(m0.atoms, m1.atoms)If the two structures don't have the same number of atoms it will still work but will only copy attributes for atoms with the same atom name, residue number, residue name, chain identifier, as described in the mcopy command documentation:TomOn Feb 8, 2017, at 5:57 AM, Gordon Gibb <gordon.gibb@ed.ac.uk> wrote:Hi Tom,The University of Edinburgh is a charitable body, registered inThanks for your help. Unfortunately I can’t seem to pass the models/molecules into the function:For example, if I have two models open such that:mollist=chimera.openModels.list()m0=mollist[0]m1=mollist[1]MoleculeCopy.molecule_copy(m0,m1)I get the error:Traceback (most recent call last):File "<pyshell#42>", line 1, in <module>MoleculeCopy.molecule_copy(m1,m2)File "/Applications/Chimera.app/Contents/Resources/share/MoleculeCopy/mcopy.py", line 18, in molecule_copymatchResidues)File "/Applications/Chimera.app/Contents/Resources/share/MoleculeCopy/mcopy.py", line 42, in match_objectsfms = set([a.molecule for a in from_atoms])TypeError: '_molecule.Molecule' object is not iterableI guess I’m passing in the wrong kind of object into this function. What should I be passing into it?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?Thanks,Gordon-----------------------------------------------Dr Gordon P S GibbEPCC, The University of Edinburgh
On 7 Feb 2017, at 17:29, Tom Goddard <goddard@sonic.net> wrote:Hi Gordon,The Chimera mcopy command copies molecule colors, styles, visibility, position, atom coordinates...and the equivalent Python functionfrom MoleculeCopy import molecule_copymolecule_copy(from_atoms, to_atoms, settings = 'csv', matchResidues = True)with code inchimera/share/MoleculeCopy/mcopy.pyTo 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.TomOn Feb 7, 2017, at 8:24 AM, Gordon Gibb wrote:Dear developers,The University of Edinburgh is a charitable body, registered inI 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 - http://nms.kcl.ac.uk/lev.kantorovitch/codes/lev00/index.html) with Chimera.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.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:#save xform matrix and close modelxf=model.openState.xformchimera.openModels.close(model)#open updated file into model number baseIdchimera.openModels.open(filename,baseId=baseId)#retrieve model from the list of open modelsmodlist=chimera.openModels.list()for mod in modlist:if mod.id == baseId:model=modbreak#set the xform matrixmodel.openState.xform=xfWhat 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.Thanks in advance,Gordon-----------------------------------------------Dr Gordon P S GibbEPCC, The University of Edinburgh
Scotland, with registration number SC005336.
_______________________________________________
Chimera-dev mailing list
Chimera-dev@cgl.ucsf.edu
http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
Scotland, with registration number SC005336.
Chimera-dev mailing list
Chimera-dev@cgl.ucsf.edu
http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev