[Chimera-users] Volume surface colors

Thomas Goddard goddard at cgl.ucsf.edu
Mon Mar 15 10:25:22 PDT 2010


Hi Will,

   Here's a Python script that will change a volume color:

from chimera import openModels
from VolumeViewer import Volume
for v in openModels.list(modelTypes=[Volume]):
     v.set_parameters(surface_colors = [(1.0, 0.0, 0.0, 1.0)])
     v.show()

You can do the same thing more easily with a Chimera command and you can 
put such commands in a file (suffix .cmd) for Chimera to execute (by 
opening the file).

	volume # color plum

This colors all volume models as plum color.  If you wanted a specific 
model you would use for example #2 instead of #.  The notation # means 
all models.

You could also run this Chimera command from Python.

from chimera import runCommand
runCommand("volume # color plum")


	Tom



> Hi,
>
> I'm trying to write a script to change the surface colors of volumes in
> Chimera:
>
> This is what I have so far.
>
> for m in chimera.openModels.list():
> print m.surface_colors
> m.surface_colors = [(1.0, 0.0, 0.0, 1.0)]
> print m.surface_colors
>
> This seems to alter the surface colors, but has no effect on what the
> maps look like in the UI.
> Do I need to call something else for the UI to be updated, or am I using
> the wrong approach entirely?
>
> Also, I would like to only select the volumes in the first line but I
> don't know what modelTypes this is:
> for m in chimera.openModels.list(modelTypes=[chimera.Molecule]):
>
> Many thanks,
>
> Will.
>
>
>
> William Moore
> Wellcome Trust Centre for Gene Regulation & Expression
> College of Life Sciences
> MSI/WTB/JBC Complex
> University of Dundee
> Dow Street
> Dundee DD1 5EH
> United Kingdom
>
> Phone 01382 386364
> http://openmicroscopy.org.uk
>



More information about the Chimera-users mailing list