[chimera-dev] loading files

Eric Pettersen pett at cgl.ucsf.edu
Sun Oct 12 11:51:30 PDT 2003


On Friday, October 10, 2003, at 02:04  AM, Lars Kunert wrote:

> Hi!
>
> First of all thanks for your replies to my previous questions, they 
> were
> really great!

I'm glad they were useful.

> when i open a file (mol2) with
> openmodel...
>
> how do I influence into which slot/subslot ( I suppose that are not the
> right terms, but I hope you know what I mean)

We call them id and subid.

> the molecule (molecules) are loaded.
>
> I want something that loads mol2-file containing one molecule into 
> slot X
> subslot Y and
> a multimol2 file containing Z molecules into slot X starting at 
> subslot Y

The API in the 1700 release doesn't offer enough control for you to do 
this.  You need to pick up the 1864 snapshot release (which is on the 
website) in order to control the subid of models you open.

In the 1864 release you would use

	chimera.openModels.open(fileName, type="Mol2", baseId=X, subid=Y)

to open one or models into id X starting at subid Y.   The open() 
method returns a list of the models that were opened.

I assume that your examples are just accidentally reusing X and Y; one 
normally doesn't want to load two molecule models into the same 
id/subid (which would force them to always move in synchrony).  One 
does sometime want to put two models into the same id/subid (for 
instance a molecule and its surface, or a molecule and a VRML model 
showing features of that molecule) -- in that case you use the 'sameAs' 
keyword to specify a model to get an id/subid from, rather than using 
the baseId/subid keywords.

One further thing to know is that if you build a model in Python 
(rather than read it from a file), you would use 
chimera.openModels.add() to add it to the list of open models, and that 
function also takes baseId and subid keyword arguments (as well as the 
'sameAs' keyword).

> How do I delete a model (or one specific molecule in a model) from a 
> slot
> (subslot) - ( by slot/subslot - numbers and/or by name)?

You use chimera.openModels.close() and give it a list of models to 
close.  If you aren't explicitly keeping track of the models yourself, 
you can use chimera.openModels.list() to get a list of models with a 
particular id/subid, like this:

	chimera.openModels.list(id=X, subid=Y, modelTypes=[chimera.Molecule])

You can omit the modelTypes keyword if you just want all models with 
that id/subid.  Similarly, omitting subid will give you all models with 
id X, and omitting id will give you all models.

One of the other developers will be answering your other two mails soon.

	Eric Pettersen
	UCSF Computer Graphics Lab
	pett at cgl.ucsf.edu




More information about the Chimera-dev mailing list