biomol.core.View.select#

View.select(**kwargs)[source]#

Return a new view filtered by feature values.

This method allows filtering based on both node and edge features. Each keyword argument corresponds to a feature name and its desired value(s).

Parameters:

**kwargs (Any) – Feature names and values to filter by.

Return type:

Self

Notes

Node Feature Selection
  • Filtering is applied only to the elements within the current view.

  • Only elements that match the criteria are retained.

Edge Feature Selection
  • Filtering is applied to edges within the current view.

  • However, all edges in the entire molecule are considered during matching.

  • It then returns the elements from the current view that participate in any matching edges.

  • This allows selecting nodes based on their interactions with elements outside the current view.

Value Matching
  • Single value → the feature must match exactly.

  • Sequence (list, tuple, set, or ndarray) → the feature can match any value in the sequence.

Examples

Select atoms with name CA and residue id 10 from an atom_view

selected_atoms = atom_view.select(name='CA', id=10)

Select residues with name ALA or GLY from a residue_view

selected_residues = residue_view.select(name=['ALA', 'GLY'])

Select atoms from chain_view that form disulfide bonds.

selected_atoms = chain_view.select(bond="disulfide")