biomol.core.View#

class View(mol, indices)[source]#

Bases: Generic[A_co, R_co, C_co, M_co]

Base class for all views.

This class defines the common interface for all views, including methods for converting between different structural levels, accessing features, and performing set operations.

Parameters:
  • mol (BioMol) – The parent molecule.

  • indices (NDArray[np.integer]) – The indices of the elements in the view.

Attributes

atoms

View of the atoms in the selection.

chains

View of the chains in the selection.

indices

Return the indices of the view.

level

The structural level of the view.

mol

Return the parent molecule.

residues

View of the residues in the selection.

unique_indices

Return the unique indices of the view, preserving first-occurrence order.

Methods

extract

Extract a new BioMol cropped to the current view.

get_container

Return the feature container cropped to the view's indices.

get_feature

Return the feature for the given key, cropped to the view's indices.

is_empty

Return True if the view is empty (contains no elements).

is_subset

Return True if the view is a subset of another view.

new

Return a new view with the specified indices.

select

Return a new view filtered by feature values.

sort

Return a new view with sorted indices.

to_atoms

Return an AtomView of the atoms in the selection.

to_chains

Return a ChainView of the chains in the selection.

to_residues

Return a ResidueView of the residues in the selection.

unique

Return a new view with unique indices, preserving first-occurrence order.

with_features

Modify features in the current view and return an updated BioMol.