ChimeraX docs icon

Attribute Assignment Files

Attribute assignment files are simple user- or program-generated text files that can be read using the open command to create attributes and assign their values to atomic structures in ChimeraX. The format can be indicated with filename suffix .defattr or the open command option format defattr. It is the same format as used by Chimera, although the atom specification strings within may differ.

Several example files are provided. Existing attributes can be saved in this format by using the save command or the general file-saving dialog shown with File... Save in the main menu or the Save File button in Render/Select by Attribute.

Example commands showing how such a file could be used:

open 1pho
open  kdHydrophobicity.defattr
color byattribute kdHydrophobicity palette ^RdYlBu
select ::kdHydrophobicity>2.0

File Format

A hash symbol # at the beginning of a line indicates a comment. Basic properties of an attribute are described in control lines of the form:

identifier: value
Possible control line contents:
identifier value description
attribute
(required)
alphanumeric string without spaces; can include underscores; cannot begin with a digit attribute name, existing or new
match mode
(optional)
any (default)
non-zero
1-to-1
expected matches per assignment line (an error message will be sent to the Log when a line's match behavior differs from the match mode)
recipient
(optional)
atoms (default)
residues
chains
structures
bonds
pseudobonds
level of attribute assignment
none handling
(optional)
None (default)
string
delete
treatment of values given as none or None: as the Python value None, as a string, or as removal of any assignment of that attribute from the specified item
Either structures or molecules (for backwards compatibility with Chimera files) can be used to indicate an attribute of atomic models.

The attribute assignments are described in assignment lines of the form:

(Tab)atom-spec(Tab)attr-value
Any kind of atom specification can be used.

Control lines and comments can be interspersed with assignment lines, except that the attribute control line should precede all assignment lines for the corresponding attribute.

Allowed attr-value types are:

  • integer
  • boolean (true or false, case-independent)
  • color – an attribute whose name ends with color (case-independent) will be interpreted as a color-valued attribute. Colors can be specified in the same ways as in commands.
  • string – a string of any characters except tabs; values that might be interpreted as one of the other types should be enclosed in quotation marks

    Example Files

    A simple text format is used for attribute assignment. These files can be opened with the open command to assign the corresponding attributes.


    UCSF Resource for Biocomputing, Visualization, and Informatics / September 2024