From: Miguel <mi...@jm...> - 2005-08-23 00:47:39
|
Scott wrote: > I'm currently developing an AJAX web service that uses Jmol to view > an overlay of PDB conformers generated on a server. OK (Not familiar with AJAX) > I've been working on a Javascript that includes a loop similar to the > following: > - XMLHTTP server request for newly generated model > - append new model to string containing all previous models > - get view > - loadInline(concatenated model) > - Jmol script call to set view to the previous and to restore the > previous rendering style > - repeat OK, I think I get the idea. Q: Why are you catting in JavaScript and using loadInline rather than doing a 'load some-concatenation-cgi?foo' where the concatenation is performed on the web server? > There are several things that would dramatically simplify development > on my end. > > First, from looking at the Jmol source, I think that it should be > relatively easy to modify PdbReader.java to add support for appending > a new model to an existing set of models. It turns out that it is a little more difficult than that. The data structures created by the PdbReader are only intermediate structures that= are then read/reused by the Jmol core. So the PdbReader is further away from the key data structures than one might think. > If you could add a > Javascript call to the API and a 'appendAtomSetCollection' method > (based on readAtomSetCollection), I wouldn't have to build the multi- > model file in the browser's Javascript memory and Jmol wouldn't have > to continually reload the entire set of models with every update. It > would also save me from having to capture and reset the orientation > and rendering format on every reload. I think I basically understand what you are trying to do. > Second, all of the Jmol scripting functions seem to be asynchronous. > This is good because the script doesn't have to wait for Jmol to > complete a call before proceeding but it raises severe timing issues. Sure does. In general, I have not come up with a clean event notification scheme for= JavaScript. The interface between JavaScript and Java (aka LiveConnect) is very fragile and easily broken. I have not been able to find a reliable cross-platform event notification= mechanism. (The truth is, I have not looked in quite some time. The last time I trie= d to do some work in this area I became so disgusted that I gave up.) > Right now, I've had to resort to an ugly messageCallback Javascript. > It'd be great if there were an option to change all of the applet > calls so that they would automatically be enqueued and executed in- > order. I am not sure what you mean by 'change all of the applet calls ... enqueued ...' Q: Do you mean, enqueue all of the calls to jmolScript? > Finally, it'd be nice if there was a simple way to change the > callback function with a Javascript call. As far as I understand, the > only way to do that now is to set the callback to a wrapper function > then to use the wrapper to dispatch the call to a specific listener > or method (note that this would be unnecessary (for me, at least) > with guaranteed in-order execution). I do not want to do anything to extend the use of the callback functions.= The only reason that the callback functions are in there is to provide basic backwards compatibility with Chime. I am (foolishly?) hoping that something will happen and that a new event model will become available. I realize that this does not help you get your job done *today*. > If you can do any of the above or have any suggestions, I'd greatly > appreciate it. Let's talk about/work on these things one at a time. First, let's work on the 'append an additional model' problem. One or two= other people have asked for the same thing. Let's assume that we have some script command that will load an additiona= l file without clearing the first one ... How should model numbers be handled? ... Q: What should the model number of the 2nd file be? Q: What happens if there are explicit model numbers in subsequent files, but those model numbers are already used? Regarding scale & centering ... Q: What happens if the coordinates of the 2nd model are completely unrelated to the coordinates of the first? For example, the first one loaded is centered at 10000,10000,10000 and the second one loaded is centered at -10000,-10000,-10000 ? Q: What scaling should be used? (by scaling I mean, pixels per angstrom) Q: What happens if the first model loaded is HOH and the 2nd model loaded= is some huge protein? Let's keep talking. Miguel ----- Open Source Molecular Visualization www.jmol.org miguel=40jmol.org ----- |