<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi!</p>
<p><br>
</p>
<p>I think I might have uploaded the wrong mol2, so I just run the test again to make sure.</p>
<p><br>
</p>
<p>This is the code I run in IDLE after opening the mol2 with Chimera.</p>
<p><br>
</p>
<p>from cStringIO import StringIO<br>
</p>
<p>m = chimera.openModels.list()<br>
</p>
<p>mem = StringIO()<br>
</p>
<p>chimera.pdbWrite(m, m[0].openState.xform, mem)<br>
</p>
<p></p>
<div>with open('converted.pdb', 'w') as f:</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>f.write(mem.getvalue())</div>
<br>
<p></p>
<p>And the outputs are attached.</p>
<p><br>
</p>
<p>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).</p>
<p><br>
</p>
<p>Thanks!</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> Eric Pettersen <pett@cgl.ucsf.edu><br>
<b>Enviado:</b> miércoles, 2 de diciembre de 2015 0:00<br>
<b>Para:</b> Jaime Rodríguez-Guerra Pedregal<br>
<b>Cc:</b> chimera-users@cgl.ucsf.edu<br>
<b>Asunto:</b> Re: [Chimera-users] Write a PDB with Python API</font>
<div> </div>
</div>
<div>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?
<div class=""><br class="">
</div>
<div class="">—Eric</div>
<div class=""><br class="">
<div class="">
<div class="" style="color:rgb(0,0,0); letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; word-wrap:break-word">
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>Eric Pettersen</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>UCSF Computer Graphics Lab</div>
<div class=""><br class="">
</div>
</div>
</div>
<div>
<blockquote type="cite" class="">
<div class="">On Dec 1, 2015, at 9:11 AM, Jaime Rodríguez-Guerra Pedregal <<a href="mailto:Jaime.RodriguezGuerra@uab.cat" class="">Jaime.RodriguezGuerra@uab.cat</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" class="" style="font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; font-size:12pt; background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px">Hi again!</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">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). </div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">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:</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">memfile = StringIO()</div>
<div class="" style="margin-top:0px; margin-bottom:0px">m = chimera.openModels.list()</div>
<div class="" style="margin-top:0px; margin-bottom:0px">chimera.pdbWrite(m, m[0].openState.xform, memfile)</div>
<div class="" style="margin-top:0px; margin-bottom:0px">memfile.seek(0)</div>
<div class="" style="margin-top:0px; margin-bottom:0px"># pass memfile to openmm.app.PDBFile and do OpenMM stuff</div>
<div class="" style="margin-top:0px; margin-bottom:0px">memfile.close()</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">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.</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">What's the recommended method to convert a chimera.Molecule to a PDB file (if possible, in-memory) with Chimera Python API?</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Thanks a lot!</div>
</div>
<span id="cid:F216D220-45A4-4F1D-96D9-65FC3DD68637@cgl.ucsf.edu"><streptavidin.mol2></span><span id="cid:F3C6F024-3F55-418B-8BF8-4C0BE74CC332@cgl.ucsf.edu"><streptavidin.pdb></span><span id="cid:00BD2253-8E28-42E0-B4BD-3BADD2A9D3D5@cgl.ucsf.edu"><pdbwritebug.py.zip></span><span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; float:none; display:inline!important">Chimera-users
mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<a href="mailto:Chimera-users@cgl.ucsf.edu" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">Chimera-users@cgl.ucsf.edu</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>