SBVisualPreset#
This class is a base class for visual presets.
# get an indexer of all structural models
structuralModelIndexer = SAMSON.getNodes("n.t sm")
# create a visual preset
visualPresetGroup = SBVisualPresetStep("Receptor-ligand interaction",
[
SBVisualPresetStep(
selectionFilterString = "n.c receptor", selectionFilterName = "Receptor",
visualModelName = "Ribbons",
colorSchemeName = "Constant",
color = SBColor.white),
SBVisualPresetStep(
selectionFilterString = "n.c ligand", selectionFilterName = "Ligand",
visualModelName = "Licorice"),
SBVisualPresetStep(
selectionFilterString = "a.s C in (n.t r within 5A of n.c ligand)",
selectionFilterName = "Carbons in residues with at least one atom within 5A of ligands",
visualModelName = "",
colorSchemeName = "Constant",
color = SBColor.white),
SBVisualPresetStep(
selectionFilterString = "n.c heavyAtomsWithLinkingBonds in (n.t r within 5A of n.c ligand)",
selectionFilterName = "Residues (heavy atoms) with at least one atom within 5A of ligands",
visualModelName = "Licorice"),
SBVisualPresetStep(
selectionFilterString = "n.c water",
selectionFilterName = "Water",
hideStructureFlag = True),
SBVisualPresetStep(
selectionFilterString = "a.s O in n.c water",
selectionFilterName = "Water oxygen",
visualModelName = "Licorice"),
SBVisualPresetStep(
selectionFilterString = "n.c monatomicIon",
selectionFilterName = "Monatomic ions",
visualModelName = "Van der Waals")
]
)
# apply the visual preset
visualPresetGroup.apply(structuralModelIndexer)
Please refer to the Applying visual presets page for more information on how to create and apply visual presets.
See also
SAMSON SDK: SBDVisualPreset
- class samson.SBVisualPreset(*args, **kwargs)#
Bases:
pybind11_object
This class describes a visual preset.
Overloaded function.
__init__(self: samson.SBVisualPreset, name: str, visualPresetSteps: list[samson.SBVisualPresetStep] = []) -> None
Constructs a visual preset with the given name and provided visual preset steps.
- Parameters:
name (str) – A name for the visual preset
visualPresetSteps (list of samson.SBVisualPresetStep objects) – A list of visual preset steps
__init__(self: samson.SBVisualPreset, visualPreset: samson.SBVisualPreset) -> None
Constructs a visual preset based on the provided visual preset.
- Parameters:
visualPreset (samson.SBVisualPreset) – Another visual preset
- addVisualPresetStep(self: samson.SBVisualPreset, visualPresetStep: samson.SBVisualPresetStep) None #
Adds a clone of the visual preset step visualPresetStep to the visual preset.
- Parameters:
visualPresetStep (samson.SBVisualPresetStep) – A visual preset step to be added to the visual preset. A clone of the visual preset step is added to the visual preset, since it takes ownership of the visual preset step.
- apply(self: samson.SBVisualPreset, nodeIndexer: samson.SBNodeIndexer, preferredFolder: samson.SBFolder = None) None #
Applies the visual preset to nodes in nodeIndexer and adds node groups and visual models (if any) to preferredFolder.
- Parameters:
nodeIndexer (samson.SBNodeIndexer) – An indexer of nodes to which the visual preset should be applied
preferredFolder (samson.SBFolder) – A folder for the created visual models. If None, then a folder will be created based on the visual preset name and it will be added to the active document.
- clone(self: samson.SBVisualPreset) samson.SBVisualPreset #
Returns a copy of the visual preset
- deleteVisualPresetStep(self: samson.SBVisualPreset, index: int) None #
Deletes the visual preset with index index from the visual preset.
- Parameters:
index (int) – An index of a visual preset step to be removed from the visual preset.
- static getDefaultVisualPresets() list[samson.SBVisualPreset] #
Returns a list of the default visual presets
- getNumberOfVisualPresetSteps(self: samson.SBVisualPreset) int #
Returns the number of visual preset steps
- getVisualPresetSteps(self: samson.SBVisualPreset) list[samson.SBVisualPresetStep] #
Returns a list of visual preset steps
- swap(self: samson.SBVisualPreset, i: int, j: int) None #
Swaps visual preset steps i and j.
- Parameters:
i (int) – An index of a visual preset step.
j (int) – An index of a visual preset step.
- property name#
The name of the visual preset