Thanks Peter,
In case others care, this is what I came up with:
def get_residue_colors( sele ):
pymol.stored.colors = []
cmd.iterate( sele, "stored.colors.append( (chain, resi, name, color))")
res_colors = {}
for chain, resi, name, color in pymol.stored.colors:
if name == 'CA': # c-alpha atom
res_colors[(chain, resi)] = cmd.get_color_tuple(color)
return res_colors
On Wed, Jun 3, 2009 at 12:48 PM, Pete Meyer <pame...@mcw.edu> wrote:
> The way I use (which I'm sure could be improved), is to get the color
> index with "iterate sele, print color", followed by "print
> cmd.get_color_index( idx )". This gives you the rgb tuple for the color
> on 0-1 scale.
>
> I'd be curious to know if there's a way to avoid the iterate step, or
> get the color name (instead of index or rgb values), but haven't had the
> time to dig into it.
>
> Pete
>
> Matthew O'Meara wrote:
> > Hi
> > Is there a way I can get the color of a given atom?
> >
> > eg if I do
> >
> > cmd.color( color, sele )
> >
> > is there a function like
> >
> > gotten_color = cmd.get_color_of_selection( sele )
> >
> > so that something like
> >
> > assert( gotten_color == color )
> >
> >
> >
> > or atleast a function to get the color a given atom?
> >
> >
> > Many thanks,
> > Matt
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> ------------------------------------------------------------------------------
> > OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> > looking to deploy the next generation of Solaris that includes the latest
> > innovations from Sun and the OpenSource community. Download a copy and
> > enjoy capabilities such as Networking, Storage and Virtualization.
> > Go to: http://p.sf.net/sfu/opensolaris-get
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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
>
>
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
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