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. 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.

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
molecules
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

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


    UCSF Resource for Biocomputing, Visualization, and Informatics / November 2020