The selection class: handling of sets of atom coordinates

The selection class holds a set of atoms from a model. Such selections can be used to perform actions on only some model atoms.

Selections in MODELLER behave almost identically to standard Python sets - see the section in the Python manual on sets for further information. Selections are ‘sets’ in the mathematical sense, and as such can be combined with each other in unions (using the Python union function, or the | operator) or intersections (using the intersection function, or the & operator), etc.

All of the atoms in a selection must belong to the same model object. Note that the selection is not a copy of the model atoms; if model atoms are changed, the atoms will also be moved in any selection that contains those atoms, and vice versa.

To add objects to a selection, you can list them when you create the selection with the selection() constructor, add them to an existing selection with selection.add(), or combine selections with set operations (see above).

See model.atoms, Sequence.residues, Sequence.chains, model.atom_range(), model.residue_range(), model.get_insertions(), model.get_deletions(), and model.loops() for valid objects (groups of atoms) to add to the selection. You can also add model objects and existing selection objects to a selection. (Adding a residue adds all atoms in that residue to the selection, adding a model adds all atoms in the model, and so on.)

See also Point.select_sphere(), which creates a new selection object.

Once you have a selection, it can be manipulated by standard Python set operations (above), by methods to add new atoms (selection.by_residue(), selection.select_sphere()), or by methods to exclude atom or residue types (selection.only_sidechain(), selection.only_mainchain(), selection.only_atom_types(), selection.only_residue_types(), selection.only_std_residues(), selection.only_no_topology(), selection.only_het_residues(), selection.only_water_residues(), selection.only_defined()).

Automatic builds 2017-02-17