biomol.core.View.with_features#

View.with_features(**features)[source]#

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

Parameters:

**features (NodeFeature | NDArray[Any]) – Key-value pairs of features to update. Values can be either NodeFeature objects or numpy arrays (which will be converted to NodeFeature).

Returns:

Updated BioMol object.

Return type:

mol

Notes

  • Features are updated only for the elements in the current view.

  • Only NodeFeature is supported.

  • Does not modify the current BioMol instance; instead, returns a new one.

Examples

mol = BioMol(...)
coord = mol.atoms.coord
new_mol = mol.atoms[:10].with_features(coord=coord[:10] + 1.0)