<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Kavya,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>The trouble is here:</div><div class=""><br class=""></div><div class="">chimera.pdbWrite(model,mol.openState.xform,mem)</div><div class=""><br class=""></div><div class="">By providing the molecule’s own transform as the second argument, you are having pdbWrite output the model’s coordinates relative to it’s own transformation — essentially undoing any rotations or translations that have been applied to the model. You want to provide the identity matrix as the second argument, e.g. “chimera.Xform.identity()”.</div><div class=""><br class=""></div><div class="">—Eric</div><div class=""><br class=""><div class="">
<div 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; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><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><br class="Apple-interchange-newline">
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Oct 25, 2016, at 1:45 PM, Kavya Shankar <<a href="mailto:kavshank@umail.iu.edu" class="">kavshank@umail.iu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi, <div class=""><br class=""></div><div class="">I am new to chimera and I am attempting to write a python script that would rotate the models by some angle and then writing it to another pdb file with changed coordinates.</div><div class=""><br class=""></div><div class=""><div class="">import chimera</div><div class="">import os</div><div class="">from cStringIO import StringIO</div><div class=""><br class=""></div><div class="">for filename in os.listdir("test_python"):</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>print filename</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>model = chimera.openModels.open('test_python/'+filename)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>mol = model[0]</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>axis = chimera.Vector(1,1,1)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>angle = 180</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>xf = chimera.Xform.rotation(axis,angle)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>matrix = chimera.Xform.getOpenGLMatrix(xf)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>print mol.openState.xform</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>mol.openState.localXform(xf)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>print mol.openState.xform</div><div class=""><br class=""></div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>mem =StringIO()</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>chimera.pdbWrite(model,mol.openState.xform,mem)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>print mol.openState.xform</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>with open('converted.pdb','w') as f:</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>f.write(mem.getvalue())</div><div class=""><br class=""></div></div><div style="" class="">This is my code so far. When I run it, the converted.pdb file does not contain any changed coordinates. The coordinates of the atoms are same as before.</div><div style="" class=""><br class=""></div><div style="" class="">Am I making some mistake? Is there any other way of doing this easily?</div><div style="" class=""><br class=""></div><div style="" class="">Thanks.</div><div style="" class=""><br class=""></div><div style="" class="">Regards,</div><div style="" class="">Kavya Shankar</div></div>
_______________________________________________<br class="">Chimera-dev mailing list<br class=""><a href="mailto:Chimera-dev@cgl.ucsf.edu" class="">Chimera-dev@cgl.ucsf.edu</a><br class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev<br class=""></div></blockquote></div><br class=""></div></body></html>