Tue, 22 Oct 2002 12:51:55 -0700
At 11:45 AM 10/22/2002, Konrad Hinsen wrote:
>greg landrum <email@example.com> writes:
> > Back at the beginning of the year, I wrote a little xml-rpc server
> > thing for PyMol which allows molecules to be loaded from other
> > processes. It should be reasonably easy to adapt Konrad's MMTK
> > display stuff to use this.
>That's an interesting approach as well... Is your server documented in
>any way? What kind of molecule representation does it expect?
I just did a big more investigating. Warren is indeed distributing the
xml-rpc thing. There's little in the way of documentation (it's in the
code, which is in PyMol/modules/pymol/rpc.py), but the whole thing is
Basically, you get PyMol to run the xml-rpc server by starting it with the
-X option. It'll tell you what port to use when it starts.
You connect to the server using xmlrpclib:
# connect to the server:
serv = xmlrpclib.Server('http://localhost:9123')
You can then send PyMol API calls to the server using the do command:
# load one of the test files that comes with pymol
# (path is, of course, installation specific)
So you can load pretty much any kind of molecule that PyMol normally
supports. The limitation is, of course, that you have to create a file
first. It'd be reasonably trivial to work around this problem.
You've got the whole PyMol API to play with so you can change display style
and the like:
# switch to using sticks for the display
To demonstrate some of the other things that one could do with the
interface, there are also sphere and cylinder commands available:
# now, show off some extra features to draw in a 3-point pharmacophore
serv.cylinder((-3.62,-0.54, -0.68),(0.07,-0.16, 2.52),0.3,(.9,0.5,.9),"pharm")
serv.cylinder((-3.62,-0.54, -0.68),(-0.05,1.96, 1.55),0.3,(.9,0.5,.9),"pharm")
serv.cylinder((0.07,-0.16, 2.52),(-0.05,1.96, 1.55),0.3,(.9,0.5,.9),"pharm")
If there's significant interest in this, I can probably be convinced to do
a bit more work on it. I think the idea is potentially very useful, but I
haven't needed it recently.
greg Landrum (firstname.lastname@example.org)
Software Carpenter/Computational Chemist