[Chimera-users] Swapping models in an open structure

Eric Pettersen pett at cgl.ucsf.edu
Fri Sep 22 15:06:13 PDT 2017

> On Sep 22, 2017, at 2:52 AM, Healey, Joe <J.R.J.Healey at warwick.ac.uk> wrote:
> Hi again Chimera Team,
> I have a large macromolecular structure, and I want to, at random, substitute some of the separate models for a variant form.
> Is it possible to do this through chimera, e.g. via python? It seems to me it would basically be a case of:
> enumerate the list of open models

chimera.openModels.list() returns a list of all open models (including volume models, etc.); to get a list of just the molecular models:

from chimera import openModels, Molecule
mols = openModels.list(modelTypes=[Molecule])

> pick a model at random

The Python random <https://docs.python.org/2/library/random.html#module-random> module is used for choosing things at random.

> either open a new model, fit it to that model, then close the old one, or somehow get the old models co-ords, close it, then open the new one in its place from a specified file path

Off the top of my head it seems easiest to open the new model, use MatchMaker to match it on the old one, and then close the old one.  So, suppose you had your random old model in a variable named old_model, then you would use code something this to replace it:

from chimera import openModels, runCommand
opened_models = openModels.open(“path-to-model-file”)
new_model = opened_models[0]
runCommand(“matchmaker #%d #%d” % (old_model.id, new_model.id))
runCommand(“close %d” % old_model.id)


	Eric Pettersen
	UCSF Computer Graphics Lab

> Any alternative suggestions if there's a better way to do this would be great as well.
> Thanks
> Joe Healey
> M.Sc. B.Sc. (Hons) MSRB
> PhD Student
> MOAC CDT, Senate House
> University of Warwick
> Coventry
> CV47AL
> Mob: +44 (0) 7536 042620  |  Email: J.R.J.Healey at warwick.ac.uk <mailto:J.R.J.Healey at warwick.ac.uk>
> Jointly working in:
> Waterfield Lab <http://www2.warwick.ac.uk/fac/med/research/tsm/microinfect/staff/waterfieldlab/> (WMS Microbiology and Infection Unit)
> and the Gibson Lab <http://www2.warwick.ac.uk/fac/sci/chemistry/research/gibson/gibsongroup/> (Warwick Chemistry)
> Twitter: @JRJHealey <https://twitter.com/JRJHealey>  |  Website: MOAC Page <http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey> | ORCID: orcid.org/0000-0002-9569-6738 <http://orcid.org/0000-0002-9569-6738>_______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20170922/eae5cdf5/attachment.html>

More information about the Chimera-users mailing list