<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>You can get the centroid of your model with:</div><div class=""><br class=""></div><div class="">from StructMeasure import centroid</div><div class="">c = centroid([a.xformCoord() for a in model.atoms])</div><div class=""><br class=""></div><div class="">(… possibly coord() instead of xformCoord() if you want the centroid in the model’s original coordinate frame). The centroid() function returns a chimera.Point object. Point has .x(), .y(), and .z() methods, or a .data() method to get a 3-tuple of floats. You can get a translation matrix with:</div><div class=""><br class=""></div><div class="">xf = chimera.Xform.translate(*c.data())</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>It’s a weakness of Chimera that there isn’t really good documentation for these kind of manipulation functions (one of the things we will remedy in ChimeraX). You either have to find code in Chimera which does the same kind of things and adapt that, or open the IDLE shell (in General Controls) and use Python inspection to see the capabilities of various classes (e.g. help(chimera.Xform) would have revealed the ‘translate’ method). Don’t be shy about asking questions on chimera-dev if you have problems; it’s what it’s for!</div><div class=""><br class=""></div><div class="">—Eric</div><div class=""><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 class=""><br class=""></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Oct 26, 2016, at 1:52 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 attempting to find the centroid of a protein and then translating it based on the output. Is there any function that does this? </div><div class=""><br class=""></div><div class=""><div style="font-size:13px" class="">model = chimera.openModels.open('test_<wbr class="">python/'+filename)</div><div style="font-size:13px" class=""><span class="gmail-m_-6044322858221059299gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>mol = model[0]</div><div style="font-size:13px" class=""><span class="gmail-m_-6044322858221059299gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>axis = chimera.Vector(1,1,1)</div><div style="font-size:13px" class=""><span class="gmail-m_-6044322858221059299gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>angle = 180</div><div style="font-size:13px" class=""><span class="gmail-m_-6044322858221059299gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>xf = chimera.Xform.rotation(axis,<wbr class="">angle)</div></div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">I am using chimera.Xform functions for my implementation.</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">Also, Is there a documentation that lists down all functions that are currently available to manipulate proteins?</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">Thank you.</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">Regards,</div><div style="font-size:13px" 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></div></body></html>