[chimera-dev] mixing names

Tom Goddard goddard at cgl.ucsf.edu
Tue Oct 14 10:57:16 PDT 2008


Hi Patrick,

  Here's some Python code that illustrates making atoms.  It copies a 
Chimera molecule (taken from chimera/share/PDBmatrices/copymolecule.py).

    Tom


Patrick Ladam wrote:
> Hello to the list,
> I start trying to write my first py code in chimera (not that easy
> without too much doc strings) and have a first question to submit.
>
> Here is what I am doing in IDLE:
>
>   
>>>> import chimera
>>>> opened = chimera.openModels.open('1zik.pdb')
>>>>         
>
>   
>>>> mol = opened[0]
>>>> for i in mol.atoms:
>>>>         
> 	print i.name
>
> N
> CA
> CB
> CG
> CD
> .../...
>
> # Now I want to instanciate an atom and set its name attribute:
>
>   
>>>> at1=chimera.Atom
>>>> at1.name="BC1"
>>>> print at1.name
>>>>         
> BC1
>   
>
> # Now I redo the previous loop:
>
>   
>>>> for i in mol.atoms:
>>>>         
> 	print i.name
>
> 	
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> BC1
> .../...
>
> They're all BC1!!!
>
> How come ? My created atom 'at1' and my 'mol' are supposed to be
> completely seperated objects no?
>
> Can someone help, I am afraid I missed something really basic here...
> Bye to all
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: copymolecule.py
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20081014/c8cfe9de/attachment.ksh>


More information about the Chimera-dev mailing list