Re: [PyMOL] pymol licensing questions

2006-11-09 Thread Ezequiel Panepucci

It is *not* the GPL. It is the Python license

http://sourceforge.net/projects/pymol/
see also: http://www.python.org/doc/Copyright.html

I hit the send too quickly, anyways there is a fundamental difference
in that derivative works of pymol AFAIK can be made proprietary,
not that this would be an advantadge since the current pymol
development is so dynamic.

Cheers,
 Zac



[PyMOL] ANNOUNCE: apropos command to lookup commands matching a keyword.

2006-07-20 Thread Ezequiel Panepucci

Hi there,

I have written a little utility called apropos[1] (after a unix command of the
same name) to help in locating commands that might do something
you want done. It is like the grepset[2] command except this one looks
up commands instead of settings.

[1] http://www.pymolwiki.org/index.php/Apropos
[2] http://www.pymolwiki.org/index.php/Grepset

Comments are welcome.
  Have fun,
Zac
#
# apropos.py 
# Author: Ezequiel Panepucci
# Date: 2006-07-20
#
from pymol import cmd
import re

def apropos(regexp=''):
'''
DESCRIPTION
apropos searches through the documentation of all currently 
defined commands and lists those commands for which the keyword
is either contained in the documentation or matches the command
name itself.

If an appropriate DESCRIPTION section is provided in the documentation
of the command, the first 80 characters are listed as a summary.

USAGE
apropos [keyword or regexp]

EXAMPLE
apropos fit

###EXACT MATCH FOR: fit == try 'help fit' at the prompt.

###The following commands are NOT documented.

  vdw_fit

###The following commands are documented.  'help command' 

  fit : fit superimposes the model in the first selection on to the model
intra_fit : intra_fit fits all states of an object to an atom selection
  rms : rms computes a RMS fit between two atom selections, but does not
 pair_fit : pair_fit fits a set of atom pairs between two models.  Each atom
intra_rms_cur : intra_rms_cur calculates rms values for all states of an object
 commands :  Ooopsie, no DESCRIPTION found for this command!!! 
 zoom : zoom scales and translates the window and the origin to cover the
intra_rms : intra_rms calculates rms fit values for all states of an object
align : align performs a sequence alignment followed by a structural
  rms_cur : rms_cur computes the RMS difference between two atom
  fitting : fitting allows the superpositioning of object1 onto object2 using

SEE ALSO
grepset(www.pymolwiki.org), Python re module
'''
cmd.set(text,1,quiet=1)

count=0
docre = re.compile(regexp, re.MULTILINE | re.IGNORECASE)
cmdre = re.compile(regexp, re.IGNORECASE)

matches_with_help = []
matches_without_help = []

maxcclen=0
for cc in cmd.keyword:
if cc == regexp:
print '\n###EXACT MATCH FOR: %s == try \'help %s\' at the prompt.' % (cc,cc)

doc = cmd.keyword[cc][0].__doc__

if doc == None:
if re.search(regexp, cc, re.IGNORECASE):
count += 1
matches_without_help.append(cc)
continue

if re.search(regexp, doc, re.MULTILINE | re.IGNORECASE):
count += 1
if len(cc)  maxcclen:
maxcclen = len(cc)

docmatches = re.match(r^\s+DESCRIPTION\s+(.{0,80})\S*, doc, re.IGNORECASE)
if docmatches == None:
desc = ' Ooopsie, no DESCRIPTION found for this command!!! '
else:
desc = docmatches.groups()[0]
matches_with_help.append( (cc, desc ) )


if len(matches_without_help)  0:
fmt = '%' + str(maxcclen) + 's' # get the width of the lenghtiest command in a format
print '\n###The following commands are NOT documented.\n'
for cc in matches_without_help:
print fmt % (cc)

if len(matches_with_help)  0:
fmt = '%' + str(maxcclen) + 's : %s' # get the width of the lenghtiest command in a format
print '\n###The following commands are documented.  \'help command\' \n'
for (cc,desc) in matches_with_help:
print fmt % (cc,desc)

cmd.extend('apropos',apropos)



[PyMOL] ANNOUNCE: apropos command to lookup commands matching a keyword.

2006-07-20 Thread Ezequiel Panepucci

Hi there,

I have written a little utility called apropos[1] (after a unix command of the
same name) to help in locating commands that might do something
you want done. It is like the grepset[2] command except this one looks
up commands instead of settings.

[1] http://www.pymolwiki.org/index.php/Apropos
[2] http://www.pymolwiki.org/index.php/Grepset

Comments are welcome.
  Have fun,
Zac
#
# apropos.py 
# Author: Ezequiel Panepucci
# Date: 2006-07-20
#
from pymol import cmd
import re

def apropos(regexp=''):
'''
DESCRIPTION
apropos searches through the documentation of all currently 
defined commands and lists those commands for which the keyword
is either contained in the documentation or matches the command
name itself.

If an appropriate DESCRIPTION section is provided in the documentation
of the command, the first 80 characters are listed as a summary.

USAGE
apropos [keyword or regexp]

EXAMPLE
apropos fit

###EXACT MATCH FOR: fit == try 'help fit' at the prompt.

###The following commands are NOT documented.

  vdw_fit

###The following commands are documented.  'help command' 

  fit : fit superimposes the model in the first selection on to the model
intra_fit : intra_fit fits all states of an object to an atom selection
  rms : rms computes a RMS fit between two atom selections, but does not
 pair_fit : pair_fit fits a set of atom pairs between two models.  Each atom
intra_rms_cur : intra_rms_cur calculates rms values for all states of an object
 commands :  Ooopsie, no DESCRIPTION found for this command!!! 
 zoom : zoom scales and translates the window and the origin to cover the
intra_rms : intra_rms calculates rms fit values for all states of an object
align : align performs a sequence alignment followed by a structural
  rms_cur : rms_cur computes the RMS difference between two atom
  fitting : fitting allows the superpositioning of object1 onto object2 using

SEE ALSO
grepset(www.pymolwiki.org), Python re module
'''
cmd.set(text,1,quiet=1)

count=0
docre = re.compile(regexp, re.MULTILINE | re.IGNORECASE)
cmdre = re.compile(regexp, re.IGNORECASE)

matches_with_help = []
matches_without_help = []

maxcclen=0
for cc in cmd.keyword:
if cc == regexp:
print '\n###EXACT MATCH FOR: %s == try \'help %s\' at the prompt.' % (cc,cc)

doc = cmd.keyword[cc][0].__doc__

if doc == None:
if re.search(regexp, cc, re.IGNORECASE):
count += 1
matches_without_help.append(cc)
continue

if re.search(regexp, doc, re.MULTILINE | re.IGNORECASE):
count += 1
if len(cc)  maxcclen:
maxcclen = len(cc)

docmatches = re.match(r^\s+DESCRIPTION\s+(.{0,80})\S*, doc, re.IGNORECASE)
if docmatches == None:
desc = ' Ooopsie, no DESCRIPTION found for this command!!! '
else:
desc = docmatches.groups()[0]
matches_with_help.append( (cc, desc ) )


if len(matches_without_help)  0:
fmt = '%' + str(maxcclen) + 's' # get the width of the lenghtiest command in a format
print '\n###The following commands are NOT documented.\n'
for cc in matches_without_help:
print fmt % (cc)

if len(matches_with_help)  0:
fmt = '%' + str(maxcclen) + 's : %s' # get the width of the lenghtiest command in a format
print '\n###The following commands are documented.  \'help command\' \n'
for (cc,desc) in matches_with_help:
print fmt % (cc,desc)

cmd.extend('apropos',apropos)



[PyMOL] Question: general purpose get_prompt function

2004-11-04 Thread Ezequiel Panepucci
Hello People,

Anyone would know how to go about generating text messages
on the viewer window like the ones you get when using the
Wizard's get_prompt method, without having to resort to a 
wizard?

reason: I have a little script to deal with a trackball and
I use the buttons and scrollwheel to change the device's
actions. I would like to put a brief message letting me know
things I think I should know when I press buttons or scroll the
wheel.

Thanks much,
 Zac




Re: [PyMOL] Powermate dial with Pymol on OS X

2004-05-07 Thread Ezequiel Panepucci
Nat, 

The short answer to your question is yes. I have developed
a small python driver and an extension to pymol that allows
you to use any USB input device as a 3D controller.

It works with any USB device that generates events on 
/dev/input/event*

I have also a torsion function that you can use to change
dihedrals interactively on any amino acid using your altrnate 3D
input device.

In my opinion the best input device for this is a trackball
with many buttons (Kensington Expert Mouse Pro Trackball).
This model has a scroll wheel that you can configure to change
rotamers of the currently Pk1 selection if you scroll it while
keeping the scroll wheel pressed.

Check my webpage for details:
http://atb.slac.stanford.edu/~zac/pymol/

Cheers,
Zac

On Thu, 6 May 2004, Nat Echols wrote:

| 
| I'm very curious about this dial all of a sudden - I just started doing
| refinements, and I'd love to use my laptop as much as possible instead of
| our slow old SGIs.  Has anyone used it on Linux?  How's it work with O?
| Could it theoretically be programmed to, say, flip through rotamer
| libraries or tweak torsion angles in PyMOL, with some additions to the
| Python layer?  $40 isn't a lot of it's a decent partial replacement for
| SGI dial boxes.
| 
| thanks,
| Nat
| 
| 
| 
| ---
| This SF.Net email is sponsored by Sleepycat Software
| Learn developer strategies Cisco, Motorola, Ericsson  Lucent use to deliver
| higher performing products faster, at low TCO.
| http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
| ___
| PyMOL-users mailing list
| PyMOL-users@lists.sourceforge.net
| https://lists.sourceforge.net/lists/listinfo/pymol-users
| 

 Ezequiel Panepucci, Ph.D. - Laboratory of Prof. Axel Brunger
 HHMI - Stanford University
 Phone: 650-736-1714 Cell:  650-714-9414




[PyMOL] nvidia quadro 700xgl opengl error

2004-05-06 Thread Ezequiel Panepucci
Hello There,

I think this message is mostly for Warren and an FYI for
nvidia users. There is a question at the end though.

Scenario: 
Graphics card = Nvidia Quadro 700 XGL
NVIDIA Driver = Either 53.36 or the previous one.
PyMOL = 0.95

Error message:
OpenGL-Error: Where? During Rendering: invalid operation

All other nvidia cards work well without errors which makes me
believe there is something funny with this specific card model
(we have 2 of these cards giving the error).

I noticed that up to 0.93 you didn't have the glGetError on the C code
so maybe it could be something happening prior to 0.95.

PyMOL seems to run fine but it keeps spitting the error messages
constantly. I tried disabling feedback of opengl errors with

feedback disable,opengl,everything

but it didn't work

feedback disable,all,everything

works but some feed back is always nice. Is there a good combination
of the feedback args that will only disable the opengl messages?

Many thanks,
  Zac
--
 Ezequiel Panepucci, Ph.D. - Laboratory of Prof. Axel Brunger
 HHMI - Stanford University
 Phone: 650-736-1714 Cell:  650-714-9414




Re: [PyMOL] graphics boards

2004-04-20 Thread Ezequiel Panepucci
Mark,

You can get an Nvidia Quadro4 380 XGL which has a stereo connector.

Nvidia keeps their drivers on almost the same (if not the same)  
release schedule as their MS Windows drivers, they are very stable and 
easy to install and maintain.

Zac

| I know this has been discussed before on this list.  I need a graphics 
| board for a Linux RH 9.0 running on Dell Optiplex GX270.  The 
| applications will be O and Pymol and similar programs.  Stereo-capable 
| would be preferred.  I've been told that NVidia is more compatible with 
| Linux.  Of the myriad of models available, could anyone help narrow the 
| choices for me?  Price range $150.




Re: [PyMOL] adding residues

2004-03-26 Thread Ezequiel Panepucci
Oi Sergio,

You should pick (PkAt) either the atom N or C
depending towards which end you want to extend
the chain:

   N  == to extend the N-terminus
   C  == to extend the C-terminus

and then select the residue you want to add
from the Build-Residue menu.


Um abraco,
Zac

On Fri, 26 Mar 2004, Sergio Modesto Vechi wrote:

| Hi all,
| 
| 
| I load my protein pdb file and I'm trying to add the missing residues to
| this molecule. Anyone knows how to do it?
| 
| Thanks in advance,
| 
| 
| Sergio.
| 
| 
| 
| ---
| This SF.Net email is sponsored by: IBM Linux Tutorials
| Free Linux tutorial presented by Daniel Robbins, President and CEO of
| GenToo technologies. Learn everything from fundamentals to system
| administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click
| ___
| PyMOL-users mailing list
| PyMOL-users@lists.sourceforge.net
| https://lists.sourceforge.net/lists/listinfo/pymol-users
| 

 Ezequiel Panepucci, Ph.D. - Laboratory of Prof. Axel Brunger
 HHMI - Stanford University
 Phone: 650-736-1714 Cell:  650-714-9414




[PyMOL] grep settings

2004-03-08 Thread Ezequiel Panepucci
Hi There,

Below is a little function (also attached) that gives
you the command 'grepset' so you can grep settings
using a regexp.

Use it like this:
### example  ###
PyMOLgrepset dot|line
auto_show_lineson
cgo_dot_radius -1.0
cgo_dot_width  2.0
cgo_line_radius-0.05000
cgo_line_width 1.0
dot_color  default
dot_density2
dot_hydrogens  on
dot_mode   0
dot_radius 0.0
dot_solvent0
dot_width  2.0
line_radius0.0
line_smoothon
line_width 2.0
roving_lines   10.0
sculpt_line_weight 1.0
trim_dots  on
18 settings matched
 
 end example  ###

To install:

Just put the code below in a file and 'run file'
from within pymol to get the command activated.

Cheers,
Zac

 code below 
from pymol import cmd
import pymol.setting

def grepset(regexp=''):
   '''
DESCRIPTION
   grepset greps through the list of settings using a python
   regular expression as defined in the 're' module.
   It returns a list of settings/values matching the regexp.
   No regexp returns every setting.

USAGE
   grepset [regexp]

EXAMPLE
   grepset line
   grepset ray

SEE ALSO
   Python re module
   '''

   from re import compile

   count=0
   regexp=compile(regexp)
   for a in pymol.setting.get_index_list():
  setting=pymol.setting._get_name(a)
  if regexp.search(setting):
 count = count + 1
 print '%-30s %s' % (setting, cmd.get_setting_text(a,'',-1))

   print '%d settings matched' % count
cmd.extend('grepset',grepset)
from pymol import cmd
import pymol.setting

def grepset(regexp=''):
   '''
DESCRIPTION
   grepset greps through the list of settings using a python
   regular expression as defined in the 're' module.
   It returns a list of settings/values matching the regexp.
   No regexp returns every setting.

USAGE
   grepset [regexp]

EXAMPLE
   grepset line
   grepset ray

SEE ALSO
   Python re module
   '''

   from re import compile

   count=0
   regexp=compile(regexp)
   for a in pymol.setting.get_index_list():
  setting=pymol.setting._get_name(a)
  if regexp.search(setting):
 count = count + 1
 print '%-30s %s' % (setting, cmd.get_setting_text(a,'',-1))

   print '%d settings matched' % count
cmd.extend('grepset',grepset)


[PyMOL] powermate in linux

2004-02-17 Thread Ezequiel Panepucci
Hello There,

I've written a very little piece of python code that uses 
William R Sowerbutts's rudimentary (his own words) python
interface to the powermate device.

BE WARNED!! This hack will crash your pymol session when you type
quit to terminate your pymol session. this wouldn't be a problem if
it didn't leave python threads floating around...Anyone knows a workaround?

The safest way to quit is to CTRL-C the prompt that started pymol.

This a first announcement. /dev/input/event* is indeed the future...

Cheers,
Zac
HOWTO:
1) put the python interface (powermate.py) in ${PYMOL_PATH}/modules
   http://www.sowerbutts.com/powermate/powermate.py

2) put the code below in your $HOME/.pymolrc.py

3) tweak the line that says CONFIGURE to match your setup

#
# code below starts here
#
def powermate_reader(): # thread for reading powermate dial
import sys
from pymol import cmd
from powermate import PowerMate
dial_down = 0
pm1 = PowerMate('/dev/input/event1') #CONFIGURE
while 1:
event = pm1.WaitForEvent(1)
if event == None:
continue
sec,usec,type,code,value = event
if code == 256:
dial_down = not dial_down
continue
if dial_down:
cmd.turn('x',value)
else:
cmd.turn('y',value)

pm = threading.Thread(target=powermate_reader)
print 'PowerMate'
pm.setDaemon(1)
pm.start()







Re: [PyMOL] Need advice on graphic card

2003-11-11 Thread Ezequiel Panepucci
 What does merged mode mean?

i'm curious about this mode too.


 As far as I know, nVidia claims, that their driver can do that though 
 (but I haven't tested it, due to lack of a second screen and a dual-head 
 graphics-card.

it is true. I've tried it on a Quadro 700XGL under RH9 and it is
really nice, and you can have a vmware windows session running on one
of the displays (in quick switch) and Linux on the other with all of
the 3D accel available.

Cheers,
Zac





Re: [PyMOL] Get rid of border around my images !!

2003-09-12 Thread Ezequiel Panepucci
antialiasing does different things to the rendering than
doubling the image size can fix/make better.

I would keep antialiasing and go through the added work
of cropping the image.


   This is a known bug when using antialiasing. You can either remove the 
 border in Photoshop or equivalent editing program or render your image 
 2X larger and turn off antialiasing.





Re: [PyMOL] redhat 9.0/pymol - missing something

2003-08-12 Thread Ezequiel Panepucci
JP,

You must install the rpm package tix as well.

Zac


On Tue, 12 Aug 2003, JP Cartailler wrote:

 greetings,
 
 I just finished building a new redhat 9.0 box and i am having some
 troubles getting the pymol rpm to run correctly.  The RPM installs without
 issues, but when I run pymol, I get:
 
 OpenGL based graphics front end:
   GL_VENDOR: NVIDIA Corporation
   GL_RENDERER: Quadro4 750 XGL/AGP/SSE/3DNOW!
   GL_VERSION: 1.4.0 NVIDIA 44.96
 Traceback (most recent call last):
   File modules/pymol/__init__.py, line 177, in exec_str
 exec s in globals(),globals()
   File string, line 1, in ?
   File modules/pymol/__init__.py, line 292, in launch_gui
 __import__(invocation.options.gui)
   File modules/pmg_tk/__init__.py, line 22, in ?
 # as /usr/lib/python2.1/site-packages
   File modules/pmg_tk/PMGApp.py, line 15, in ?
 ImportError: No module named Tkinter
  Adapting to Quadro hardware...
   Detected 2 CPUs.  Enabled multithreaded rendering.
  
 
 the display window does come up, but not the floating menu bar.
 
 so I hit Google and found something about needing tkinter.  I found a
 redhat 9.0 rpm (tkinter-2.2.2-26.i386.rpm) for that, but trying doing a
 test install of it yielded:
 
 rpm -ivh --test tkinter-2.2.1-17.i386.rpm
 error: Failed dependencies:
 libtix8.1.8.3.so is needed by tkinter-2.2.2-26
 
 What is libtix? and where can I nab it for readhat 9.0 or just the source?
 
 Cheers,
 
 JP Cartailler
 
 3205 McGaugh Hall
 Dept. of Molecular Biology  Biochemistry
 Irvine Research Unit in Macromolecular Structure
 UC Irvine
 Irvine, CA 92697-3900
 USA
 
 (949) 824 4322 (T)
 j...@bragg.bio.uci.edu (email)
 www.cartailler.com (www)
 
 
 
 
 ---
 This SF.Net email sponsored by: Free pre-built ASP.NET sites including
 Data Reports, E-commerce, Portals, and Forums are available now.
 Download today and enter to win an XBOX or Visual Studio .NET.
 http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01
 ___
 PyMOL-users mailing list
 PyMOL-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/pymol-users
 

 Ezequiel Panepucci, Ph.D. - Laboratory of Prof. Axel Brunger
 HHMI - Stanford University
 Phone: 650-736-1714 Cell:  650-714-9414




Re: [PyMOL] Loss of resolution when printing or converting to PDF

2003-03-07 Thread Ezequiel Panepucci
Fred,

Make sure you create images which are big enough for the size of the
print you want to make, e.g. images 3000x3000 print really well on an
area of about 5in x 5in (600 dpi printing resolution).

Also, you should use some application in which you can properly resize
the image to print the apropriate size on paper. I've used adobe
photoshop and it does a terrific job.

Cheers,
 Zac

On Fri, 7 Mar 2003, Fred Berkovitch wrote:

 Hello all,
 
 I have made some really nice .png images with pymol, but when I print them 
 out they lose quite a bit of resolution.  Likewise, when I convert them to 
 PDF with Acrobat, the resulting .pdf file looks much worse (on my LCD 
 screen) than the original .png.  Is there a way around this problem?  Could 
 it be the colors that I'm using in Pymol that's causing this trouble?
 
 -Fred




Re: [PyMOL] Loss of resolution when printing or converting to PDF

2003-03-07 Thread Ezequiel Panepucci
when I said big I meant using the pymol command ray with arguments
specifying the width and heigth:

 ray 3000,3000

this works on all platforms/OSes

zac

 Are we talking Windows here?  What would be a good way to enhance this
 resolution within linux?  How does one make a big png?  Is it a
 command-line option, or you just make the window the size of the screen?
 
 
 Make sure you create images which are big enough for the size of the
 print you want to make, e.g. images 3000x3000 print really well on an
 area of about 5in x 5in (600 dpi printing resolution).
 
 Also, you should use some application in which you can properly resize
 the image to print the apropriate size on paper. I've used adobe
 photoshop and it does a terrific job.
 




[PyMOL] lines same color as background

2002-05-30 Thread Ezequiel Panepucci
Hello There,

I have this geforce4 ti 4400 with the latest nvidia
drivers and xfree86 4.2

Problem: The lines are always colored the same color as the
background. If I change the background to white the lines become
white.

all other representaions (sticks, spheres surface) work
fine. So as a workaround I am using stick_radius really small
but this is not the same, lines are way better for interactive work.

Weird thing is, the same happens under Win2k (dual boot machine
here so exactly the same hardware).

More weirdness: also happens with Ono under both OSes.

My feeling is that this has to do with the z-buffer/fog
thingy. I did run a program drawing (GL_LINES) with GL_DEPTH_TEST
enabled and that worked fine.

any clues?
Zac

--
 Ezequiel Panepucci - Laboratory of Prof. Axel Brunger
 HHMI - Stanford University
 Phone: 650-926-5127
 Cell:  650-714-9414




RE: [PyMOL] lines same color as background

2002-05-30 Thread Ezequiel Panepucci
Results:

on geforce4 ti 4400 from PNY
WORKS:
line_smooth=0
depth_cue=1   

line_smooth=1
depth_cue=0

line_smooth=0
depth_cue=0

WORKS NOT
line_smooth=1
depth_cue=1
 


On Thu, 30 May 2002, DeLano, Warren wrote:

 Zac,
 
Thanks for the report.
 
The fact that it happens with Ono too indicates that it is a
 driver/openGL-level bug.  You can try some things like disabling
 depth cuing (set depth_cue=0) or smoothing (set line_smooth=0), but
 most likely you will need to wait for a driver upgrade.  Please do
 report the problem to nVidia tech support and clearly state that the
 problem occurs across multiple OpenGL programs.
 
   Also, you might try using an older version of the driver.  AFAICR, nVidia 
 uses a unified driver architecture which is both backwards and forwards 
 compatible.  If you do find a robust solution, please pass it along!
 
 Cheers,
 Warren
 
 --
 mailto:war...@sunesis.com
 Warren L. DeLano, Ph.D.
 
 
 
  -Original Message-
  From: Ezequiel Panepucci [mailto:z...@slac.stanford.edu]
  Sent: Thursday, May 30, 2002 1:39 PM
  To: PyMOL-users@lists.sourceforge.net
  Subject: [PyMOL] lines same color as background
  
  
  Hello There,
  
  I have this geforce4 ti 4400 with the latest nvidia
  drivers and xfree86 4.2
  
  Problem: The lines are always colored the same color as the
  background. If I change the background to white the lines become
  white.
  
  all other representaions (sticks, spheres surface) work
  fine. So as a workaround I am using stick_radius really small
  but this is not the same, lines are way better for interactive work.
  
  Weird thing is, the same happens under Win2k (dual boot machine
  here so exactly the same hardware).
  
  More weirdness: also happens with Ono under both OSes.
  
  My feeling is that this has to do with the z-buffer/fog
  thingy. I did run a program drawing (GL_LINES) with GL_DEPTH_TEST
  enabled and that worked fine.
  
  any clues?
  Zac
  
  --
   Ezequiel Panepucci - Laboratory of Prof. Axel Brunger
   HHMI - Stanford University
   Phone: 650-926-5127
   Cell:  650-714-9414
  
  
  ___
  
  Don't miss the 2002 Sprint PCS Application Developer's Conference
  August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
  
  ___
  PyMOL-users mailing list
  PyMOL-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/pymol-users
  
 

--
 Ezequiel Panepucci - Laboratory of Prof. Axel Brunger
 HHMI - Stanford University
 Phone: 650-926-5127
 Cell:  650-714-9414




[PyMOL] label wizard

2001-11-14 Thread Ezequiel Panepucci
Hello people,

This is a labeling wizard. It allows you to click
atoms and have a label show up near the atom position.

If the atom is a C-alpha the label is slighly
different. More info is shown in the prompt area.

To use it, put the attached file in
/pymol/modules/pymol/wizard/label.py

and from within pymol type wizard label

Comments?

Have fun,
Zac


 file: label.py

#
# Author: Ezequiel Panepucci
# Last revision: 2001-11-14
#
from pymol.wizard import Wizard
from pymol import cmd
import pymol

class Label(Wizard):

   atom=None
   messages=1
   labeling=1
   obj_name=None

   def get_prompt(self):
  self.prompt = []
  if (not self.messages):
 return ['']

  if (self.atom == None):
 self.prompt = ['Click atoms...']
  else:
 if self.atom.chain == '':
self.prompt.append( '%s %s %s %s B = %.2f  XYZ = %.3f %.3f %.3f' %
(self.obj_name,
 self.atom.resn,
 self.atom.resi,
 self.atom.name,
 self.atom.b,
 self.atom.coord[0],
 self.atom.coord[1],
 self.atom.coord[2]) )
 else:
self.prompt.append('%s %s %s%s %s B = %.2f  XYZ = %.3f %.3f %.3f' %
(self.obj_name,
 self.atom.resn,
 self.atom.chain,
 self.atom.resi,
 self.atom.name,
 self.atom.b,
 self.atom.coord[0],
 self.atom.coord[1],
 self.atom.coord[2]) )

  return self.prompt

   def toggle_messages(self):
  self.messages = not self.messages

   def toggle_labeling(self):
  self.labeling = not self.labeling

   def get_panel(self):
  return [
 [ 1, 'Labeling',''],
 [ 2, 'Toggle add/erase','cmd.get_wizard().toggle_labeling()'],
 [ 2, 'Toggle messages','cmd.get_wizard().toggle_messages()'],
 [ 2, 'Clear All','cmd.label()'],
 [ 2, 'Done','cmd.set_wizard()'],
 ]

   def do_pick(self,bondFlag):
  self.obj_name = None

#  if 'pk1' in cmd.get_names('selections'):
  if cmd.count_atoms('pk1',1):
 self.obj_name = cmd.identify('pk1',1)[0][0]

  model = cmd.get_model((pk1))
  self.atom = model.atom.pop()
  if not self.labeling:
 cmd.label((pk1), '')
  elif self.atom.name == 'CA':
 cmd.label((pk1), ' %s %s % (resn,resi)')
  else:
 cmd.label((pk1), ' %s %s % (name,resi)')
  cmd.unpick()
  cmd.refresh_wizard()