[chimera-dev] (no subject)
Eric Pettersen
pett at cgl.ucsf.edu
Wed Oct 26 17:11:18 PDT 2016
Hi Kavya,
You can get the centroid of your model with:
from StructMeasure import centroid
c = centroid([a.xformCoord() for a in model.atoms])
(… 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:
xf = chimera.Xform.translate(*c.data())
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!
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
> On Oct 26, 2016, at 1:52 PM, Kavya Shankar <kavshank at umail.iu.edu> wrote:
>
> Hi,
>
> 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?
>
> model = chimera.openModels.open('test_python/'+filename)
> mol = model[0]
> axis = chimera.Vector(1,1,1)
> angle = 180
> xf = chimera.Xform.rotation(axis,angle)
>
> I am using chimera.Xform functions for my implementation.
>
> Also, Is there a documentation that lists down all functions that are currently available to manipulate proteins?
>
> Thank you.
>
> Regards,
> Kavya Shankar
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20161026/e771d40a/attachment.html>
More information about the Chimera-dev
mailing list