From: Martin H. <ma...@bl...> - 2010-09-11 22:08:40
|
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 |
From: Martin H. <ma...@bl...> - 2010-09-12 15:05:04
|
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 (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > |
From: Jason V. <jas...@sc...> - 2010-09-12 20:01:22
|
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...@bl...> 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 (PyM...@li...) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pym...@li... >> > > > ------------------------------------------------------------------------------ > 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 (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Martin H. <ma...@bl...> - 2010-09-12 20:25:56
|
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...@bl...> 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 (PyM...@li...) >>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>> Archives: http://www.mail-archive.com/pym...@li... >>> >> >> ------------------------------------------------------------------------------ >> 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 (PyM...@li...) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pym...@li... >> > > |
From: Jason V. <jas...@sc...> - 2010-09-12 22:31:02
|
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...@bl...> 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...@bl...> >> 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 (PyM...@li...) >>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>> Archives: http://www.mail-archive.com/pym...@li... >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> 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 (PyM...@li...) >>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>> Archives: http://www.mail-archive.com/pym...@li... >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Thomas H. <sp...@us...> - 2010-09-13 08:10:54
|
On Mon, Sep 13, 2010 at 12:30 AM, Jason Vertrees <jas...@sc...> wrote: > # 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.) a note regarding the "one_letter" dictionary. I always import the "to_one_letter_code" dictionary from biopython for that purpose, it has also three-letter shortcuts for many modified residues. from Bio.PDB import to_one_letter_code as one_letter Cheers, Thomas |
From: Tsjerk W. <ts...@gm...> - 2010-09-13 08:18:03
|
Hi Jason e.a., I usually do the hashing like: aa1 = list("ACDEFGHIKLMNPQRSTVWY") aa3 = "ALA CYS ASP GLU PHE GLY HIS ILE LYS MET ASN PRO GLN ARG SER THR VAL TRP TYR".split() aa123 = dict(zip(aa1,aa3)) aa321 = dict(zip(aa3,aa1)) The real convenience in there is that you can easily construct any kind of hash by just adding a matching list, and zipping. Then to extract a sequence, I tend to go for a construction like: sequence = [ aa321[i.resn] for i in cmd.get_model(selection + " and n. ca").atom ] Cheers, Tsjerk On Mon, Sep 13, 2010 at 12:30 AM, Jason Vertrees <jas...@sc...> wrote: > 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...@bl...> 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...@bl...> >>> 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 (PyM...@li...) >>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> 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 (PyM...@li...) >>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>> Archives: http://www.mail-archive.com/pym...@li... >>>> >>> >>> >> >> > > > > -- > Jason Vertrees, PhD > PyMOL Product Manager > Schrodinger, LLC > > (e) Jas...@sc... > (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 (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group Groningen Institute for Biomolecular Research and Biotechnology / University of Groningen The Netherlands |
From: Jason V. <jas...@sc...> - 2010-09-13 13:08:58
|
These are all great ideas--I'm glad I asked. I updated the wiki page (http://www.pymolwiki.org/index.php/Aa_codes) to reflect this discussion. Cheers, -- Jason On Mon, Sep 13, 2010 at 4:17 AM, Tsjerk Wassenaar <ts...@gm...> wrote: > Hi Jason e.a., > > I usually do the hashing like: > > aa1 = list("ACDEFGHIKLMNPQRSTVWY") > aa3 = "ALA CYS ASP GLU PHE GLY HIS ILE LYS MET ASN PRO GLN ARG SER THR > VAL TRP TYR".split() > aa123 = dict(zip(aa1,aa3)) > aa321 = dict(zip(aa3,aa1)) > > The real convenience in there is that you can easily construct any > kind of hash by just adding a matching list, and zipping. > > Then to extract a sequence, I tend to go for a construction like: > > sequence = [ aa321[i.resn] for i in cmd.get_model(selection + " and n. > ca").atom ] > > Cheers, > > Tsjerk > > On Mon, Sep 13, 2010 at 12:30 AM, Jason Vertrees > <jas...@sc...> wrote: >> 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...@bl...> 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...@bl...> >>>> 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 (PyM...@li...) >>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> 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 (PyM...@li...) >>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>> >>>> >>>> >>> >>> >> >> >> >> -- >> Jason Vertrees, PhD >> PyMOL Product Manager >> Schrodinger, LLC >> >> (e) Jas...@sc... >> (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 (PyM...@li...) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pym...@li... >> > > > > -- > Tsjerk A. Wassenaar, Ph.D. > > post-doctoral researcher > Molecular Dynamics Group > Groningen Institute for Biomolecular Research and Biotechnology / > University of Groningen > The Netherlands > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Martin H. <ma...@bl...> - 2010-09-13 21:04:28
|
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...@bl...> 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...@bl...> >>> 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 (PyM...@li...) >>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> 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 (PyM...@li...) >>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>> Archives: http://www.mail-archive.com/pym...@li... >>>> >>> >> > > |
From: Jason V. <jas...@sc...> - 2010-09-13 23:02:24
|
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...@bl...> 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...@bl...> 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...@bl...> >>>> 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 (PyM...@li...) >>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>> Archives: >>>>>> http://www.mail-archive.com/pym...@li... >>>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> 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 (PyM...@li...) >>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>> >>>> >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Martin H. <ma...@bl...> - 2010-09-14 22:33:26
|
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...@bl...> 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...@bl...> 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...@bl...> >>>>> 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 (PyM...@li...) >>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>> Archives: >>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> 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 (PyM...@li...) >>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>>> >>> >> > > |
From: Martin H. <ma...@bl...> - 2010-09-16 09:44:19
|
Dear All I run into something when using the Mutagenesis Wizard. Given a peptide as this: ALA-HIS-TRP, created by <Alt>-A, <Alt>-H, <Alt>-T. After that I issue h_add to fill up valencies at the terminal carbonyl and amine sites. Say I mutate now the terminal TRP to something else (e.g. GLU), i run into a problem. Now the hydrogen on the terminal carbonyl misses. This is very problematic for me, because I am working on a structure that was geometry optimized (700 atoms) and for which i spent some times in protonating correctly. The question is: Can a residue at the end of a chain be mutated such that the hydrogen on the carbonyl group remains there? I hope I could explain my problem and I would be very happy if there was a solution to this. Thanks a lot Martin Am 15.09.10 00:33, schrieb Martin Hediger: > 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...@bl...> 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...@bl...> 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...@bl...> >>>>>> 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 (PyM...@li...) >>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>> Archives: >>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> 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 (PyM...@li...) >>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>> Archives: http://www.mail-archive.com/pym...@li... >>>>>>> >> > > ------------------------------------------------------------------------------ > 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 (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > |
From: Jason V. <jas...@sc...> - 2010-09-16 18:14:51
|
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...@bl...> 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...@bl...> 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...@bl...> >>>> 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...@bl...> >>>>>> 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 (PyM...@li...) >>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>> Archives: >>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> 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 (PyM...@li...) >>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>> Archives: >>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>> >>>> >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Martin H. <ma...@bl...> - 2010-09-18 22:48:54
|
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...@bl...> 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...@bl...> 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...@bl...> >>>>> 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...@bl...> >>>>>>> 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 (PyM...@li...) >>>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>> Archives: >>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------------ >>>>>>>> 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 (PyM...@li...) >>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>> Archives: >>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>> >>> >> > > |
From: Jason V. <jas...@sc...> - 2010-09-19 17:00:41
|
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...@bl...> 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...@bl...> 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...@bl...> >>>> 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...@bl...> >>>>>> 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...@bl...> >>>>>>>> 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 (PyM...@li...) >>>>>>>>>> Info Page: >>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>> Archives: >>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>> 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 (PyM...@li...) >>>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>> Archives: >>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>> >>>> >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Martin H. <ma...@bl...> - 2010-09-20 09:35:51
|
Dear All Just one little thing, say I obtain a couple of rotamers by mutating a sidechain. It happens that some of them are sterically not favourable, i.e. atoms within less than VdW distance. Is there an easy, very low-level, PyMOL way of fixing this? Can the sculpting wizard be used for this? Thanks a lot for any suggestions. Martin Am 19.09.10 19:00, schrieb Jason Vertrees: > 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...@bl...> 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...@bl...> 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...@bl...> >>>>> 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...@bl...> >>>>>>> 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...@bl...> >>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>> Info Page: >>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>> Archives: >>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>> Archives: >>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>> >>> >> > > |
From: Jason V. <jas...@sc...> - 2010-09-20 15:00:26
|
Hi Martin, > atoms within less than VdW distance. Is there an easy, very low-level, PyMOL > way of fixing this? Can the sculpting wizard be used for this? Yes, after you place the sidechain and have the new structure (via the "apply" function) you can then apply sculpting. It would look something like this: # pause the UI cmd.set("suspend_updates",1) # reset the sphere scale cmd.set("sphere_scale","1.0") # go back to frame 1 (if you changed it) cmd.frame(1) # enable sculpting cmd.set("sculpting",1) # sculpt for 100 cycles cmd.sculpt_activate("myProtein") cmd.set("sculpting_cycles",100) # resume the UI cmd.set("suspend_updates",0) # write coords cmd.sculpt_iterate("myProtein") #quit sculpting cmd.unset("sculpting") Load a small protein and call it "myProtein". Then, copy/paste the above code into PyMOL to see what happens. Cheers, -- Jason On Mon, Sep 20, 2010 at 5:35 AM, Martin Hediger <ma...@bl...> wrote: > Dear All > Just one little thing, say I obtain a couple of rotamers by mutating a > sidechain. It happens that some of them are sterically not favourable, i.e. > atoms within less than VdW distance. Is there an easy, very low-level, PyMOL > way of fixing this? Can the sculpting wizard be used for this? > > Thanks a lot for any suggestions. > > Martin > > > > > > > > Am 19.09.10 19:00, schrieb Jason Vertrees: >> >> 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...@bl...> 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...@bl...> >>>> 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...@bl...> >>>>>> 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...@bl...> >>>>>>>> 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...@bl...> >>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>> Info Page: >>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>> Archives: >>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>> Info Page: >>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>> Archives: >>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>> >>>> >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |
From: Martin H. <ma...@bl...> - 2010-09-21 13:15:30
|
Wonderful. I'm close to completing what I need, thanks a lot. I have one other question here. Say I have a peptide: N-Ala-Ala-Glu-COO (I'm just pointing out the terminal amide and carbonyl groups). Then I protonate it with h_add H2N-Ala-Ala-Glu-(C=O)H. Now I carry out a mutation on the last position with the mutagenesis wizard to His. After this, the H's on the C=O is missing: H2N-Ala-Ala-His-(C=O). This is a bit unfortunate, because it would screw up the protonation of the whole system if I reissue h_add on the whole system after a mutation. Is it possible to fix atoms on only a selection, e.g. the site picked to mutate? Thanks for any advise on this. Martin Am 20.09.10 16:59, schrieb Jason Vertrees: > Hi Martin, > >> atoms within less than VdW distance. Is there an easy, very low-level, PyMOL >> way of fixing this? Can the sculpting wizard be used for this? > > Yes, after you place the sidechain and have the new structure (via the > "apply" function) you can then apply sculpting. It would look > something like this: > > # pause the UI > cmd.set("suspend_updates",1) > > # reset the sphere scale > cmd.set("sphere_scale","1.0") > > # go back to frame 1 (if you changed it) > cmd.frame(1) > > # enable sculpting > cmd.set("sculpting",1) > > # sculpt for 100 cycles > cmd.sculpt_activate("myProtein") > cmd.set("sculpting_cycles",100) > > # resume the UI > cmd.set("suspend_updates",0) > > # write coords > cmd.sculpt_iterate("myProtein") > > #quit sculpting > cmd.unset("sculpting") > > > Load a small protein and call it "myProtein". Then, copy/paste the > above code into PyMOL to see what happens. > > Cheers, > > -- Jason > > > > On Mon, Sep 20, 2010 at 5:35 AM, Martin Hediger<ma...@bl...> wrote: >> Dear All >> Just one little thing, say I obtain a couple of rotamers by mutating a >> sidechain. It happens that some of them are sterically not favourable, i.e. >> atoms within less than VdW distance. Is there an easy, very low-level, PyMOL >> way of fixing this? Can the sculpting wizard be used for this? >> >> Thanks a lot for any suggestions. >> >> Martin >> >> >> >> >> >> >> >> Am 19.09.10 19:00, schrieb Jason Vertrees: >>> 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...@bl...> 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...@bl...> >>>>> 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...@bl...> >>>>>>> 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...@bl...> >>>>>>>>> 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...@bl...> >>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>>> Info Page: >>>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>>> Archives: >>>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>> Info Page: >>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>> Archives: >>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>> >>> >> > > |
From: Martin H. <ma...@bl...> - 2010-09-21 13:17:36
|
I'm sorry, this is a bit confusing: Say the peptide looks like this: N-Ala-Ala-Ala-C=O. The problem arises with the hydrogen that finishes of the carbonyl group (of the potential peptide bond) of the last Ala, so the hydrogen on C=O. Wonderful. I'm close to completing what I need, thanks a lot. I have one other question here. Say I have a peptide: N-Ala-Ala-Glu-COO (I'm just pointing out the terminal amide and carbonyl groups). Then I protonate it with h_add H2N-Ala-Ala-Glu-(C=O)H. Now I carry out a mutation on the last position with the mutagenesis wizard to His. After this, the H's on the C=O is missing: H2N-Ala-Ala-His-(C=O). This is a bit unfortunate, because it would screw up the protonation of the whole system if I reissue h_add on the whole system after a mutation. Is it possible to fix atoms on only a selection, e.g. the site picked to mutate? Thanks for any advise on this. Martin Am 20.09.10 16:59, schrieb Jason Vertrees: > Hi Martin, > >> atoms within less than VdW distance. Is there an easy, very low-level, PyMOL >> way of fixing this? Can the sculpting wizard be used for this? > > Yes, after you place the sidechain and have the new structure (via the > "apply" function) you can then apply sculpting. It would look > something like this: > > # pause the UI > cmd.set("suspend_updates",1) > > # reset the sphere scale > cmd.set("sphere_scale","1.0") > > # go back to frame 1 (if you changed it) > cmd.frame(1) > > # enable sculpting > cmd.set("sculpting",1) > > # sculpt for 100 cycles > cmd.sculpt_activate("myProtein") > cmd.set("sculpting_cycles",100) > > # resume the UI > cmd.set("suspend_updates",0) > > # write coords > cmd.sculpt_iterate("myProtein") > > #quit sculpting > cmd.unset("sculpting") > > > Load a small protein and call it "myProtein". Then, copy/paste the > above code into PyMOL to see what happens. > > Cheers, > > -- Jason > > > > On Mon, Sep 20, 2010 at 5:35 AM, Martin Hediger<ma...@bl...> wrote: >> Dear All >> Just one little thing, say I obtain a couple of rotamers by mutating a >> sidechain. It happens that some of them are sterically not favourable, i.e. >> atoms within less than VdW distance. Is there an easy, very low-level, PyMOL >> way of fixing this? Can the sculpting wizard be used for this? >> >> Thanks a lot for any suggestions. >> >> Martin >> >> >> >> >> >> >> >> Am 19.09.10 19:00, schrieb Jason Vertrees: >>> 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...@bl...> 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...@bl...> >>>>> 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...@bl...> >>>>>>> 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...@bl...> >>>>>>>>> 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...@bl...> >>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>>> Info Page: >>>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>>> Archives: >>>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>> Info Page: >>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>> Archives: >>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>> >>> >> > > |
From: Jason V. <jas...@sc...> - 2010-09-21 22:25:09
|
Martin, You can run h_add on only a specific selection. h_add (selectAtoms) like # protonate the solvent/waters h_add solvent # protonate residue 10 h_add resi 10 Cheers, -- Jason On Tue, Sep 21, 2010 at 9:17 AM, Martin Hediger <ma...@bl...> wrote: > I'm sorry, this is a bit confusing: Say the peptide looks like this: > N-Ala-Ala-Ala-C=O. The problem arises with the hydrogen that finishes of the > carbonyl group (of the potential peptide bond) of the last Ala, so the > hydrogen on C=O. > > > > > > > Wonderful. I'm close to completing what I need, thanks a lot. > > I have one other question here. Say I have a peptide: > N-Ala-Ala-Glu-COO (I'm just pointing out the terminal amide and carbonyl > groups). Then I protonate it with h_add > H2N-Ala-Ala-Glu-(C=O)H. Now I carry out a mutation on the last position with > the mutagenesis wizard to His. After this, the H's on the C=O is missing: > H2N-Ala-Ala-His-(C=O). > > This is a bit unfortunate, because it would screw up the protonation of the > whole system if I reissue h_add on the whole system after a mutation. Is it > possible to fix atoms on only a selection, e.g. the site picked to mutate? > > Thanks for any advise on this. > > Martin > > > > > > > > > > > Am 20.09.10 16:59, schrieb Jason Vertrees: >> >> Hi Martin, >> >>> atoms within less than VdW distance. Is there an easy, very low-level, >>> PyMOL >>> way of fixing this? Can the sculpting wizard be used for this? >> >> Yes, after you place the sidechain and have the new structure (via the >> "apply" function) you can then apply sculpting. It would look >> something like this: >> >> # pause the UI >> cmd.set("suspend_updates",1) >> >> # reset the sphere scale >> cmd.set("sphere_scale","1.0") >> >> # go back to frame 1 (if you changed it) >> cmd.frame(1) >> >> # enable sculpting >> cmd.set("sculpting",1) >> >> # sculpt for 100 cycles >> cmd.sculpt_activate("myProtein") >> cmd.set("sculpting_cycles",100) >> >> # resume the UI >> cmd.set("suspend_updates",0) >> >> # write coords >> cmd.sculpt_iterate("myProtein") >> >> #quit sculpting >> cmd.unset("sculpting") >> >> >> Load a small protein and call it "myProtein". Then, copy/paste the >> above code into PyMOL to see what happens. >> >> Cheers, >> >> -- Jason >> >> >> >> On Mon, Sep 20, 2010 at 5:35 AM, Martin Hediger<ma...@bl...> wrote: >>> >>> Dear All >>> Just one little thing, say I obtain a couple of rotamers by mutating a >>> sidechain. It happens that some of them are sterically not favourable, >>> i.e. >>> atoms within less than VdW distance. Is there an easy, very low-level, >>> PyMOL >>> way of fixing this? Can the sculpting wizard be used for this? >>> >>> Thanks a lot for any suggestions. >>> >>> Martin >>> >>> >>> >>> >>> >>> >>> >>> Am 19.09.10 19:00, schrieb Jason Vertrees: >>>> >>>> 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...@bl...> >>>> 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...@bl...> >>>>>> 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...@bl...> >>>>>>>> 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...@bl...> >>>>>>>>>> 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...@bl...> >>>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>>>> Info Page: >>>>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>>>> Archives: >>>>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>>>>>> 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 (PyM...@li...) >>>>>>>>>>>>> Info Page: >>>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/pymol-users >>>>>>>>>>>>> Archives: >>>>>>>>>>>>> http://www.mail-archive.com/pym...@li... >>>>>>>>>>>>> >>>> >>> >> >> > > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jas...@sc... (o) +1 (603) 374-7120 |