[Chimera-users] Angles
Greg Pintilie
pintilie at mit.edu
Tue Nov 6 07:38:23 PST 2007
yes, try:
chimera.selection.currentAtoms()
this will return a list of the currently selected atoms in the Chimera viewer.
For your purposes, it sounds like you want vectors between every two
atoms that you subsequently select. Watch out however, that the list
returned by the above command need not be in the order that you made
the selection. I noticed that in general the selection routines return
atoms in arbitrary order, independent of the selection order or their
position in the structure. Not sure if there is any way to enforce any
kind of order?
I would get around this by making the list manually:
list = []
list = list + [chimera.selection.OSLSelection(":32.A at CA").atoms()[0],
chimera.selection.OSLSelection(":33.A at CA").atoms()[0] ]
list = list + [chimera.selection.OSLSelection(":34.A at CA").atoms()[0],
chimera.selection.OSLSelection(":35.A at CA").atoms()[0] ]
...
you can get the atom names and residues they're in easily of course by
putting the mouse over them in the viewer
a good thing about that is if you put the above in a script you'll
have it available for later if you ever want to redo the measurements
then you can compute angles between each vector by using a loop:
import numpy
for atoms in alist :
v = atoms[1].coord() - atoms[0].coord()
v.normalize()
theta_to_x_in_degrees = numpy.arccos (v *
chimera.Vector(1,0,0))*180/numpy.pi
print "Res %d Atom %s to Res %d Atom %s angle to X-axis: %f" %
(atoms[0].residue.id.position, atoms[0].name,
atoms[1].residue.id.position, atoms[1].name, theta_to_x_in_degrees )
Greg
On Nov 6, 2007 10:05 AM, <hsosa at aecom.yu.edu> wrote:
> Hi Greg,
>
> Yes that is what I meant. My questions now is: Is it possible in idle to
> get the atoms being currently selected on the structure display window
> instead of explicitily writing their number ?
>
> i.e.
>
> Is there a command like:
>
> at1 = XXX.Current_selection_on_screen.atoms()[0]
>
> instead of:
>
> at1 = chimera.selection.OSLSelection(":32.A at CA").atoms()[0]
>
>
> Thanks
>
> Hernando
>
>
>
> Greg Pintilie wrote:
>
> > If you think of the line connecting the two atoms as a vector (with no
> > position in space), then it's angle to another vector (e.g. the x-axis
> > (1,0,0)) can be computed from the definition of dot product:
> >
> > u . v = |u| * |v| * cos ( theta)
> >
> > where u . v is the dot product between the vectors u and v, theta is
> > the angle between the vectors u and v, and |u| is the magnitude
> > (length) of u
> >
> > so
> >
> > cos ( theta) = u . v / ( |u| * |v| )
> > theta = arccos ( u.v / ( |u| * |v| ) )
> >
> > if the vectors u and v are normalized / have unit length of 1 then you
> > can simplify:
> >
> > theta = arccos ( u.v )
> >
> > within chimera, in the python interpreter IDLE, you first need to get
> > the coordinates of the two atoms, for example, to get the vector from
> > the alpha carbon in residue 32 to the alpha carbon in residue 33:
> >
> > at1 = chimera.selection.OSLSelection(":32.A at CA").atoms()[0]
> > at2 = chimera.selection.OSLSelection(":33.A at CA").atoms()[0]
> > v = at2.coord() - at1.coord()
> > v.normalize()
> > import numpy
> > theta_to_x_in_degrees = numpy.arccos ( v * chimera.Vector(1,0,0) ) *
> > 180 / numpy.pi
> >
> >
> > hope that helps...
> >
> > Greg
> >
> >
> >
> > On Nov 5, 2007 3:24 PM, <hsosa at aecom.yu.edu> wrote:
> >
> >> Hi,
> >> I have a couple of questions:
> >>
> >> Is there a simple way to determine the angle between any of the three
> >> axes, X,Y or Z and the line connecting two selected atoms?. I know you
> >> can use the Angles/Torsions tools to determine the angle formed between
> >> 3 sets of atoms, but I wonder if you could use that tool, or some
> >> other, to report the angle of two atoms with the axes?.
> >>
> >> Is it possible to draw a box with the axes around a structure as it can
> >> be done with a volume ?.
> >>
> >> Thanks
> >>
> >> Hernando
> >>
> >> --
> >> -----------------------------------
> >> Hernando Sosa
> >> Dept. of Physiology and Biophysics
> >> Albert Einstein College of Medicine
> >> 1300 Morris Park Av.
> >> Bronx NY 10461
> >> phone (718) 430-3456
> >> FAX (718) 430-8819
> >> email hsosa at aecom.yu.edu
> >> -----------------------------------
> >>
> >>
> >>
> >> _______________________________________________
> >> Chimera-users mailing list
> >> Chimera-users at cgl.ucsf.edu
> >> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> >>
> >>
> >
> >
> >
>
> --
>
> -----------------------------------
> Hernando Sosa
> Dept. of Physiology and Biophysics
> Albert Einstein College of Medicine
> 1300 Morris Park Av.
> Bronx NY 10461
> phone (718) 430-3456
> FAX (718) 430-8819
> email hsosa at aecom.yu.edu
> -----------------------------------
>
>
>
>
More information about the Chimera-users
mailing list