Hi All,

probably a question for the developers, but may not hurt to ask publicly: Is 
there a functionality in Pymol to list the residues in a given selection? I am 
looking for the equivalent to the get_chains() function. I have scripted 
something up, but the code is not 100% clean and not flexible enough. For large 
molecules the performance is not great either.


#### start script
def list_resi(obj=""):
    """
DESCRIPTION

    "list_resi" prints and returns the unique residue IDs from the input
                object. The object must be present in the object list
                on the GUI. Selections are currently not implemented.
                Chain or Segments are also not taken into account
USAGE

                list_resi obj

EXAMPLES

    list_resi my_prot

    l = list_resi(my_prot)
    """

    if ( obj == "" ):
        obj="(all)"

    ol = cmd.get_object_list()
    if (obj in ol):
        pass
    else:
        print "Error: Object (%s) not found" % obj
        return

    stored.resi_list = []
    cmd.iterate(obj,"stored.resi_list.append(int(resi))")
    stored.resi_list=list(set(stored.resi_list))          # make list unique
    stored.resi_list.sort()

    for i in range(0,len(stored.resi_list)):
        print "%s," % stored.resi_list[i],
        if ((i+1) % 10 == 0):
            print ""

    return stored.resi_list

##### End Script

Thanks for any input


                Carsten
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
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