On Mon, 29 Mar 2004, Nat Echols wrote: > > The downloaded script is then executed by Pymol, which can uses Python's > > socket abilities to download PDB files and run Pymol commands on them. > > Hmmmm, I like this idea. Can PyMOL open files directly over the web? It > would be nice to simply type > > PyMOL> load http://server/1cll.pdb, calmodulin >
Kristian Rother's rTools (http://www.rubor.de/bioinf/pymol_rubor.html) comes with a "pdb" command that's similar: pdb (pdb-id) - get PDB structure (pdb-id) from the local disk, or from the PDB server. which does everything that I want, but it might be nice to have PyMOL parse urls like that. Shouldn't be hard, especially with read_pdbstr. Hmmn .. in fact, if you feel like playing around a bit, you can go into cmd.py and change the definition of _load. At the top, right after it says 'r = 1', add this: #print "oname",oname,"finfo",finfo,"ftype",ftype if ftype == loadable.pdb and finfo.startswith('http://'): import urllib from importing import read_pdbstr print "requesting file",finfo pdbstr = urllib.urlopen(finfo).read() r = read_pdbstr(pdbstr,oname,state,finish,discrete) And change the 'if' on the next line to an 'elif'. That will make this work with simple urls. For example, you can type something like load http://www.umich.edu/~mlerner/1rx1.pdb or load http://www.umich.edu/~mlerner/1rx1.pdb, nifty and it'll work. More complicated urls seem to break PyMOL's parser. If you uncomment the print statement in my little code snippet above, you can see what goes wrong with, e.g. a url from the PDB like this http://www.rcsb.org/pdb/cgi/explore.cgi?job=download;pdbId=1RX1;page=&opt=show&format=PDB&pre=1 but I haven't played around with the parser at all. -michael -- This isn't a democracy;| _ |Michael Lerner it's a cheer-ocracy. | ASCII ribbon campaign ( ) | Michigan -Torrence, Bring It On| - against HTML email X | Biophysics | / \ | mler...@umich