[MMTK] Creating a Protein object from one chain of the PDB

Konrad Hinsen konrad.hinsen at cea.fr
Thu Mar 16 15:55:22 CET 2006


On Mar 16, 2006, at 15:46, vanitha at cs.wisc.edu wrote:

> Thanks a lot for your responses. How do I access these proteins  
> once I add
> them to the universe? Is there a "for protein in Universe.Protein"  
> kind of
> iterator?

Yes:

	from MMTK.Proteins import Protein
	for protein in universe.objectList(Protein):
		...

This will iterate over all objects in the universe that are an  
instance of the class Protein.

However, in practice it is clearer and simpler to name the protein  
objects, unless there are very many of them. Either you keep a  
variable referring to them:

	p1 = Protein(...)
	universe.addObject(p1)

or make the protein an attribute of the universe:

	universe.protein1 = Protein(...)

In the second case, the call to universe.addObject() is not necessary.

Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Laboratoire Léon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: konrad.hinsen at cea.fr
---------------------------------------------------------------------





More information about the mmtk mailing list