[Chimera-users] Write a PDB with Python API

Jaime Rodríguez-Guerra Pedregal Jaime.RodriguezGuerra at uab.cat
Tue Dec 1 23:57:55 PST 2015


Hi!


I think I might have uploaded the wrong mol2, so I just run the test again to make sure.


This is the code I run in IDLE after opening the mol2 with Chimera.


from cStringIO import StringIO

m = chimera.openModels.list()

mem = StringIO()

chimera.pdbWrite(m, m[0].openState.xform, mem)

with open('converted.pdb', 'w') as f:
f.write(mem.getvalue())


And the outputs are attached.


I then opened the PDB and superimposed the two models with "mm #0 #1". If you display all the side chains, you will see that the ARG 41 residue is messed up (quick screenshot attached too).


Thanks!


________________________________
De: Eric Pettersen <pett at cgl.ucsf.edu>
Enviado: miércoles, 2 de diciembre de 2015 0:00
Para: Jaime Rodríguez-Guerra Pedregal
Cc: chimera-users at cgl.ucsf.edu
Asunto: Re: [Chimera-users] Write a PDB with Python API

I guess there's something I don't understand:  are you saying that the mol2 file is what you read into Chimera to start with?  That makes no sense to me because there are residues in the PDB file (IR3, 4IR) that don't exist in the mol2 file!  Where did they come from?

-Eric

Eric Pettersen
UCSF Computer Graphics Lab

On Dec 1, 2015, at 9:11 AM, Jaime Rodríguez-Guerra Pedregal <Jaime.RodriguezGuerra at uab.cat<mailto:Jaime.RodriguezGuerra at uab.cat>> wrote:

Hi again!

So in my quest to use OpenMM from Chimera, my first proof-of-concept attempts consist of using a PDB file as intermediate to convert chimera.Molecule objects to OpenMM Topologies (using openmm.app.PDBFile loader).

While not ideal yet, it'd be convenient to use StringIO() as a memory file, and I have been more or less successful. This is my strategy:

memfile = StringIO()
m = chimera.openModels.list()
chimera.pdbWrite(m, m[0].openState.xform, memfile)
memfile.seek(0)
# pass memfile to openmm.app.PDBFile and do OpenMM stuff
memfile.close()

It works, but some residues are not properly recognised... I dumped the converted PDB to an actual file and saw that the problematic residue (an ARG) is totally messed up! I've attached the results: original file is the mol2, the converted one is the pdb, and also a Chimera session with both superimposed.

What's the recommended method to convert a chimera.Molecule to a PDB file (if possible, in-memory) with Chimera Python API?

Thanks a lot!
<streptavidin.mol2><streptavidin.pdb><pdbwritebug.py.zip>_______________________________________________
Chimera-users mailing list
Chimera-users at cgl.ucsf.edu<mailto:Chimera-users at cgl.ucsf.edu>
http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20151202/95efb7e5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: converted.pdb
Type: chemical/x-pdb
Size: 73166 bytes
Desc: converted.pdb
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20151202/95efb7e5/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streptavidin.mol2
Type: chemical/x-mol2
Size: 91889 bytes
Desc: streptavidin.mol2
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20151202/95efb7e5/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2015-12-02 08:57:26.png
Type: image/png
Size: 140022 bytes
Desc: Screenshot from 2015-12-02 08:57:26.png
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20151202/95efb7e5/attachment-0001.png>


More information about the Chimera-users mailing list