On Fri, 27 Sep 2002 py...@rubble.com wrote: > I am a software developer starting a project for a biology lab doing > work in protein structure. I am not a biologist. We'll be using Pymol > as the basis for the visualization component of the application, and I > am at the beginning stages of understanding how pymol works and is put > together.
Great, I'm glad to hear that you're thinking about PyMOL! As the principle author of the program, I do want to make sure that you are going into this with your eyes open. PyMOL in its present state is pretty raw -- you'll be one of a small collection of developers trying to make use of a system which is still very much in its early days, which is both good and bad: good because you have the opportunity to influence the project to suit your needs (in contrast to something like Chime) -- but bad because it means some things will be difficult or frustratingly slow to accomplish. > I already have a number of questions but I am going to hold off until > I have more experience with the package. But there is one issue I need > settled soon and I'm hoping some of you can point me in the right > direction. > > We are not going to use the existing external UI or the internal GLUT > UI. Our application will be doing a bunch of things not related to Excellent. This is probably the best approach to take for a project involving integration right now, given that both of the user interfaces are immature and subject to change. > 3-D structure, and my thinking right now is to simply start pymol in a > separate thread as it is done in examples/devel/start_pymol.py, > handing it the -x and -i flags. Then our app will use cmd.* calls to > get protein structures loaded and manipulated. Sounds reasonable. However, Python threading performace is poor -- it is basically fake: the threads are real, but the interpreter itself is single-threaded, and so multiple thread context switches are required to get a single context switch for the interpreter. However, a program like PyMOL spends most of its processing time at the C level, so the overall impact is minimal. My recommendation would be that you build a lightweight Python socket or RPC listener which runs as a PyMOL thread, but actually write your software to run as a separate process. This has a couple of advantages: (1) you get the full multiprocessing performance of your system (2) if PyMOL crashes, your application remains intact (3) you maintain a clean separation between the two projects, which provides you with long-term flexibility (perhaps even an ability to use other programs besides PyMOL). > What I don't understand is how I can get notified of events that > happen when the user uses the mouse to select residues etc. For > example, once a protein is loaded, our app may color certain residues > if we know that there have been experiments that mutated that > position(s). And if a user clicks on one of those residues, our app > needs to open up another window and present the data by fetching it > from a relational database. Is there a way that the external GUI can > be notified of events? I looked through the documentation and didn't > see anything obvious. That's because those decisions haven't really been made yet. The only facility which currently exists for this is the Wizard API, which is incomplete in both the development version and the release. > I looked through the code a bit, and I'm still at a very early stage > of learning. But I did see that the pmg_tk module sets pymol._ext_gui > and sets up a FIFO. I can't see that it is used anywhere by the pymol > module, but I'm thinking that this is the start of a 2-way > communication mechanism between pymol and an external GUI? This functionality needs to be flushed out, but I need outside input as to how to best go about it. Fortunately, you're not the only one interested in this right now, so perhaps we get an active dialog going in this direction? What would the ideal system look like, and what are you top three priorities? > Can anyone tell me how to be notified that selections change? Or even > just receive raw mouse events? Version 0.82 has only bare minimum capabilities in this area -- take a look at the files inside the modules/pymol/wizard directory for examples of handling CTRL-mouse clicks. Welcome to PyMOL! Cheers, Warren