[Chimera-users] python/model panel
Eric Pettersen
pett at cgl.ucsf.edu
Fri Oct 9 15:37:58 PDT 2015
> On Oct 9, 2015, at 1:34 PM, Dougherty, Matthew T <matthewd at bcm.edu> wrote:
>
> I would like to print out the model ID, name and input files as they are listed in the model panel.
>
> Can you point me in the direction of how to loop over the model panel ?
> Such as elevant variables, and what would be a block of code in chimera that I should study.
Hi Matt,
I don’t know that you need to go through the Model Panel per se, you could just go through Chimera’s open models list:
chimera.openModels.list()
Each model in the list has:
id ID number
subid Sub-ID number (None if it doesn’t have a sub-ID)
name Name
openedAs If it came from a file, a 4-tuple of stuff you mostly don’t care about, but the first element is the file name
Since some models don’t come from files (e.g. on-the-fly VRML models), you may want to use the model panel’s “inputPath” function to always get a usable/readable string:
from ModelPanel import inputPath
path = inputPath(model)
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20151009/95aafc91/attachment.html>
More information about the Chimera-users
mailing list