<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Here is a bit a Python code to count the number of chains in a molecule m.<div class=""><br class=""></div><div class=""><div class="">>>> import chimera</div><div class="">>>> m = chimera.openModels.list()[0]</div><div class="">>>> m</div><div class=""><_molecule.Molecule object at 0x7fb988fed620></div><div class="">>>> len(set(r.id.chainId for r in m.residues))</div><div class="">4</div><div><br class=""></div><div>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</div><div><br class=""></div><div>m = session.models.list()[0]</div><div>m.num_chains</div><div><br class=""></div><div> Tom</div><div><br class=""></div><div><blockquote type="cite" class=""><div class="">On Feb 14, 2020, at 2:09 AM, Healey, Joseph <<a href="mailto:J.Healey.1@warwick.ac.uk" class="">J.Healey.1@warwick.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">Hi Chimera Team,<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">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.<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">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:<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">>>> from chimera import SplitMolecule<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">Traceback (most recent call last):<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""> File "<pyshell#25>", line 2, in <module><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">ImportError: cannot import name SplitMolecule<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">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?<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">I’m currently on chimera production version 1.14 (build 42094) 2019-11-13 06:05:13 UTC if that helps.<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">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.<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">Many thanks,<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 11pt;" class="">Joe<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Serif Roman";" class=""><o:p class=""> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><u class=""><span style="font-size: 10pt; font-family: "CMU Serif Roman";" class=""> <o:p class=""></o:p></span></u></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium"; color: rgb(148, 17, 0);" class="">Dr. Joseph Healey Ph.D. M.Sc. B.Sc. (Hons) MRSB</span><span style="font-family: "CMU Sans Serif Medium"; color: rgb(148, 17, 0);" class=""><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium";" class="">Research Fellow<o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium";" class="">Warwick Medical School</span><span style="font-family: "CMU Sans Serif Medium";" class=""><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium";" class="">University of Warwick</span><span style="font-family: "CMU Sans Serif Medium";" class=""><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium";" class="">Coventry</span><span style="font-family: "CMU Sans Serif Medium";" class=""><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium";" class="">CV47AL<br class="">Mob: +44 (0) 7536 042620 | Twitter: <a href="https://twitter.com/JRJHealey" class=""><span style="color: rgb(5, 99, 193);" class="">@JRJHealey</span></a> | </span><span style="font-family: "CMU Sans Serif Medium";" class=""><a href="http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey" class=""><span style="font-size: 10pt; color: rgb(5, 99, 193);" class="">Website</span></a><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 10pt; font-family: "CMU Sans Serif Medium";" class="">Email:<span class="Apple-converted-space"> </span><a href="mailto:J.Healey.1@warwick.ac.uk" class=""><span style="color: rgb(5, 99, 193);" class="">J.Healey.1@warwick.ac.uk</span></a><span class="Apple-converted-space"> </span>| ORCID: <a href="http://orcid.org/0000-0002-9569-6738" class="">orcid.org/0000-0002-9569-6738</a></span><span style="font-family: "CMU Sans Serif Medium";" class=""><o:p class=""></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Chimera-users mailing list:<span class="Apple-converted-space"> </span></span><a href="mailto:Chimera-users@cgl.ucsf.edu" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Chimera-users@cgl.ucsf.edu</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Manage subscription:<span class="Apple-converted-space"> </span></span><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a></div></blockquote></div><br class=""></div></body></html>