---------- Forwarded message ----------
From: "Andreas Warnecke" <4ndreas.warne...@gmail.com>
Date: Jul 14, 2014 1:03 AM
Subject: Re: [PyMOL] How to show atom index or atom serial when clicking on
an atom?
To: "Jose Borreguero" <borregu...@gmail.com>
Cc:

minor amendment, changin the iterate line to:

cmd.iterate(sele, 'stored.macroname="/%s/%s/%s/%s`%s/%s`%s" %(model, segi,
chain, resn, resi, name, alt)')

will break it down to atom name and alternative (if present).


On Mon, Jul 14, 2014 at 12:54 AM, Andreas Warnecke <
4ndreas.warne...@gmail.com> wrote:

> Hej Jose,
>
> This script may do what you need. The core is to use iterate over the
> different identifiers. I'm not sure if there's a more convenient way,
> though.
>
>
> ################################################################################
> python
> def get_macro_name(sele):
>     '''
>     will return the atom macro name of the first atom in selection
>     accepts non-macro selection style only
>     '''
>     from pymol import stored
>     # name macro
>     try:
>         sele='first (%s)'%sele # reduce sele to one atom
>         stored.macroname=''
>         cmd.iterate(sele, 'stored.macroname="/%s/%s/%s/%s`%s/" %(model,
> segi, chain, resn, resi)')
>         return stored.macroname
>     except:
>         raise Exception(("Invalid selection:\n#####\n"
>             "Error in get_resi_macro_name\n#####"))
> python end
>
> print get_macro_name('resi 1 and name CA') # example
>
> ################################################################################
>
> Hope this helps,
>
> Andreas
>
>
>  On Mon, Jul 14, 2014 at 12:28 AM, Jose Borreguero <borregu...@gmail.com>
> wrote:
>
>>  Dear pymol users,
>>
>> When I click in an atom (mouse->selection mode->atoms) I get the
>> /chain_name/residue_name/atom_name info string. Is there a way to output
>> the atom serial or atom index?
>> My molecule has atoms with duplicate names within the same residue, so
>> the info string chain_name/residue_name/atom_name does not uniquely
>> identify an atom. I need to see the atom index or atom serial.
>>
>> Thanks in advance for your help!
>> -Jose
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>>
>
>
------------------------------------------------------------------------------
_______________________________________________
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