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. Existing attributes can be saved in this format. Several example files are provided. 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
alphanumeric string without spaces; can include underscores; cannot begin with a digit attribute name, existing or new
match mode
any (default)
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)
atoms (default)
level of attribute assignment
none handling
None (default)
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:

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. Existing attributes can be saved to this file format.

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