Chimera Commands Index

setattr ( a | r | m | b | p | g ) attr_name attr_value atom-spec

~setattr ( a | r | m | b | p | g ) attr_name atom-spec

Setattr sets an attribute (existing or new) to a specified single value. The attribute may remain multi-valued, however, as the assignment may affect only a subset of the atoms (or residues, etc.) with the attribute. To assign multiple values simultaneously, use defattr.

Although setattr does not contain restrictions on which attributes can be affected, it may not make sense to change certain attributes. It is possible, however, to set an attribute that is also used in the atom-spec because the specification will be evaluated before the attribute value is changed.

The attribute level can specified as:

The attribute name (attr_name) can be existing or new. It should be an alphanumeric string without spaces; it can include underscores, but cannot begin with a digit, underscore, or capital letter. An attribute with attr_name ending in color (case-independent) will be interpreted as a color-valued attribute.

If the attribute already exists, attr_value should be of the appropriate type. Allowed attribute types:

~Setattr sets the value to None (no value), if possible. Certain attributes (for example, atom radius) and attribute types (for example, strings) cannot have no value. String-valued attributes such as atom label should be set to an empty string with "" instead.


setattr a label "pick me!" element.S
- label all sulfur atoms with the text pick me!
setattr r isHelix false :30-45.a
- remove any helix assignment from residues 30-45 in chain A (without changing the structure itself)
setattr p color hot pink ions za<5
- color pseudobonds between atoms within 5 Å of ions hot pink
setattr g lineWidth 3
- use linewidth 3 for all pseudobond groups

See also: defattr, the Selection Inspector, the molecule model attributes panel, the pseudobond group attributes panel