Re: [PyMOL] Custom menus and shortcuts?

2012-10-24 Thread Thomas Holder
Hi Boris,

Boris Kheyfets wrote, On 10/23/12 19:28:
[...]
 But I want bk_hides_W to be a toggler. So I need a way to set a state of
 my defun.
 If I do

 def bk_toggles_W ():
 Hides W molecules.
  if cmd.get(bk_toggles_W):
  cmd.hide(all)
  cmd.show(spheres, not (resn W))
  cmd.set(bk_toggles_W, 0)
  else:
  cmd.show(spheres, resn W)
  cmd.set(bk_toggles_W, 1)

 pymol is upset -- I think it is because it doesn't know bk_toggles_W
 setting:

If you need a global variable, use pymol.stored:

from pymol import stored
stored.bk_toggles_W = 0
def bk_toggles_W ():
  Hides W molecules.
  if stored.bk_toggles_W:
  cmd.hide(all)
  cmd.show(spheres, not (resn W))
  stored.bk_toggles_W = 0
  else:
  cmd.show(spheres, resn W)
  stored.bk_toggles_W = 1

Cheers,
   Thomas

-- 
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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 rotate entire section of structure relative to rest

2012-10-24 Thread Thomas Holder
Hi Alex,

sculpting is not the right tool for your task. PyMOL has all the basic 
editing features like rotating around a bond etc. Enter Editing mode, 
pick a bond with the mouse and rotate around the bond by pressing CTRL 
and click-dragging a second atom.

You can enter Editing Mouse Mode by clicking on the lower-right panel.

Hope that helps.

Cheers,
   Thomas

On 22.10.2012 22:27, Alex Truong wrote:
 Hi All,

 I'm relatively new to this software, and even though I've been using it
 for a few months, I haven't really had to use some of the more advanced
 options yet. This would be my first foray into actual manipulation.

 That being said, I'm trying to figure out how to move a small section at
 the N-terminus of my protein while keeping the rest static. That is, I'd
 just like to be able to rotate one bond and fix the relative positions
 and structures of the entire rest of the protein. I did some googling,
 and there was something about a Sculpting feature, but when I tried it,
 sections lit up that I was not interested in, and I was basically moving
 tiny sections at a time without preserving the structures I wanted. Is
 there a way to just manipulate the angle so I can swing that section out
 and away from its current position? I'll deal with the positions of
 those individual residues if this cannot method cannot resolve my problem.

 Thanks,
 Alex

-- 
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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] Custom menus and shortcuts?

2012-10-24 Thread Boris Kheyfets
If you need a global variable, use pymol.stored


Thank You Thomas -- that solves it.

Boris.

On Tue, Oct 23, 2012 at 9:28 PM, Boris Kheyfets kheyfbo...@gmail.comwrote:

 Found a solution.

 Basically it is to add

 pmg_tk/startup/newmenu.py

 file with the following content:

 from Tkinter import *
 from pymol import cmd

 def __init__(self):
 self.menuBar.addmenu('NewMenu', 'Sample Menu')

 self.menuBar.addmenuitem('NewMenu', 'command',
  'White background',
  label='White Background',
 command = lambda : cmd.set(bg_rgb,[1,1,1]))

 self.menuBar.addmenuitem('NewMenu', 'command',
  'Black background',
  label='Black Background',
  command = lambda : cmd.set(bg_rgb,[0,0,0]))

 This adds the menu.

 I got what I wanted with:


- .pymolrc:

 # custom scripts:
 import imp
 imp.load_source('bk_pymols', os.path.expanduser('~/.pymolrc.py'))



- .pymolrc.py

 from pymol import cmd

 def bk_notW ():
 Makes notW selection.
 cmd.select(notW, not (resn W))

 def bk_hides_W ():
 Hides W molecules.
 cmd.hide(all)
 cmd.show(spheres, not (resn W))

 cmd.set_key('ALT-N', bk_notW)
 cmd.set_key('ALT-W', bk_hides_W)


- and finally -- pmg_tk/startup/BK.py:

 from Tkinter import *
 from pymol import cmd

 # custom scripts:
 import imp, os
 imp.load_source('bk_pymols', os.path.expanduser('~/.pymolrc.py'))
 from bk_pymols import bk_notW, bk_hides_W


 def __init__(self):
 self.menuBar.addmenu('BK', 'My menus!')

 self.menuBar.addmenuitem('BK', 'command',
  'Makes notW [Alt-n]',
  label='Makes notW [Alt-n]',
 command = bk_notW)

 self.menuBar.addmenuitem('BK', 'command',
  'Hides W mols [Alt-w]',
  label='Hides W mols [Alt-w]',
  command = bk_hides_W)

 Works like a charm: I have custom menus and I can bind any of its entries
 to a key.

 But I want bk_hides_W to be a toggler. So I need a way to set a state of
 my defun.
 If I do

 def bk_toggles_W ():
 Hides W molecules.
 if cmd.get(bk_toggles_W):
 cmd.hide(all)
 cmd.show(spheres, not (resn W))
 cmd.set(bk_toggles_W, 0)
 else:
 cmd.show(spheres, resn W)
 cmd.set(bk_toggles_W, 1)

 pymol is upset -- I think it is because it doesn't know bk_toggles_Wsetting:

 Error: 1
 QuietException Exception in Tk callback
   Function: function bk_toggles_W at 0x7ff02d90cb90 (type: type
 'function')
   Args: ()
 Traceback (innermost last):
   File /usr/lib/python2.7/dist-packages/Pmw/Pmw_1_3/lib/PmwBase.py, line
 1747, in __call__
 return apply(self.func, args)
   File /home/boris/.pymolrc.py, line 67, in bk_toggles_W
 if cmd.get(bk_toggles_W):
   File /home/boris/.local/lib/python2.7/site-packages/pymol/setting.py,
 line 1300, in get
 raise QuietException
 QuietException: pymol.parsing.QuietException instance at 0x7ff018698518

 How can I add the setting to pymol?

 --
 Boris.


 On Tue, Oct 23, 2012 at 5:17 PM, Jason Vertrees 
 jason.vertr...@schrodinger.com wrote:

 Hi Boris,

 David Hall's suggestions are perfect.

 Let me offer one more. If you can put up with programming a little
 Python, check out pymol/modules/pymol/menu.py and
 pymol/modules/pymol/preset.py. In menu.py you could add a No W menu
 option (or similar) to the A  Preset 

 Cheers,

 -- Jason

 On Tue, Oct 23, 2012 at 6:02 AM, Boris Kheyfets kheyfbo...@gmail.com
 wrote:
  Hello PyMOL users,
 
  Menus
  =
 
  Is there a way I can add custom menu in PyMOL?
 
  Ideally I'd like to be able to call both
 
  * pml scripts, as well as
  * full python pymol scrpts
 
  Shortcuts
  =
 
  Similarly -- is there a way I can bind exectution of given
 
  * pml script, or
  * full python pymol script
 
  to a given key?
 
  The problem
  ===
 
  The basic problem
  -
 
  The basic problem is to automate tasks one repeats frequenlty. For
 example I
  had to type::
 
select notW, not (resn W)
hide all
show spheres, notW
 
  frequently.
 
 
  The problem which leads to the need of menu
  ---
 
  So I make a pml or full-python pymol script and load it.
 
  But then I have to remember the name of the script. Which is terrible --
  because I have custom scripts in each and every program that I use.
 
 
  The problem which leads to the need of custom shortcuts
  ---
 
  Having custom menu us great as a reminder of what scripts have You
 written.
  But it's terrible to click through the menus. One is much better with
  shorcuts (hotkeys).
 
 
 
 
 
 --
  Everyone hates slow websites. So do we.
  Make your web apps faster with AppDynamics
  Download AppDynamics Lite for free today:

Re: [PyMOL] wire-mesh spheres?

2012-10-24 Thread Jason Vertrees
Hi Matt,

There's currently no easy way to do this. Can you please send us some
screenshots of what you'd like to see implemented?

Cheers,

-- Jason

On Tue, Oct 23, 2012 at 4:16 PM, Matthew Baumgartner mp...@pitt.edu wrote:
 Hi,
 Is it now possible to have wire mesh cgo object spheres in pymol?
 I found this thread from a while ago (2004) but googleing, I didn't
 find anything more recent.


 The one sort of work around that I though of was to create pseudo-atoms
 and somehow modify their radius and then show them as mesh.
 But I would like to use CGO objects if possible.

 Does anyone have any suggestions?

 Thanks,
 Matt Baumgartner



 Sphere transparency example included below...

 ALPHA must preceed COLOR to be effective.

 PyMOL does not yet do a global sort of tranparent triangles, so there will
 be artifacts in OpenGL.  Raytracing should look fine however.

 # from within a .py OR .pym file...

 from pymol.cgo import *
 from pymol import cmd

 obj = [

ALPHA,  1.0,
COLOR,  1.0, 1.0, 1.0,
SPHERE, 0.0, 0.0, 0.0, 0.5,

ALPHA,  0.66,
COLOR,  1.0, 0.0, 0.0,
SPHERE, 1.0, 0.0, 0.0, 0.5,

ALPHA,  0.33,
COLOR,  0.0, 1.0, 0.0,
SPHERE, 0.0, 1.0, 0.0, 0.5,

ALPHA,  0.11,
COLOR,  0.0, 0.0, 1.0,
SPHERE, 0.0, 0.0, 1.0, 0.5,
 ]

 cmd.load_cgo(obj,'cgo01')

 Cheers,war...@delanoscientific.com
 Warren

 --
 Warren L. DeLano, Ph.D.
 Principal Scientist

 . DeLano Scientific LLC
 . 400 Oyster Point Blvd., Suite 213
 . South San Francisco, CA 94080
 . Biz:(650)-872-0942  Tech:(650)-872-0834
 . Fax:(650)-872-0273  Cell:(650)-346-1154
 . mailto:war...@delsci.com


 -Original Message-
 From: pymol-users-ad...@lists.sourceforge.net
 [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of
 Michael George Lerner
 Sent: Wednesday, November 17, 2004 9:43 AM
 To: pymol-users@lists.sourceforge.net
 Subject: [PyMOL] wire-mesh spheres?


 Hi,

 I want to draw a bunch of spheres of various sizes and
 colors.  I'm currently using cgos for this.  No problem.
 Now, I also want to draw wire-mesh spheres.  Does anyone have
 a script for making these?  While I'm at it, is there a way
 to make cgos transparent?

 Thanks,

 -Michael

 --
 This isn't a democracy;|_  |Michael Lerner
   it's a cheer-ocracy.  | ASCII ribbon campaign ( ) |   Michigan
 -Torrence,  Bring It On|  - against HTML email  X  |  Biophysics
 |   / \ | mler...@umich


 ---
 This SF.Net email is sponsored by: InterSystems CACHE FREE
 OODBMS DOWNLOAD - A multidimensional database that combines
 robust object and relational technologies, making it a
 perfect match for Java, C++,COM, XML, ODBC and JDBC.
 www.intersystems.com/match8
 ___
 PyMOL-users mailing list
 PyMOL-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/pymol-users




 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_sfd2d_oct
 ___
 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
Schrödinger, Inc.

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

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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] wire-mesh spheres?

2012-10-24 Thread Matthew Baumgartner

Hi,
So some brief background, I am writing a pymol plugin for displaying 
pharmacophores queries from ZincPharmer ( 
http://zincpharmer.csb.pitt.edu/), which is developed in my lab. Version 
1 of my plugin is available here: 
http://sourceforge.net/projects/pharmer/files/ under the name load_query.


Sorry if that quickly turned into an advertisement, but what I would 
like to be able to reproduce in pymol is something like this: 
http://i.imgur.com/hiX2i.png . Where the wire mesh sphere's represent 
the pharamacophores. Currently, I am using the cgo sphere's but they do 
not do well when there are overlapping pharmacophores (a common case).




Thanks,
Matt

On 10/24/2012 03:06 PM, Jason Vertrees wrote:

Hi Matt,

There's currently no easy way to do this. Can you please send us some
screenshots of what you'd like to see implemented?

Cheers,

-- Jason

On Tue, Oct 23, 2012 at 4:16 PM, Matthew Baumgartner mp...@pitt.edu wrote:

Hi,
Is it now possible to have wire mesh cgo object spheres in pymol?
I found this thread from a while ago (2004) but googleing, I didn't
find anything more recent.


The one sort of work around that I though of was to create pseudo-atoms
and somehow modify their radius and then show them as mesh.
But I would like to use CGO objects if possible.

Does anyone have any suggestions?

Thanks,
Matt Baumgartner



Sphere transparency example included below...

ALPHA must preceed COLOR to be effective.

PyMOL does not yet do a global sort of tranparent triangles, so there will
be artifacts in OpenGL.  Raytracing should look fine however.

# from within a .py OR .pym file...

from pymol.cgo import *
from pymol import cmd

obj = [

ALPHA,  1.0,
COLOR,  1.0, 1.0, 1.0,
SPHERE, 0.0, 0.0, 0.0, 0.5,

ALPHA,  0.66,
COLOR,  1.0, 0.0, 0.0,
SPHERE, 1.0, 0.0, 0.0, 0.5,

ALPHA,  0.33,
COLOR,  0.0, 1.0, 0.0,
SPHERE, 0.0, 1.0, 0.0, 0.5,

ALPHA,  0.11,
COLOR,  0.0, 0.0, 1.0,
SPHERE, 0.0, 0.0, 1.0, 0.5,
]

cmd.load_cgo(obj,'cgo01')

Cheers,war...@delanoscientific.com
Warren

--
Warren L. DeLano, Ph.D.
Principal Scientist

. DeLano Scientific LLC
. 400 Oyster Point Blvd., Suite 213
. South San Francisco, CA 94080
. Biz:(650)-872-0942  Tech:(650)-872-0834
. Fax:(650)-872-0273  Cell:(650)-346-1154
. mailto:war...@delsci.com



-Original Message-
From: pymol-users-ad...@lists.sourceforge.net
[mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of
Michael George Lerner
Sent: Wednesday, November 17, 2004 9:43 AM
To: pymol-users@lists.sourceforge.net
Subject: [PyMOL] wire-mesh spheres?


Hi,

I want to draw a bunch of spheres of various sizes and
colors.  I'm currently using cgos for this.  No problem.
Now, I also want to draw wire-mesh spheres.  Does anyone have
a script for making these?  While I'm at it, is there a way
to make cgos transparent?

Thanks,

-Michael

--
This isn't a democracy;|_  |Michael Lerner
   it's a cheer-ocracy.  | ASCII ribbon campaign ( ) |   Michigan
-Torrence,  Bring It On|  - against HTML email  X  |  Biophysics
 |   / \ | mler...@umich


---
This SF.Net email is sponsored by: InterSystems CACHE FREE
OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a
perfect match for Java, C++,COM, XML, ODBC and JDBC.
www.intersystems.com/match8
___
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users




--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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





--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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