Martin, > I am wondering, are there any scripts/ plugins for PyMOL out there that > facilitate the generation of a large amount of rotamers for different > mutants? I might take the effort and start building this into a plugin.
I'm not aware of any. Some of our other seasoned PyMOLers might, though. If you need help w/the plugin there's a simple tutorial on the PyMOLWiki (http://www.pymolwiki.org/index.php/Plugins_Tutorial) and TKinter/PMW are very easy to develop with. Good luck! Cheers, -- Jason On Sat, Sep 18, 2010 at 6:48 PM, Martin Hediger <ma....@bluewin.ch> wrote: > This is great. Thanks a lot. > I am wondering, are there any scripts/ plugins for PyMOL out there that > facilitate the generation of a large amount of rotamers for different > mutants? I might take the effort and start building this into a plugin. > > Martin > > > > > > > Am 16.09.10 19:51, schrieb Jason Vertrees: >> >> Hi Martin, >> >> This took a bit of work to figure out, but the following code solves >> your problem (above). It will download a PDB (I coded "1RSY") and >> select a residue (I coded 236). I will then mutate that residue to >> all possible residues given what the rotamer library knows about, and >> write that out to N-files called "stateXYZ.pdb", where XYZ is the >> mutation number. Instead of rewriting the code, it turns out you can >> hack the wizard through the API to do what you want: >> >> # begin a python block of code; >> python >> org = "1rsy" >> cpy = "1rsy_cpy" >> >> # fetch a PDB >> cmd.fetch(org, async=0) >> >> # make a copy on which to operate >> cmd.create(cpy,org) >> res = cpy + " and i. 236" >> >> # focus no the residue, if you want >> cmd.zoom(res, 3) >> >> # start the wizard to count the number of rotamers for this residue >> cmd.wizard("mutagenesis") >> >> # this was the painful part: if you just write "res" instead of "(res)" >> # pymol will delete your residue. "(res)" make it an anonymous selection >> cmd.get_wizard().do_select("("+res+")") >> nStates = cmd.count_states("mutation") >> >> # foreach state, make the change and write to disk >> for i in range(1,nStates+1): >> print "State ", i, "/", nStates >> cmd.get_wizard().do_select("("+res+")") >> cmd.frame(i) >> cmd.get_wizard().apply() >> cmd.save("state" + str(i) + ".pdb", cpy) >> cmd.delete(cpy) >> cmd.create(cpy,org) >> >> # end the python block >> python end >> >> # quit the wizard >> cmd.set_wizard() >> >> Cheers, >> >> -- Jason >> >> On Tue, Sep 14, 2010 at 6:33 PM, Martin Hediger<ma....@bluewin.ch> wrote: >>> >>> I'm beginning to see things. >>> When I issue: >>> >>> for value in rot_lib[('ASP', 40, -100)]: >>> rl.write(str(value) + '\n') >>> >>> rot_lib is being initiated by >>> >>> rot_lib = >>> >>> pickle.load(open("/Applications/PyMOLX11Hybrid.app/pymol/data/chempy/sidechains/sc_bb_dep.pkl",'r')) >>> >>> >>> I get the following output: >>> {('N', 'CA', 'CB', 'CG'): -169.69999999999999, 'FREQ': >>> 0.47735699999999998, >>> ('CA', 'CB', 'CG', 'OD1'): 3.6000000000000001} >>> {('N', 'CA', 'CB', 'CG'): -173.5, 'FREQ': 0.19134399999999999, ('CA', >>> 'CB', >>> 'CG', 'OD1'): 56.799999999999997} >>> {('N', 'CA', 'CB', 'CG'): -72.099999999999994, 'FREQ': >>> 0.11949799999999999, >>> ('CA', 'CB', 'CG', 'OD1'): -12.9} >>> {('N', 'CA', 'CB', 'CG'): -167.80000000000001, 'FREQ': 0.108205, ('CA', >>> 'CB', 'CG', 'OD1'): -55.5} >>> {('N', 'CA', 'CB', 'CG'): -64.599999999999994, 'FREQ': >>> 0.075302999999999995, >>> ('CA', 'CB', 'CG', 'OD1'): -50.0} >>> {('N', 'CA', 'CB', 'CG'): 62.399999999999999, 'FREQ': 0.013899, ('CA', >>> 'CB', >>> 'CG', 'OD1'): 1.3} >>> >>> I understand these are dictionaries containing the phi, psi values for a >>> rotamer. Now this would mean in this case there are six rotamers for this >>> situation. Starting to get closer to what i want. >>> Still, if there is a easy way to get PDB files of every rotamer, that >>> would >>> solve my problem. >>> So the thing left to figure out is how to find the right key for the >>> rot_lib >>> to give me the rotamers of the residue i am actually interested in. >>> >>> Thanks again for the support. >>> >>> Martin >>> >>> >>> >>> >>> >>> >>> Am 14.09.10 01:01, schrieb Jason Vertrees: >>>> >>>> Hi Martin, >>>> >>>> Try replacing >>>> >>>>> (phi, psi) = cmd.phi_psi("br. first my_res") >>>> >>>> with >>>> >>>> (phi, psi) = cmd.phi_psi("br. first my_res").values()[0] >>>> >>>> >>>> Here's what I have now, for the script (I fixed one more bug): >>>> import pickle >>>> rot_lib = >>>> >>>> pickle.load(open("/Applications/PyMOLX11Hybrid.app/pymol/data/chempy/sidechains/sc_bb_dep.pkl",'r')) >>>> from pymol import stored >>>> from pymol import cmd >>>> stored.r = '' >>>> >>>> # What are we doing here? What is 'first'? >>>> >>>> cmd.iterate("first my_res", "stored.r = resn") >>>> >>>> (phi, psi) = cmd.phi_psi("br. first my_res").values()[0] >>>> key = (stored.r, int(10*round(phi/10)), int(10*round(psi/10))) >>>> >>>> if key in rot_lib.keys(): >>>> print "This rot has %s possible positions" % len(rot_lib[key]) >>>> >>>> >>>> >>>> Cheers, >>>> >>>> -- Jason >>>> >>>> On Mon, Sep 13, 2010 at 5:04 PM, Martin Hediger<ma....@bluewin.ch> >>>> wrote: >>>>> >>>>> Hi Jason and PyMOL users >>>>> I tried to run the script to get the number of rotamers, but I seem to >>>>> have >>>>> something missing. >>>>> The script looks as follows: >>>>> >>>>> import pickle >>>>> rot_lib = >>>>> >>>>> >>>>> pickle.load(open("/Applications/PyMOLX11Hybrid.app/pymol/data/chempy/sidechains/sc_bb_dep.pkl",'r')) >>>>> from pymol import stored >>>>> from pymol import cmd >>>>> stored.r = '' >>>>> >>>>> # What are we doing here? What is 'first'? >>>>> cmd.iterate("first my_res", "stored.r = resn") >>>>> >>>>> (phi, psi) = cmd.phi_psi("br. first my_res") >>>>> key = (stored.r, int(10*round(ph/10)), int(10*round(psi/10))) >>>>> if key in rot_lib.keys(): >>>>> print "This rot has %s possible positions" % len(rot_lib[key]) >>>>> >>>>> Now, I save this into rotlib.py, 'cd' PyMOL into the directory where >>>>> this >>>>> script lies, select a residue from the GUI, rename the selection to >>>>> 'my_res' >>>>> and then 'run rotlib.py' the script. This returns the following ERROR >>>>> message in PyMOL: >>>>> >>>>> Traceback ... >>>>> (phi, psi) = cmd.phi_psi("br. first my_res") >>>>> ValueError: need more than 0 values to unpack >>>>> >>>>> Unfortunately, I dont understand what this is trying to tell me right >>>>> now, >>>>> ok, some Argument seems to be missing, but I cant tell what exactly. >>>>> Also, >>>>> could you possibly extend your explanation on what the 'iterate' method >>>>> is >>>>> used for. I think this would help me a lot. >>>>> >>>>> As I said, all I want is a PDB file for every rotamer itself. If there >>>>> is >>>>> a >>>>> simpler way to achieve this, that is fine with me. The number of >>>>> rotamers >>>>> is >>>>> only important to me, since I need to know how many times i should >>>>> issue >>>>> 'cmd.forward()' and save. >>>>> >>>>> Thanks for the help. >>>>> Martin >>>>> >>>>> >>>>> >>>>> Am 13.09.10 00:30, schrieb Jason Vertrees: >>>>>> >>>>>> Hi Martin, >>>>>> >>>>>>> iterate first my_res, stored.r = resn >>>>>> >>>>>> is syntactically correct, but could also be written, >>>>>> >>>>>> cmd.iterate("first my_res", "stored.r = resn"); >>>>>> >>>>>> The command could be read as, "iterate over just first atom from the >>>>>> selection called 'my_res' and place the residue name in which that >>>>>> atom resides into 'stored.r'." So, "first" is a new-ish selection >>>>>> modifier that takes just the first atom from a selection. It's _very_ >>>>>> handy: why iterate through all atoms in a residue to get a residue >>>>>> name, when just the first will do? "resn" indeed returns the 3-letter >>>>>> residue code. >>>>>> >>>>>> A more efficient way might be: >>>>>> >>>>>> # select a residue, here #50 (or use the mouse) >>>>>> select mySelection, i. 50 >>>>>> >>>>>> # get it's one-letter residue id >>>>>> print string.split(cmd.get_fastastr("mySelection"),'\n')[1] >>>>>> # get it's three-letter residue id >>>>>> print >>>>>> three_letter[string.split(cmd.get_fastastr("mySelection"),'\n')[1]] >>>>>> >>>>>> I just posted this on http://www.pymolwiki.org/index.php/Aa_codes. >>>>>> (You will need the two dictionaries found there.) >>>>>> >>>>>> There really should be a much easier way to do that... Maybe someone >>>>>> has a far easier command? >>>>>> >>>>>> Cheers, >>>>>> >>>>>> -- Jason >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Sun, Sep 12, 2010 at 4:25 PM, Martin Hediger<ma....@bluewin.ch> >>>>>> wrote: >>>>>>> >>>>>>> Hi Jason, thanks for the comprehensive answer. >>>>>>> One question though, is the line >>>>>>> >>>>>>> iterate first my_res, stored.r = resn >>>>>>> >>>>>>> >>>>>>> >>>>>>> correct this way? Are there no braces or quotation marks needed? Its >>>>>>> not >>>>>>> perfectly clear to me if 'first' and 'my_res' are selections >>>>>>> (indicated >>>>>>> by >>>>>>> braces) or objects (name without braces in the main window). >>>>>>> I understand 'resn' is something like 'GLU', if I want to know how >>>>>>> many >>>>>>> GLU >>>>>>> rotamers are in the library. >>>>>>> >>>>>>> Thanks again >>>>>>> Martin >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Am 12.09.10 22:00, schrieb Jason Vertrees: >>>>>>>> >>>>>>>> Hi Martin, >>>>>>>> >>>>>>>> PyMOL first searches the Dunbrack rotamer library for hits based >>>>>>>> upon >>>>>>>> the amino acid type and it's original phi/psi angles. If it cannot >>>>>>>> find a hit, it will then look for backbone independent positions. >>>>>>>> To >>>>>>>> get the number of available rotamers given a residue, you need to >>>>>>>> unpickle the library, create the lookup key into the library and >>>>>>>> then >>>>>>>> count the results. It might look something like this: >>>>>>>> >>>>>>>> # unpickle the library >>>>>>>> import pickle >>>>>>>> rot_lib = >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> pickle.load(open("$PYMOL_HOME/data/chempy/sidechains/sc_bb_dep.pkl",'r')) >>>>>>>> >>>>>>>> # get residue name, you need to select the residue >>>>>>>> # into "my_res" >>>>>>>> from pymol import stored >>>>>>>> stored.r = '' >>>>>>>> iterate first my_res, stored.r = resn >>>>>>>> >>>>>>>> # get residue info; prepare dictionary key >>>>>>>> (phi,psi) = cmd.phi_psi("br. first my_res") >>>>>>>> >>>>>>>> # warren also does 20 and 60 in place of 10--three possible lookups >>>>>>>> key = ( stored.r, int(10*round(phi/10)), int(10*round(psi/10))) >>>>>>>> >>>>>>>> if key in rot_lib.keys(): >>>>>>>> print "This rotamer has %s possible positions" % len(rot_lib[key]) >>>>>>>> >>>>>>>> Lookups in the independent library are easier--just provide a >>>>>>>> residue >>>>>>>> name. >>>>>>>> >>>>>>>> Cheers, >>>>>>>> >>>>>>>> -- Jason >>>>>>>> >>>>>>>> >>>>>>>> On Sun, Sep 12, 2010 at 11:04 AM, Martin Hediger<ma....@bluewin.ch> >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> Dear all, let me rephrase my question in a less confusing way. >>>>>>>>> For a given mutant, I need a PDB file for every available rotamer. >>>>>>>>> I >>>>>>>>> guess thats the simplest way of putting it. How can I achieve that? >>>>>>>>> >>>>>>>>> Thanks for hints. >>>>>>>>> Martin >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Am 12.09.10 00:08, schrieb Martin Hediger: >>>>>>>>>> >>>>>>>>>> Hi all >>>>>>>>>> I want to do some scripted mutations on a range of residues. Say I >>>>>>>>>> want >>>>>>>>>> to mutate residue 189 to every rotamer of [Asp, His, Glu, Thr, >>>>>>>>>> Lys] >>>>>>>>>> available in the PyMOL internal rotamer library. I'm seeing that >>>>>>>>>> PyMOL >>>>>>>>>> issues cmd.get_wizard().do_state(i) to select rotamer 'i' for a >>>>>>>>>> mutation. Now, if I want to iterate over all available rotamers, I >>>>>>>>>> need >>>>>>>>>> the limit rotamer number. How can I obtain the maximum number of >>>>>>>>>> rotamers available for every amino acid? >>>>>>>>>> >>>>>>>>>> Thanks for hints on this >>>>>>>>>> >>>>>>>>>> Martin >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>>> Start uncovering the many advantages of virtual appliances >>>>>>>>>> and start using them to simplify application deployment and >>>>>>>>>> accelerate your shift to cloud computing >>>>>>>>>> http://p.sf.net/sfu/novell-sfdev2dev >>>>>>>>>> _______________________________________________ >>>>>>>>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >>>>>>>>>> Info Page: >>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>> Archives: >>>>>>>>>> http://www.mail-archive.com/pymol-users@lists.sourceforge.net >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>> Start uncovering the many advantages of virtual appliances >>>>>>>>> and start using them to simplify application deployment and >>>>>>>>> accelerate your shift to cloud computing >>>>>>>>> http://p.sf.net/sfu/novell-sfdev2dev >>>>>>>>> _______________________________________________ >>>>>>>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >>>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>> Archives: >>>>>>>>> http://www.mail-archive.com/pymol-users@lists.sourceforge.net >>>>>>>>> >>>> >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) jason.vertr...@schrodinger.com (o) +1 (603) 374-7120 ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net