
Hi Artem, It's perfectly on topic: a question about ChimeraX. :-) Color by attribute is a mapping of numerical quantities to a series of colors (with interpolation), so yes, it only works with numerical attributes. <https://rbvi.ucsf.edu/chimerax/docs/user/commands/color.html#byattribute> ..."Atomic models can be colored to show the values of numerical attributes." You can assign your own custom attributes to chains or to whole atomic models if you want, e.g. with attribute definition input files or a series of "setattr" commands. You could use one of these methods to define your own custom attribute of the numerical type, if you wanted to use it with "color byattribute" (or the Render by Attribute GUI). <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html> <https://rbvi.ucsf.edu/chimerax/docs/user/formats/defattr.html> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/setattr.html> With menu: Select... By Attribute Value... you can select by other types of attributes (non-numerical) but it would require several steps to repeatedly select the value you want, then color the selection with Actions menu or color command, then select the next value, then color that selection, etc. It's not going to automatically color the whole set with the different colors in a palette. If you want to do that you would need to go the numerical route. <https://rbvi.ucsf.edu/chimerax/docs/user/tools/render.html#select> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Resource for Biocomputing, Visualization, and Informatics Department of Pharmaceutical Chemistry University of California, San Francisco
On May 27, 2024, at 12:10 PM, Artie Kushner via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
I apologize in advance if this is off topic. I heard that people use chimerax mailing list to share tips and ask for help and saw some archives online that came in handy.
I'm wondering if it's possible to set an attribute on the whole atomic chain (for future byattribute coloring) the way it is done in the example with Atom/Residue ? (https://rbvi.github.io/chimerax-recipes/helixmlp/helixmlp.html)
I'm trying something similar in my script: ``` from chimerax.core.commands import run from chimerax.atomic import Residue, Atom, Chain # the regular Cmd setup.. c:Chain polyclass:str = ... input from external spruce c.polymer_class = polyclass Chain.register_attr(session, 'polymer_class', 'Polymer Class', attr_type = str) ```
But when i run `color byattribute polymer_class /6 palette lipophilicity` it's not getting picked up: `No known/registered numeric attribute polymer_class`. Maybe it's not possible to color by string attributes?
Thanks a lot for your advice Artem