Hi Martin,

> iterate first my_res, stored.r = resn

is syntactically correct, but could also be written,

cmd.iterate("first my_res", "stored.r = resn");

The command could be read as, "iterate over just first atom from the
selection called 'my_res' and place the residue name in which that
atom resides into 'stored.r'."  So, "first" is a new-ish selection
modifier that takes just the first atom from a selection.  It's _very_
handy: why iterate through all atoms in a residue to get a residue
name, when just the first will do?  "resn" indeed returns the 3-letter
residue code.

A more efficient way might be:

# select a residue, here #50 (or use the mouse)
select mySelection, i. 50

# get it's one-letter residue id
print string.split(cmd.get_fastastr("mySelection"),'\n')[1]
# get it's three-letter residue id
print three_letter[string.split(cmd.get_fastastr("mySelection"),'\n')[1]]

I just posted this on http://www.pymolwiki.org/index.php/Aa_codes.
(You will need the two dictionaries found there.)

There really should be a much easier way to do that... Maybe someone
has a far easier command?

Cheers,

-- Jason




On Sun, Sep 12, 2010 at 4:25 PM, Martin Hediger <ma....@bluewin.ch> wrote:
>  Hi Jason, thanks for the comprehensive answer.
> One question though, is the line
>
> iterate first my_res, stored.r = resn
>
>
>
> correct this way? Are there no braces or quotation marks needed? Its not
> perfectly clear to me if 'first' and 'my_res' are selections (indicated by
> braces) or objects (name without braces in the main window).
> I understand 'resn' is something like 'GLU', if I want to know how many GLU
> rotamers are in the library.
>
> Thanks again
> Martin
>
>
>
>
> Am 12.09.10 22:00, schrieb Jason Vertrees:
>>
>> Hi Martin,
>>
>> PyMOL first searches the Dunbrack rotamer library for hits based upon
>> the amino acid type and it's original phi/psi angles.  If it cannot
>> find a hit, it will then look for backbone independent positions.  To
>> get the number of available rotamers given a residue, you need to
>> unpickle the library, create the lookup key into the library and then
>> count the results.  It might look something like this:
>>
>> # unpickle the library
>> import pickle
>> rot_lib =
>> pickle.load(open("$PYMOL_HOME/data/chempy/sidechains/sc_bb_dep.pkl",'r'))
>>
>> # get residue name, you need to select the residue
>> # into "my_res"
>> from pymol import stored
>> stored.r = ''
>> iterate first my_res, stored.r = resn
>>
>> # get residue info; prepare dictionary key
>> (phi,psi) = cmd.phi_psi("br. first my_res")
>>
>> # warren also does 20 and 60 in place of 10--three possible lookups
>> key = ( stored.r, int(10*round(phi/10)), int(10*round(psi/10)))
>>
>> if key in rot_lib.keys():
>>   print "This rotamer has %s possible positions" % len(rot_lib[key])
>>
>> Lookups in the independent library are easier--just provide a residue
>> name.
>>
>> Cheers,
>>
>> -- Jason
>>
>>
>> On Sun, Sep 12, 2010 at 11:04 AM, Martin Hediger<ma....@bluewin.ch>
>>  wrote:
>>>
>>>  Dear all, let me rephrase my question in a less confusing way.
>>> For a given mutant, I need a PDB file for every available rotamer. I
>>> guess thats the simplest way of putting it. How can I achieve that?
>>>
>>> Thanks for hints.
>>> Martin
>>>
>>>
>>>
>>>
>>>
>>> Am 12.09.10 00:08, schrieb Martin Hediger:
>>>>
>>>>    Hi all
>>>> I want to do some scripted mutations on a range of residues. Say I want
>>>> to mutate residue 189 to every rotamer of [Asp, His, Glu, Thr, Lys]
>>>> available in the PyMOL internal rotamer library. I'm seeing that PyMOL
>>>> issues cmd.get_wizard().do_state(i) to select rotamer 'i' for a
>>>> mutation. Now, if I want to iterate over all available rotamers, I need
>>>> the limit rotamer number. How can I obtain the maximum number of
>>>> rotamers available for every amino acid?
>>>>
>>>> Thanks for hints on this
>>>>
>>>> Martin
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Start uncovering the many advantages of virtual appliances
>>>> and start using them to simplify application deployment and
>>>> accelerate your shift to cloud computing
>>>> http://p.sf.net/sfu/novell-sfdev2dev
>>>> _______________________________________________
>>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Start uncovering the many advantages of virtual appliances
>>> and start using them to simplify application deployment and
>>> accelerate your shift to cloud computing
>>> http://p.sf.net/sfu/novell-sfdev2dev
>>> _______________________________________________
>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>>
>>
>>
>
>



-- 
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC

(e) jason.vertr...@schrodinger.com
(o) +1 (603) 374-7120

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to