Re: [PyMOL] Super Bug Report

2010-09-23 Thread Thomas Holder
Hi David,

this is bug, indeed. I also hit this some time ago but didn't report it
so far. The actual problem is that the cmd.super('1acb', '426d') fails
completely and only aligns a single atom, resulting in a Null-matrix
that collapses all of 1acb into a single point. The RMSD of 2.8 that you
get in your last call is just an artefact that arises from aligning the
correct protein to the collapsed one. Just run your example with GUI and
you see what happens.

fetch 1acb
fetch 426d
copy 1acb_2, 1acb
super 1acb, 426d
super 1acb, 1acb_2, object=aln
zoom aln

I think the super command should check if the resulting matrix is
orthonormal or at least not a Null-matrix.

Cheers,
  Thomas

On Wed, 2010-09-22 at 18:28 -0400, David Hall wrote:
 In preparing my test for the odd request that I just sent, I came
 across what seems to be a bug in super.  It has to do with this weird
 nucleic acid thing I was talking about.
 
 Here's the script this time:
 from pymol import cmd
 
 cmd.fetch('1acb', async=0)
 cmd.fetch('1acb', '1acb_2', async=0)
 cmd.fetch('426d', async=0)
 
 
 print 1acb_2; print cmd.super('1acb', '1acb_2')[0]
 print 426d; print cmd.super('1acb', '426d')[0]
 print 1acb_2_again; print cmd.super('1acb', '1acb_2')[0]
 
 ~ ~/src/pymol_trunk_20100922/pymol -qrkc script2.py
 PyMOLrun script2.py,main
 1acb_2
 0.0
 426d
 0.0
 1acb_2_again
 2.80655193329
 
 super should give an rms between 1acb and 1acb_2 of 0.0, which it does
 at first.  But once you super your protein to a nucleic acid that has
 a calcium ion, when you run exactly the same command, you all of a
 sudden get 2.8.  Very weird...
 
 Note, this does not happen if you use 100d, which is a nucleic acid
 without a calcium ion, does not happen if you use a pdb file with a
 calcium ion, and does happen with 1d56, which is another nucleic acid
 with a calcium ion I just pulled out.
 
 In pymol 1.2, it also behaved incorrectly:
 ~ pymol -qrkc script2.py
 PyMOLrun script2.py,main
 1acb_2
 0.0
 426d
 nan
 1acb_2_again
 nan
 
 
 -David

-- 
Thomas Holder
Group of Steffen Schmidt
Department of Biochemistry
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Ramiro Téllez Sanz


Hi everyone and thanks for reading this!

I am interested in measuring the angle between aromatic ring planes.
Is there any easy way/script to do it?

One way that came to my mind is creating a pseudoatom representing the
centroid for each ring (I already know how to do that), then drawing two
lines perpendicularly to the planes from both centroids, and finally
measuring the angle between the lines. Will that be possible? How could
this be done?

Is there any other way? I'm completely clueless. Any help will be
greatly appreciated.

Thanks in advance,

Ramiro Tellez Sanz
Dept. Physical Chemistry
University of Almeria
Spain


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Ramiro Téllez Sanz
 Hi everyone and thanks for reading this!

I am interested in measuring the angle between aromatic ring planes.
Is there any easy way/script to do it?

One way that came to my mind is creating a pseudoatom representing the
centroid for each ring (I already know how to do that), then drawing two
lines perpendicularly to the planes from both centroids, and finally
measuring the angle between the lines. Will that be possible? How could
this be done?

Is there any other way? I'm completely clueless. Any help will be
greatly appreciated.

Thanks in advance,

Ramiro Tellez Sanz
Dept. Physical Chemistry
University of Almeria
Spain

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Tsjerk Wassenaar
Hi Ramiro,

Assuming your rings are nicely planar, and representing the ring as:

1-2-3
| |
6-5-4

you can get the plane normal vector as the vector cross product from
(3)-(1) and (5)-(1).
Doing so for both rings gives you the two normal vectors. The angle
then follows from the dot product of the (normalized) normal vectors:

angle = acos(n1 . n2)

It becomes a bit more elaborate if the planes are not planar :)

Hope it helps,

Tsjerk

On Thu, Sep 23, 2010 at 10:53 AM, Ramiro Téllez Sanz
urcind...@gmail.com wrote:


 Hi everyone and thanks for reading this!

 I am interested in measuring the angle between aromatic ring planes.
 Is there any easy way/script to do it?

 One way that came to my mind is creating a pseudoatom representing the
 centroid for each ring (I already know how to do that), then drawing two
 lines perpendicularly to the planes from both centroids, and finally
 measuring the angle between the lines. Will that be possible? How could
 this be done?

 Is there any other way? I'm completely clueless. Any help will be
 greatly appreciated.

 Thanks in advance,

 Ramiro Tellez Sanz
 Dept. Physical Chemistry
 University of Almeria
 Spain


 --
 Start uncovering the many advantages of virtual appliances
 and start using them to simplify application deployment and
 accelerate your shift to cloud computing.
 http://p.sf.net/sfu/novell-sfdev2dev
 ___
 PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
 Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
 Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net




-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
Groningen Institute for Biomolecular Research and Biotechnology /
University of Groningen
The Netherlands

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Ramiro Téllez Sanz
 Thanks for your kind help, Tsjerk.

 Hi Ramiro,

 Assuming your rings are nicely planar, and representing the ring as:

 1-2-3
 | |
 6-5-4

 you can get the plane normal vector as the vector cross product from
 (3)-(1) and (5)-(1).

OK. But I just started to use pymol. Which are the commands to do so?
I know how to get the coordinates of a selected atom, but need the pymol
commands to treat the data:
a) How to create the vectors from 1-3 and from 1-5
b) How to treat the vectors to perform the vector cross product

 Doing so for both rings gives you the two normal vectors. The angle
 then follows from the dot product of the (normalized) normal vectors:

 angle = acos(n1 . n2)

Again, I would need the commands to:
c) Normalize the vectors (how to set their modules = 1)

I also guess n1 and n2 represent the normalized vectors, don't they? So
this command is very clear :)

 It becomes a bit more elaborate if the planes are not planar :)

 Hope it helps,

 Tsjerk

Again, thanks very much in advance for your kind help.

 On Thu, Sep 23, 2010 at 10:53 AM, Ramiro Téllez Sanz
 urcind...@gmail.com wrote:

 Hi everyone and thanks for reading this!

 I am interested in measuring the angle between aromatic ring planes.
 Is there any easy way/script to do it?

 One way that came to my mind is creating a pseudoatom representing the
 centroid for each ring (I already know how to do that), then drawing two
 lines perpendicularly to the planes from both centroids, and finally
 measuring the angle between the lines. Will that be possible? How could
 this be done?

 Is there any other way? I'm completely clueless. Any help will be
 greatly appreciated.

 Thanks in advance,

 Ramiro Tellez Sanz
 Dept. Physical Chemistry
 University of Almeria
 Spain


 --
 Start uncovering the many advantages of virtual appliances
 and start using them to simplify application deployment and
 accelerate your shift to cloud computing.
 http://p.sf.net/sfu/novell-sfdev2dev
 ___
 PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
 Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
 Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net





--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Thomas Holder
no need to implement common linear algebra functions, there is the
chempy.cpv module shipped with pymol (and there is numpy as well).

Ramiro, I recently did something similar, just adjust the residue
selection in the code below (requires numpy):

python
from chempy import cpv
import numpy, math
def plane_normal(selection):
stored.x = list()
cmd.iterate_state(-1, selection, 'stored.x.append([x,y,z])')
x = numpy.array(stored.x)
U,s,Vh = numpy.linalg.svd(x - x.mean(0))
return cpv.normalize(Vh[2])
dir1 = plane_normal('A/37/CG+CD1+CE1+CZ+CE2+CD2')
dir2 = plane_normal('A/41/CG+CD1+CE1+CZ+CE2+CD2')
print 'Angle in degrees:', math.degrees(cpv.get_angle(dir1, dir2))
python end

Cheers,
  Thomas

On Thu, 2010-09-23 at 13:02 +0200, Tsjerk Wassenaar wrote:
 Hi Ramiro,
 
 A bit of linear algebra wouldn't hurt... :p
 In python:
 
 def vsub(a,b): return a[0]-b[0], a[1]-b[1], a[2]-b[2]
 
 def dot(a,b): return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]
 
 def svmul(s,a): return s*a[0], s*a[1], s*a[2]
 
 def normalize(a): return svmul(1/math.sqrt(dot(a,a)),a)
 
 def cross(a,b): return a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2],
 a[0]*b[1]-a[1]*b[0]
 
 a = cmd.get_model('r. phe and i. ##RESIDUE1## and n. cg,ce1,ce2').atom
 a = [ i.coord for i in a ]
 b = cmd.get_model('r. phe and i. ##RESIDUE2## and n. cg,ce1,ce2').atom
 b = [ i.coord for i in b ]
 
 na = normalize(cross(vsub(a[1],a[0]),vsub(a[2],a[0])))
 nb = normalize(cross(vsub(b[1],b[0]),vsub(b[2],b[0])))
 angle = math.acos(dot(na,nb))
 
 print angle
 
 ###
 
 Haven't tested it, and there may be more efficient ways of getting the
 coordinates. If you run into problems like this more often, it's
 likely that you should pick up on algebra and programming... :)
 
 Have fun,
 
 Tsjerk
 
 
 On Thu, Sep 23, 2010 at 12:19 PM, Ramiro Téllez Sanz
 urcind...@gmail.com wrote:
   Thanks for your kind help, Tsjerk.
 
  Hi Ramiro,
 
  Assuming your rings are nicely planar, and representing the ring as:
 
  1-2-3
  | |
  6-5-4
 
  you can get the plane normal vector as the vector cross product from
  (3)-(1) and (5)-(1).
 
  OK. But I just started to use pymol. Which are the commands to do so?
  I know how to get the coordinates of a selected atom, but need the pymol
  commands to treat the data:
  a) How to create the vectors from 1-3 and from 1-5
  b) How to treat the vectors to perform the vector cross product
 
  Doing so for both rings gives you the two normal vectors. The angle
  then follows from the dot product of the (normalized) normal vectors:
 
  angle = acos(n1 . n2)
 
  Again, I would need the commands to:
  c) Normalize the vectors (how to set their modules = 1)
 
  I also guess n1 and n2 represent the normalized vectors, don't they? So
  this command is very clear :)
 
  It becomes a bit more elaborate if the planes are not planar :)
 
  Hope it helps,
 
  Tsjerk
 
  Again, thanks very much in advance for your kind help.
 
  On Thu, Sep 23, 2010 at 10:53 AM, Ramiro Téllez Sanz
  urcind...@gmail.com wrote:
 
  Hi everyone and thanks for reading this!
 
  I am interested in measuring the angle between aromatic ring planes.
  Is there any easy way/script to do it?
 
  One way that came to my mind is creating a pseudoatom representing the
  centroid for each ring (I already know how to do that), then drawing two
  lines perpendicularly to the planes from both centroids, and finally
  measuring the angle between the lines. Will that be possible? How could
  this be done?
 
  Is there any other way? I'm completely clueless. Any help will be
  greatly appreciated.
 
  Thanks in advance,
 
  Ramiro Tellez Sanz
  Dept. Physical Chemistry
  University of Almeria
  Spain
 
 
 -- 
 Tsjerk A. Wassenaar, Ph.D.
 
 post-doctoral researcher
 Molecular Dynamics Group
 Groningen Institute for Biomolecular Research and Biotechnology /
 University of Groningen
 The Netherlands
-- 
Thomas Holder
Group of Steffen Schmidt
Department of Biochemistry
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen




--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Ramiro Téllez Sanz
 Thanks very much Thomas for your help.

 no need to implement common linear algebra functions, there is the
 chempy.cpv module shipped with pymol (and there is numpy as well).

 Ramiro, I recently did something similar, just adjust the residue
 selection in the code below (requires numpy):


I have pymol compiled with numpy support, so I have everyhting needed.
However, please excuse my ignorance in this matter, as I'm just
beginning to use pymol and have some basic questions:

* How do I adjust the code with my selected rings? Do I need to include
both residues in the same selection in pymol, then rename the selection,
and then include the chosen selection name in the code where you write
selection?

* How do I run the code after I adjust it with my selection? I have
never run a python program from within pymol. What should I do?

Thanks in advance.

 python
 from chempy import cpv
 import numpy, math
 def plane_normal(selection):
 stored.x = list()
 cmd.iterate_state(-1, selection, 'stored.x.append([x,y,z])')
 x = numpy.array(stored.x)
 U,s,Vh = numpy.linalg.svd(x - x.mean(0))
 return cpv.normalize(Vh[2])
 dir1 = plane_normal('A/37/CG+CD1+CE1+CZ+CE2+CD2')
 dir2 = plane_normal('A/41/CG+CD1+CE1+CZ+CE2+CD2')
 print 'Angle in degrees:', math.degrees(cpv.get_angle(dir1, dir2))
 python end

 Cheers,
   Thomas

 On Thu, 2010-09-23 at 13:02 +0200, Tsjerk Wassenaar wrote:
 Hi Ramiro,

 A bit of linear algebra wouldn't hurt... :p
 In python:

 def vsub(a,b): return a[0]-b[0], a[1]-b[1], a[2]-b[2]

 def dot(a,b): return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]

 def svmul(s,a): return s*a[0], s*a[1], s*a[2]

 def normalize(a): return svmul(1/math.sqrt(dot(a,a)),a)

 def cross(a,b): return a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2],
 a[0]*b[1]-a[1]*b[0]

 a = cmd.get_model('r. phe and i. ##RESIDUE1## and n. cg,ce1,ce2').atom
 a = [ i.coord for i in a ]
 b = cmd.get_model('r. phe and i. ##RESIDUE2## and n. cg,ce1,ce2').atom
 b = [ i.coord for i in b ]

 na = normalize(cross(vsub(a[1],a[0]),vsub(a[2],a[0])))
 nb = normalize(cross(vsub(b[1],b[0]),vsub(b[2],b[0])))
 angle = math.acos(dot(na,nb))

 print angle

 ###

 Haven't tested it, and there may be more efficient ways of getting the
 coordinates. If you run into problems like this more often, it's
 likely that you should pick up on algebra and programming... :)

 Have fun,

 Tsjerk


 On Thu, Sep 23, 2010 at 12:19 PM, Ramiro Téllez Sanz
 urcind...@gmail.com wrote:
  Thanks for your kind help, Tsjerk.

 Hi Ramiro,

 Assuming your rings are nicely planar, and representing the ring as:

 1-2-3
 | |
 6-5-4

 you can get the plane normal vector as the vector cross product from
 (3)-(1) and (5)-(1).
 OK. But I just started to use pymol. Which are the commands to do so?
 I know how to get the coordinates of a selected atom, but need the pymol
 commands to treat the data:
 a) How to create the vectors from 1-3 and from 1-5
 b) How to treat the vectors to perform the vector cross product

 Doing so for both rings gives you the two normal vectors. The angle
 then follows from the dot product of the (normalized) normal vectors:

 angle = acos(n1 . n2)
 Again, I would need the commands to:
 c) Normalize the vectors (how to set their modules = 1)

 I also guess n1 and n2 represent the normalized vectors, don't they? So
 this command is very clear :)

 It becomes a bit more elaborate if the planes are not planar :)

 Hope it helps,

 Tsjerk
 Again, thanks very much in advance for your kind help.

 On Thu, Sep 23, 2010 at 10:53 AM, Ramiro Téllez Sanz
 urcind...@gmail.com wrote:
 Hi everyone and thanks for reading this!

 I am interested in measuring the angle between aromatic ring planes.
 Is there any easy way/script to do it?

 One way that came to my mind is creating a pseudoatom representing the
 centroid for each ring (I already know how to do that), then drawing two
 lines perpendicularly to the planes from both centroids, and finally
 measuring the angle between the lines. Will that be possible? How could
 this be done?

 Is there any other way? I'm completely clueless. Any help will be
 greatly appreciated.

 Thanks in advance,

 Ramiro Tellez Sanz
 Dept. Physical Chemistry
 University of Almeria
 Spain

 -- 
 Tsjerk A. Wassenaar, Ph.D.

 post-doctoral researcher
 Molecular Dynamics Group
 Groningen Institute for Biomolecular Research and Biotechnology /
 University of Groningen
 The Netherlands


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Tsjerk Wassenaar
Hi Thomas,

You're right, and using an svd on the whole ring is also more correct.
But the vector stuff is simple and handy to have lying around, and it
serves also to give some insight in what's going on :)
numpy.linalg.svd is magic if you don't know how a cross product or
normalization works... So, now to make it a function taking two ring
bearing residues as arguments:

def ring_angle(selection1, selection2):
a = plane_normal(selection1 +  and not (e. h or n. c,n,ca,cb,o))
b = plane_normal(selection2 +  and not (e. h or n. c,n,ca,cb,o))
return math.degrees(cpv.get_angle(a, b))

cmd.extend(ring_angle,ring_angle)

Ramiro, do we need to write the methods section for the manuscript too? :p

Cheerio :)

Tsjerk

On Thu, Sep 23, 2010 at 1:33 PM, Thomas Holder
spel...@users.sourceforge.net wrote:
 no need to implement common linear algebra functions, there is the
 chempy.cpv module shipped with pymol (and there is numpy as well).

 Ramiro, I recently did something similar, just adjust the residue
 selection in the code below (requires numpy):

 python
 from chempy import cpv
 import numpy, math
 def plane_normal(selection):
    stored.x = list()
    cmd.iterate_state(-1, selection, 'stored.x.append([x,y,z])')
    x = numpy.array(stored.x)
    U,s,Vh = numpy.linalg.svd(x - x.mean(0))
    return cpv.normalize(Vh[2])
 dir1 = plane_normal('A/37/CG+CD1+CE1+CZ+CE2+CD2')
 dir2 = plane_normal('A/41/CG+CD1+CE1+CZ+CE2+CD2')
 print 'Angle in degrees:', math.degrees(cpv.get_angle(dir1, dir2))
 python end

 Cheers,
  Thomas

 On Thu, 2010-09-23 at 13:02 +0200, Tsjerk Wassenaar wrote:
 Hi Ramiro,

 A bit of linear algebra wouldn't hurt... :p
 In python:

 def vsub(a,b): return a[0]-b[0], a[1]-b[1], a[2]-b[2]

 def dot(a,b): return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]

 def svmul(s,a): return s*a[0], s*a[1], s*a[2]

 def normalize(a): return svmul(1/math.sqrt(dot(a,a)),a)

 def cross(a,b): return a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2],
 a[0]*b[1]-a[1]*b[0]

 a = cmd.get_model('r. phe and i. ##RESIDUE1## and n. cg,ce1,ce2').atom
 a = [ i.coord for i in a ]
 b = cmd.get_model('r. phe and i. ##RESIDUE2## and n. cg,ce1,ce2').atom
 b = [ i.coord for i in b ]

 na = normalize(cross(vsub(a[1],a[0]),vsub(a[2],a[0])))
 nb = normalize(cross(vsub(b[1],b[0]),vsub(b[2],b[0])))
 angle = math.acos(dot(na,nb))

 print angle

 ###

 Haven't tested it, and there may be more efficient ways of getting the
 coordinates. If you run into problems like this more often, it's
 likely that you should pick up on algebra and programming... :)

 Have fun,

 Tsjerk


 On Thu, Sep 23, 2010 at 12:19 PM, Ramiro Téllez Sanz
 urcind...@gmail.com wrote:
   Thanks for your kind help, Tsjerk.
 
  Hi Ramiro,
 
  Assuming your rings are nicely planar, and representing the ring as:
 
  1-2-3
  |     |
  6-5-4
 
  you can get the plane normal vector as the vector cross product from
  (3)-(1) and (5)-(1).
 
  OK. But I just started to use pymol. Which are the commands to do so?
  I know how to get the coordinates of a selected atom, but need the pymol
  commands to treat the data:
  a) How to create the vectors from 1-3 and from 1-5
  b) How to treat the vectors to perform the vector cross product
 
  Doing so for both rings gives you the two normal vectors. The angle
  then follows from the dot product of the (normalized) normal vectors:
 
  angle = acos(n1 . n2)
 
  Again, I would need the commands to:
  c) Normalize the vectors (how to set their modules = 1)
 
  I also guess n1 and n2 represent the normalized vectors, don't they? So
  this command is very clear :)
 
  It becomes a bit more elaborate if the planes are not planar :)
 
  Hope it helps,
 
  Tsjerk
 
  Again, thanks very much in advance for your kind help.
 
  On Thu, Sep 23, 2010 at 10:53 AM, Ramiro Téllez Sanz
  urcind...@gmail.com wrote:
 
  Hi everyone and thanks for reading this!
 
  I am interested in measuring the angle between aromatic ring planes.
  Is there any easy way/script to do it?
 
  One way that came to my mind is creating a pseudoatom representing the
  centroid for each ring (I already know how to do that), then drawing two
  lines perpendicularly to the planes from both centroids, and finally
  measuring the angle between the lines. Will that be possible? How could
  this be done?
 
  Is there any other way? I'm completely clueless. Any help will be
  greatly appreciated.
 
  Thanks in advance,
 
  Ramiro Tellez Sanz
  Dept. Physical Chemistry
  University of Almeria
  Spain


 --
 Tsjerk A. Wassenaar, Ph.D.

 post-doctoral researcher
 Molecular Dynamics Group
 Groningen Institute for Biomolecular Research and Biotechnology /
 University of Groningen
 The Netherlands
 --
 Thomas Holder
 Group of Steffen Schmidt
 Department of Biochemistry
 MPI for Developmental Biology
 Spemannstr. 35
 D-72076 Tübingen




 --
 Start uncovering the many advantages of virtual appliances
 and start using them to 

Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Thomas Holder
Hi Ramiro,

 * How do I adjust the code with my selected rings? Do I need to include
 both residues in the same selection in pymol, then rename the selection,
 and then include the chosen selection name in the code where you write
 selection?

you need two selections of two residues, in my example the part 'A/37/CG
+CD1+CE1+CZ+CE2+CD2' is the selection on chain A, residue 37 and ring
atoms.

 * How do I run the code after I adjust it with my selection? I have
 never run a python program from within pymol. What should I do?

I put the code (including Tsjerk's additions!) to a file, see attached.
You have to run it with pymol (File  Run...) and then call the
ring_angle command.

Example to get angle between aromatic residues 37 and 41 in chain A:
ring_angle chain A and resi 37, chain A and resi 41

Cheers,
  Thomas
from pymol import cmd, stored
from chempy import cpv
import numpy, math

def plane_normal(selection):
stored.x = list()
cmd.iterate_state(-1, selection, 'stored.x.append([x,y,z])')
x = numpy.array(stored.x)
U,s,Vh = numpy.linalg.svd(x - x.mean(0))
return cpv.normalize(Vh[2])

def ring_angle(selection1, selection2, quiet=1):
a = plane_normal(selection1 +  and not (e. h or n. c,n,ca,cb,o,oxt))
b = plane_normal(selection2 +  and not (e. h or n. c,n,ca,cb,o,oxt))
deg = math.degrees(cpv.get_angle(a, b))
if not int(quiet):
print 'Angle in degrees: %.2f' % (deg)
return deg

cmd.extend(ring_angle,ring_angle)
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Jason Vertrees
Hi Ramiro,

Another option is to fit (in a least-squares sense) a plane to each of
your rings and then calculate the angle between the fitted planes'
normals.  This would help if your rings are not perfectly planar: it
would spread the deviation among all atoms in the ring not just the
ones you selected for the crossproduct.  Cameron Mura created an
excellent example of this in our PLoS article's supplementary
information, posted on the PyMOLWiki
http://www.pymolwiki.org/index.php/PLoS#Case_6:_Higher-order_structures.28.E2.89.A5_intermediate.2Fadvanced.29

The article is all about biomolecular graphics.

Cheers,

-- Jason

On Thu, Sep 23, 2010 at 4:53 AM, Ramiro Téllez Sanz urcind...@gmail.com wrote:


 Hi everyone and thanks for reading this!

 I am interested in measuring the angle between aromatic ring planes.
 Is there any easy way/script to do it?

 One way that came to my mind is creating a pseudoatom representing the
 centroid for each ring (I already know how to do that), then drawing two
 lines perpendicularly to the planes from both centroids, and finally
 measuring the angle between the lines. Will that be possible? How could
 this be done?

 Is there any other way? I'm completely clueless. Any help will be
 greatly appreciated.

 Thanks in advance,

 Ramiro Tellez Sanz
 Dept. Physical Chemistry
 University of Almeria
 Spain


 --
 Start uncovering the many advantages of virtual appliances
 and start using them to simplify application deployment and
 accelerate your shift to cloud computing.
 http://p.sf.net/sfu/novell-sfdev2dev
 ___
 PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
 Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
 Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net




-- 
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC

(e) jason.vertr...@schrodinger.com
(o) +1 (603) 374-7120

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] How to measure the angle between two aromatic rings?

2010-09-23 Thread Thomas Holder
On Thu, 2010-09-23 at 09:54 -0400, Jason Vertrees wrote:
 Hi Ramiro,
 
 Another option is to fit (in a least-squares sense) a plane to each of
 your rings and then calculate the angle between the fitted planes'
 normals.

that's what the recently posted ring_angle.py script does.

Cheers,
  Thomas


--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] Access viewport size

2010-09-23 Thread Robert Campbell
Hi,

On Wed, 22 Sep 2010 23:29:14 -0400 Jason Vertrees
jason.vertr...@schrodinger.com wrote:

 Hi Mark,
 
 We used to be able to call this to get the viewport size.  But,
 somewhere along the line Warren removed this.  I'll see if I can add
 it back in, or find out why he removed it.

As mentioned in this email:

http://www.mail-archive.com/pymol-users@lists.sourceforge.net/msg05888.html

this works for me:

width,height = cmd.get_session()['main'][0:2]

I note that a more recent e-mail:
http://www.mail-archive.com/pymol-users@lists.sourceforge.net/msg07563.html

suggests that it doesn't work.  In the latter case, printing
cmd.get_session().keys() showed the absence of the 'main' key.  I couldn't
say why it was absent then and present now (I build PyMOL for Linux from the
SVN sources).

Cheers,
Rob


-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821Fax: 613-533-2497
robert.campb...@queensu.cahttp://pldserver1.biochem.queensu.ca/~rlc

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] Deleting and Loading multiple SDF files

2010-09-23 Thread Michael Lerner
Hi Renuka,

Please keep all PyMOL-related correspondence on the mailing list. That way,
other people can find the answers by reading the mailing list or searching
the web.

Your task is now getting a little more complicated. I think you'll probably
want to define some Python functions and use them. It's useful to know that
using the distance command with mode=2 will show polar contacts. Also,
distance objects with names starting with an underscore won't show up in the
GUI.


I'd do something like this:

1. Define some functions in a Python file that you can use via run (or
perhaps in your .pymolrc). [see
http://www.pymolwiki.org/index.php/Python_Integration and
http://www.pymolwiki.org/index.php/Script_Tutorial]. You'll need to pass the
name of your protein to these functions.

import os
from pymol import cmd

def loadclust(filename,protname):
cmd.load(filename)
dir,fname = os.path.split(filename)
# PyMOL automatically names the object by the filename
fname,extension = os.path.splitext(fname)
# cluster_4 -- 4
custernum = fname.split('_')[1]
# hidden from GUI display because it starts with _
polarname = '_polar_'+clusternum
cmd.dist(polarname,fname,protname,mode=2)
cmd.extend('loadclust',loadclust)
def delclust(filename):
dir,fname = os.path.split(filename)
# PyMOL automatically names the object by the filename
fname,extension = os.path.splitext(fname)
# cluster_4 -- 4
custernum = fname.split('_')[1]
# hidden from GUI display because it starts with _
polarname = '_polar_'+clusternum
cmd.delete(fname)
cmd.delete(polarname)
cmd.extend('delclust',delclust)

2. Then you should be able to use a similar procedure to
before. Remember that you now need to delete things and pass the name of
your protein to the functions so that polar contacts can be displayed
correctly:

for i in glob.glob(Model_1/cluster_*.sdf): loadclust(i,myprotein)

analyze things

for i in glob.glob(Model_1/cluster_*.sdf): delclust(i,myprotein)

for i in glob.glob(Model_2/cluster_*.sdf): loadclust(i,myprotein)

Unfortunately, I don't have any SD files on hand, so I haven't tested these!
Some modification may be necessary. You should also check out the script
that Jason linked.

Cheers,

-Michael

On Wed, Sep 22, 2010 at 11:52 AM, Renuka Robert renukarob...@ymail.comwrote:

 Dear Michael
 Thanks for your detailed reply. This is what exactly i needed. Now i want
 to find the hydrogen bonding between each cluster files and the protein. So
 i do the following step

 cd /home/user

 import glob


  then I load the Model_1 files with


  for i in glob.glob(Model_1/cluster_*.sdf): cmd.load(i)


  Now hydrogen bond should be displayed between protein and
 Model_1/cluster_*.sdf. Polar contacts in different colors would be more
 appreciated.


  Could you please attach your script in the above command, so that all the
 cluster_*.sdf is loaded and its polar contacts is displayed in one press.


  Thanks in advance

 Renuka.


 --- On *Wed, 22/9/10, Michael Lerner 
 mglerner+sourcefo...@gmail.commglerner%2bsourcefo...@gmail.com
 * wrote:


 From: Michael Lerner 
 mglerner+sourcefo...@gmail.commglerner%2bsourcefo...@gmail.com
 
 Subject: Re: [PyMOL] Deleting and Loading multiple SDF files
 To: Renuka Robert renukarob...@ymail.com
 Cc: PyMOL-users@lists.sourceforge.net
 Date: Wednesday, 22 September, 2010, 1:46 PM


 Hi Renuka,

 If I understand correctly, this is what you want to do:

 1. Load up all of the cluster*.sdf files in Model_1.
 2. Analyze them
 3. Delete them
 4. Load up all of the cluster*.sdf files in Model_2.
 5. Analyze them
 6. Delete them
 etc.

 If that's right, I think the easiest thing is just to change to the
 directory that contains your Model_N subdirectories. In your example, that
 would be:

 cd /home/user
 import glob

 then load the Model_1 files with

 for i in glob.glob(Model_1/cluster_*.sdf): cmd.load(i)

 then analyze them. It sounds like you're analyzing them by hand; if you're
 analyzing them by running some scripts, we can probably help to automate
 that process as well.

 After analyzing them, (and saving your results!), you'll want to delete the
 current batch of cluster files and load the new ones:

 delete cluster_*
 for i in glob.glob(Model_2/cluster_*.sdf): cmd.load(i)

 Note that you only have to type import glob once.

 Hope that helps,

 -Michael

 On Wed, Sep 22, 2010 at 9:12 AM, Renuka Robert 
 renukarob...@ymail.comhttp://mc/compose?to=renukarob...@ymail.com
  wrote:

  Dear Pymol users


  I have to do TWO jobs simultaneously in PYMOL.


  JOB 1: Load multiple *sdf files


  I have set of ligand files in *.sdf format as follows:


  /home/user/Model_1/cluster_1.sdf

 /home/user/Model_1/cluster_2.sdf

 /home/user/Model_1/cluster_3.sdf


  /home/user/Model_2/cluster_1.sdf

 /home/user/Model_2/cluster_2.sdf

 /home/user/Model_2/cluster_3.sdf


  /home/user/Model_3/cluster_1.sdf

 /home/user/Model_3/cluster_2.sdf