[Chimera-users] SplitCommand python
Healey, Joseph
J.Healey.1 at warwick.ac.uk
Mon Feb 17 05:06:13 PST 2020
Hi Tom,
Perfect – thanks for clearing up the confusion!
I’m looking forward to moving over to scripting for ChimeraX (not least because I work on large structures), but it hasn’t quite got the featureset I need just yet…
Many thanks for the help,
Joe
Dr. Joseph Healey Ph.D. M.Sc. B.Sc. (Hons) MRSB
Research Fellow
Warwick Medical School
University of Warwick
Coventry
CV47AL
Mob: +44 (0) 7536 042620 | Twitter: @JRJHealey<https://twitter.com/JRJHealey> | Website<http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey>
Email: J.Healey.1 at warwick.ac.uk<mailto:J.Healey.1 at warwick.ac.uk> | ORCID: orcid.org/0000-0002-9569-6738
From: Tom Goddard <goddard at sonic.net>
Date: Friday, 14 February 2020 at 18:34
To: "Healey, Joseph" <J.Healey.1 at warwick.ac.uk>
Cc: "chimera-users at cgl.ucsf.edu" <chimera-users at cgl.ucsf.edu>
Subject: Re: [Chimera-users] SplitCommand python
Here is a bit a Python code to count the number of chains in a molecule m.
>>> import chimera
>>> m = chimera.openModels.list()[0]
>>> m
<_molecule.Molecule object at 0x7fb988fed620>
>>> len(set(r.id.chainId for r in m.residues))
4
We have been working on ChimeraX the replacement for Chimera for a few years and it is quite a bit nicer. In ChimeraX the code would be
m = session.models.list()[0]
m.num_chains
Tom
On Feb 14, 2020, at 2:09 AM, Healey, Joseph <J.Healey.1 at warwick.ac.uk<mailto:J.Healey.1 at warwick.ac.uk>> wrote:
Hi Chimera Team,
I’m trying to reduce some overheads in one of my scripts part of which is coming from my use of `runCommand`. At the moment, I’m only using it for `split`, but I’d like to first test whether a model is already split to avoid unnecessary invocation.
I’m aware the python equivalent of the command is buried inside chimera.SplitMolecule and the command split_command, however it doesn’t seem to be importable, as when I try:
>>> from chimera import SplitMolecule
Traceback (most recent call last):
File "<pyshell#25>", line 2, in <module>
ImportError: cannot import name SplitMolecule
I’m getting the above ImportError. I can import other members of the chimera class (e.g. chimera.openModels or chimera.Molecule and chimera itself without issue). I’ve seen in the source code that SplitMolecule gets imported elsewhere, and it has the __init__ file, so I assume I’m just doing something stupid with paths or similar. That said, SplitMolecule is clearly within the main chimera modules directory, so I would have expected it to only be one ‘layer’ below `chimera` itself. Can you elighten me?
I’m currently on chimera production version 1.14 (build 42094) 2019-11-13 06:05:13 UTC if that helps.
If you could point me in the right direction to understand how the code will check for multiple chains and decide to split by chain, that would also be a massive help.
Many thanks,
Joe
Dr. Joseph Healey Ph.D. M.Sc. B.Sc. (Hons) MRSB
Research Fellow
Warwick Medical School
University of Warwick
Coventry
CV47AL
Mob: +44 (0) 7536 042620 | Twitter: @JRJHealey<https://twitter.com/JRJHealey> | Website<http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey>
Email: J.Healey.1 at warwick.ac.uk<mailto:J.Healey.1 at warwick.ac.uk> | 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20200217/63d2df21/attachment-0001.html>
More information about the Chimera-users
mailing list