RE: [PyMOL] How to run PyMol from within Python?

2002-07-16 Thread DeLano, Warren
> So there is no way to run and control PyMol from within 
> another python program?

If PYMOL_PATH, LD_LIBRARY_PATH, and TCL_LIBRARY are correctly defined, then you 
can launch PyMOL from an external Python program as shown in 
examples/devel/start_pymol.py.  

However, this is not recommended because the PyMOL launch sequence is not 
fixed.  If you do use it, be prepared to deal with changes down the road. 

> The reason for asking is that we are working on a python platform to 
> run and evaluate protein-protein docking calculations. It would be a 
> nice feature to be able to call up interaction surfaces and 
> protein-protein clusters for display  in PyMol and then interact with 
> them from within our program.

> As things are now I'm forced to treat PyMol as I would treat any 
> molecular graphics program, that is write macros macros for it. This 
> is of course much less convenient and less flexible compared to 
> running PyMol from within our python code.

> Has anyone been able to run and quit PyMol from within python without 
> killing the interpreter? Is it possible? How?

The underlying source of the limitation here is that the GLUT and Tcl/Tk 
libraries which PyMOL uses do not support repeated set-up/take-down -- they are 
both static "global" systems which steal threads and never return.  Thus, while 
PyMOL is not inherently limited in this fashion, these building blocks which it 
employs are.  Eventually there will be versions of PyMOL which are both GLUT 
and TCL/Tk independent -- but not today.

Instead, I recommend using some kind of inter-process communication along with 
object serialization to pass data from your program into PyMOL.  Python makes 
this relatively easy, but you are looking at a little bit of development.

Sorry the news isn't better!

Warren









Re: [PyMOL] pymol without GL

2002-07-16 Thread Ezequiel H Panepucci

Nathaniel Echols wrote:


By the way, has anyone else experimented with hardware antialiasing on
NVidia cards under Linux?  I've had mixed results so far, and I'm not sure
what I'm doing wrong (this is with a GeForce 4 Ti 4600).


the nvidia driver (as far as 28.90) does not allow for simultaneous 
use of anti-aliasing and depth-cueing (fog) so you must choose either

one of those, not both from within pymol.

zac




Re: [PyMOL] pymol without GL

2002-07-16 Thread Nathaniel Echols
> pymol.com -c scriptname
> But you have to get your view first somehow.

I can't do this until I compile it; if I try running a pre-existing build
I get errors because one of the GL libraries isn't found.  I've ended up
just installing GL on my system, but the crack technical wizards at SuSE
have decided I need Qt and KDE as well. . . on web server. *sigh*  It's
not really important that I be able to do this, and there's plenty of disk
space to spare, but I prefer limited installs on a server.

By the way, has anyone else experimented with hardware antialiasing on
NVidia cards under Linux?  I've had mixed results so far, and I'm not sure
what I'm doing wrong (this is with a GeForce 4 Ti 4600).

-Nat





Re: [PyMOL] pymol without GL

2002-07-16 Thread Jason Maynes
Hello:

pymol.com -c scriptname

But you have to get your view first somehow.

Cheers,
JTM

*
Jason Thomas Maynes
MD/PhD Program
Faculty of Medicine  
University of Alberta
ja...@biochem.ualberta.ca
*


On Tue, 16 Jul 2002, Nathaniel Echols wrote:

> 
> quick question: I'm trying to do batch jobs on a server.  Obviously,
> there's no X or OpenGL installed.  Is there any way to build PyMOL without
> any graphical frontend, and just use it as a raytracer?  I don't want to
> go through the trouble of adding in these libraries...
> 
> thanks,
> Nat
> 
> 
> 
> ---
> This sf.net email is sponsored by: Jabber - The world's fastest growing 
> real-time communications platform! Don't just IM. Build it in! 
> http://www.jabber.com/osdn/xim
> ___
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 

*
Jason Thomas Maynes
MD/PhD Program
Faculty of Medicine
University of Alberta
ja...@biochem.ualberta.ca
*




[PyMOL] pymol without GL

2002-07-16 Thread Nathaniel Echols
quick question: I'm trying to do batch jobs on a server.  Obviously,
there's no X or OpenGL installed.  Is there any way to build PyMOL without
any graphical frontend, and just use it as a raytracer?  I don't want to
go through the trouble of adding in these libraries...

thanks,
Nat




[PyMOL] Re: How to run PyMol from within Python?

2002-07-16 Thread Andrey Khavryuchenko
Johan,

"JL" == Johan Leckner wrote:

 JL> So there is no way to run and control PyMol from within another python
 JL> program?

Why?  There is!

[...]

 JL> Has anyone been able to run and quit PyMol from within python without
 JL> killing the interpreter? Is it possible? How?

Here's a script, that I've used to use in Nov.  Not sure that it will run
with current version of pymol, however.

# -*- python -*- file
# $Id: mov.py,v 1.8 2001/11/23 23:47:48 akhavr Exp $
#
# Copyright (C) 2001 by KDS Software Group http://www.kds.com.ua/

from glob import glob
import os
import sys

def split(movie_name):
movie = open(movie_name)
filename = "output"
counter = 1
f = open(filename+"%010d" % counter,"w")

skipnextline = 1

while 1:
l = movie.readline()
if l == "":
break
if l == " \r\n" or l == " \n":
f.close()
counter = counter + 1
f = open(filename+"%010d" % counter,"w")
skipnextline = 1
continue
if skipnextline == 1:
skipnextline = 0
continue
else:
f.write(l)
f.close()
os.remove(filename+"%010d" % counter)

def make_pdb():
for file in glob("output*"):
os.system("transform 5 "+file+" "+file+".xyz")
os.system("babel -ixyz "+file+".xyz -opdb "+file+".pdb")
os.remove(file+".xyz")
os.remove(file)

def def_movie(width,height):
file_list = glob("output*.pdb")

for file in file_list:
cmd.load(file, "mov")

cmd.move("z",-10)
cmd.hide("lines")
cmd.show("spheres")

mov_def = ""
for i in range(1, len(file_list)+1):
mov_def = mov_def + str(i) + "  "

cmd.mset(mov_def)
cmd.viewport(width,height)
cmd.bg_color("white")

def make_png():
if not os.path.exists("png"): os.mkdir("png")

# enable raytracing
cmd.set("ray_trace_frames",1)
cmd.set("cache_frame",0)

# render
cmd.mpng("png/mov")

def make_yuv():
os.chdir("png")
for i in glob("*"):
( base, suffix ) = re.split('_', i)
( no, suffix ) = re.split('\.', suffix)
yuv_name = base+"."+str(int(no))
os.system("pngtopnm "+i+" | ppmtoyuvsplit "+yuv_name)
os.chdir("..")

def make_avi(width, height):
os.chdir("png")
num = str(len(glob("mov*Y")))
os.system("mpeg -a 1 -b "+num+" -h "+str(width)+" -v "+str(height)+
  " -PF mov. -s mov.mpg")
os.system("ffmpeg -f mpegvideo -i mov.mpg -r 25 " +
  "-an -f avi -b 1000 mov.avi ")
try:
  os.remove("../mov.mpg")
  os.remove("../mov.avi")
except OSError: pass
os.rename("mov.mpg","../mov.mpg")
os.rename("mov.avi","../mov.avi")
os.chdir("..")

def clean():
for file in glob("output*"):
os.remove(file)
for file in glob("png/*"):
os.remove(file)
os.rmdir("png")

width=800
height=600

try:
movie_name = sys.argv[3]
print "Processing "+movie_name
split(movie_name)
make_pdb()
def_movie(width,height)
make_png()
make_yuv()
make_avi(width,height)
clean()
except IndexError:
print """
Usage:
pymol -c mov.py z-sequence-file
"""


-- 
Andrey V Khavryuchenko  http://www.kds.com.ua/
Software Solutions


Re: [PyMOL] How to run PyMol from within Python?

2002-07-16 Thread Johan Leckner

Hi all,

So there is no way to run and control PyMol from within another python program?

The reason for asking is that we are working on a python platform to 
run and evaluate protein-protein docking calculations. It would be a 
nice feature to be able to call up interaction surfaces and 
protein-protein clusters for display  in PyMol and then interact with 
them from within our program.


As things are now I'm forced to treat PyMol as I would treat any 
molecular graphics program, that is write macros macros for it. This 
is of course much less convenient and less flexible compared to 
running PyMol from within our python code.


Has anyone been able to run and quit PyMol from within python without 
killing the interpreter? Is it possible? How?


Cheers, Johan




 > I'm having problems running PyMol from within another Python program.

This is not the recommended way to run PyMOL and may lead to 
problems.  You can run Python programs within PyMOL as follows:


from the command-line:

pymol example.py # synchronous, in PyMOL module
pymol -r example.py  # synchronous in __main__ module
pymol -l example.py  # asychronous in a new module

You can also launch python programs from within PyMOL with the commands:

run example.py# synchronous in pymol module
run example.py,main   # synchronous in __main__ module

spawn example.py# asychronous in a new module
spawn example.py,global # asychronous in the PyMOL module
spawn example.py,main   # asychronous in the __main__ module

see:

help launching
help run
help spawn

 > Following the examples in /pymol/examples/devel I have been able to
 > launch and controll PyMOL. The problem occur when I try to quit PyMol
 > (version. 0.82) however I do it I end up with a fault terminating my
 > Python interpreter.
 >
 > Under Redhat 7.1/Python 2.1 i get a segmentation fault and under
 > MacOS 10.1.5/Python 2.2.1 I get a Python bus error. I get the same
 > result both when quitting from the gui or within python with the
 > command cmd.quit()
 >
 > How can I quit PyMol properly?

I know for a fact that the Mac take-down process is currently 
flawed, and frequently gives a bus error.  Because it only happens 
after you quit the program, its a low priority issue...


Not sure about Redhat.

Warren