[chimera-dev] ...some questions

Eric Pettersen pett at cgl.ucsf.edu
Fri Sep 26 18:01:34 PDT 2003


On Friday, September 26, 2003, at 01:50 AM, Lars Kunert wrote:

> Hi I have got a couple of questions.

Hi Lars.  Seems like more than a couple of questions!  :-)

> After loading a couple of molecules (files) into chimara:
>
>>>> opened = chimera.openModels.open('xxx.mol2')
>
> How do I access the name of the file, the model was loaded from?

For models that were opened using openModels.open(), there will be a  
'name' attribute that gives a short name suitable for display in user  
interface widgets.  There will also be an 'openedAs' attribute which is  
a tuple that records the important arguments used when the model was  
opened with the openModels.open() function.  The first member of that  
tuple is the file name.

So, if you had used openModels.open() to open  
/usr/mol/pdb/gc/pdb1gcn.ent, then the model's '.name' attribute would  
be 'pdb1gcn.ent' and .openedAs[0] would be  
'/usr/mol/pdb/gc/pdb1gcn.ent'.

> How can I find out if a model/molecule is active and on the screen? If  
> not , who can I make it active, and zoom to it?

Models have an attribute called 'openState' that in turn has an  
attribute named 'active' that controls whether the model is active or  
not.  OpenState instances might be shared among several models that  
need to move in synchrony (e.g. a molecule and its surface).  This is  
discussed in the programmer's FAQ (which isn't in the 1700 release) at  
http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html  
(openState is question #9).

I don't think there is any easy way to tell if a model is visible on  
the screen.  Firstly, the various bonds/atoms/residues of a molecule  
may be displayed or undisplayed and the molecule model itself may be  
displayed or undisplayed as described in the Display Hierarchy section  
of the "Chimera's Object Model" example at  
http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/ 
index.html .  Secondly, the view may not be pointed towards the model  
and/or the clipping planes may or may not cut off the model.

You can "zoom" to a model with the window() function of the Midas  
module:

	import Midas
	from chimera.selection import ItemizedSelection
	sel = ItemizedSelection()
	sel.add(m)  # 'm' is your model
	Midas.window(sel)

You might, however, want to instead use the "focus" function of the  
Midas module, which will zoom in on just the displayed portions of the  
model and will put the center of rotation in the center of the view.   
The code would be identical to the above with "focus" instead of  
"window".

> How do I display a set of spheres, together with with some edges  
> connecting them. I do like to show some kind of pseudo-molecule/graph.

You could construct a VRML file to display the spheres/edges.  Chimera  
can read/display VRML.

Perhaps a simpler solution is to create a fake molecule and use that to  
show the spheres/edges.  The ScaleBar extension does exactly that.  If  
you look in <where you installed chimera>/share/ScaleBar/__init__.py,  
the make_model() function creates the fake molecule used by ScaleBar.   
I should mention that the way bond thickness is controlled has changed  
since the 1700 release, so if you change the "bond" thickness of the  
fake molecule, you might have to update that part of your code when the  
next release comes out.

> Can I display an ellipsoid? - Do I have to construct it from triangles?

As far as I know, you would have to make a VRML model and construct the  
ellipsoid from triangles.  Sorry.  Perhaps some of the other Chimera  
developers can chime in if they have a better idea...

> I want to display a binding pocket, can I limit the amount of data  
> displayed before the proterin is shown the first time?

You can set the 'display' attributes of atoms you don't want to show to  
False after opening the model.  You might then want to use the focus()  
function mentioned above.

If it is your extension doing the opening of the model, you can just do  
the changing of the display attributes and focusing right after your  
script opens the model and before it yields control back to the Tk  
event loop (which is when the model is first displayed).

If you are trying to adjust a model opened by the user, then you have  
to register a callback function with the chimera.openModels instance,  
like this:

	chimera.openModels.addAddHandler(f, None) # 'f' is your callback  
function

Then when models are opened via openModels, your function will be  
called with three arguments:  the "trigger" name (in this case  
chimera.openModels.ADDMODEL), data given when you registered the  
callback (in the example above, None), and data associated with this  
occurance (a list of models).  You would probably want to filter the  
list down to Molecule instances and then handle them appropriately.

Triggers are discussed in more detail in the "Trigger Notifications"  
programmer's example.

> I have got some problems with the calculation of surfaces (1dwd always  
> crashs...). Is it possible to limit the surface-calculation to an  
> connected area (pocket).

The MSMS surface algorithm doesn't seem to like 1dwd much.  We'll see  
if there is anything we can do about that before the next release.

You can "kind of" restrict the surface calculation to a set of atoms,  
but then other atoms won't be considered for collisions -- so while the  
"front side" of the pocket will be correct, there will be an unwanted  
"back side" behind it.  However, this may be acceptable until we can  
get the MSMS algorithm to work more robustly.  Anyway, to do this you  
need to set the "surfaceCategory" attribute of the atoms you want  
surfaced to a string that isn't otherwise used as a category (i.e.  
_not_ main, ligand, ions, or solvent) -- something like "pocket".  Then  
create the surface with the Midas surfaceNew function, like this:

	import Midas
	Midas.surfaceNew("pocket", models=[m])  # 'm' is the model to surface

> By the way, the tutorials are great, but the reference manual will  
> probably need some efford...

Yes, the programmer documentation is not yet adequate and we will be  
working on it!

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         pett at cgl.ucsf.edu
                         http://www.cgl.ucsf.edu



More information about the Chimera-dev mailing list