Reputation: 41
Can I ask if Pymol allows users to set atom color by user defined value ? for example, I want to color all atoms by their biochemical features, the feather is considered to be RGB value, say [R G B] is equals to [feature1 feature2 feature3], how can I do this in Pymol ?
In addtion, if I already color the atoms, can I get the color value ? I tried to use cmd.getcolor(), but the value it returns is not recognized as RGB color, is there any other function in Pymol I can call to get atom color ?
Upvotes: 2
Views: 6010
Reputation: 4532
Please refer to pymolwiki page Color and Set Color.
First, define a set of colors using your features (remember to normalize your feature values to scale [0,1], or [0, 255]):
set_color mycol1, [feature1R, feature1G, feature1B]
set_color mycol2, [feature2R, feature2G, feature2B]
...
Then you can color the atoms using the customized colors:
# color all alpha Carbons to mycol1:
color mycol1, n. CA
# color all backbone Nitrogens to mycol2:
color mycol1, n. N
To get atom color, refer to "Getting Atom Colors".
Suppose you have an atom named youratom
and you want to get color for it:
atomcolor = []
iterate youratom, atomcolor.append(cmd.get_color_tuple(color))
print atomcolor[0]
atomcolor[0]
is a tuple with RGB values in scale [0,1].
Upvotes: 2