moleculekit.representations module#
- class moleculekit.representations.Representations(mol)#
Bases:
objectClass that stores representations for Molecule.
- Parameters:
mol (
Molecule) – The Molecule object for which the representations are stored.
Examples
>>> from moleculekit.molecule import Molecule >>> mol = tryp.copy() >>> mol.reps.add('protein', 'NewCartoon') >>> print(mol.reps) rep 0: sel='protein', style='NewCartoon', color='Name' >>> mol.view() >>> mol.reps.remove()
- add(sel=None, style=None, color=None, frames=None, opacity=None)#
Adds a new representation for Molecule.
- Parameters:
sel (
str|ndarray|None) – Atom selection (string, boolean mask, or integer index array) for the representation. See more herecolor (
str|int|None) – Coloring mode (str) or ColorID (int). See more here.frames (
list|None) – List of frames to visualize with this representation. If None it will visualize the current frame only.opacity (
float|None) – Opacity of the representation. 0 is fully transparent and 1 is fully opaque.
- append(reps)#
Append the representations of another Representations object.
- Parameters:
reps (
Representations) – The Representations object whose representations will be appended to this one.- Raises:
RuntimeError – If reps is not a Representations object.
- list()#
Print all currently stored representations.
Prints, for each representation, its index, atom selection, style and color. Equivalent to printing the Representations object directly.