Skip to main content

Function: selectAtoms()

selectAtoms(structure, options): ParsedStructure

Defined in: src/mobjects/molecular/selection.ts:245

Select a subset of a parsed structure.

Builds a candidate list of atoms plus (when includeHetatms, the default) hetatms. It keeps a candidate when every provided filter accepts it, then inverts the result when invert is set. The returned structure is fresh and the input is not mutated.

Bonds: kept only when both endpoints survive, with from / to re-numbered into the new combined space (kept atoms first, then kept hetatms).

Residues: a residue is kept when a kept atom shares its chain and resSeq. For a residue with no resSeq, it is kept when its CA position coincides with a kept atom's position.

Degenerate input: an empty selection returns an empty but valid structure and does not throw. A proximity filter (nearPoint / nearLigand) with a radius <= 0 selects nothing.

Parameters​

structure​

ParsedStructure

The structure to filter.

options​

AtomSelectionOptions

The selection filters.

Returns​

ParsedStructure

A new ParsedStructure with the selected atoms, hetatms, re-numbered bonds and kept residues.