SBVisualPresetGroup#

This class is a base class for visual preset groups.

Create and apply a visual preset group#
# get an indexer of all structural models
structuralModelIndexer = SAMSON.getNodes("n.t sm")

# create a visual preset
visualPresetGroup = SBVisualPresetGroup("Receptor-ligand interaction",
  [
    SBVisualPreset(
      selectionFilterString = "n.c receptor", selectionFilterName = "Receptor",
      visualModelName = "Ribbons",
      colorSchemeName = "Constant",
      color = SBColor.white),
    SBVisualPreset(
      selectionFilterString = "n.c ligand", selectionFilterName = "Ligand",
      visualModelName = "Licorice"),
    SBVisualPreset(
      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),
    SBVisualPreset(
      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"),
    SBVisualPreset(
      selectionFilterString = "n.c water",
      selectionFilterName = "Water",
      hideStructureFlag = True),
    SBVisualPreset(
      selectionFilterString = "a.s O in n.c water",
      selectionFilterName = "Water oxygen",
      visualModelName = "Licorice"),
    SBVisualPreset(
      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: SBDVisualPresetGroup

class samson.SBVisualPresetGroup(*args, **kwargs)#

Bases: pybind11_object

This class is a base class for visual preset group.

Overloaded function.

  1. __init__(self: samson.SBVisualPresetGroup, name: str, visualPresets: list[samson.SBVisualPreset] = None) -> None

Constructs a visual preset group with the given name and provided visual preset.

Parameters:
  • name (str) – A name for the visual preset group

  • visualPresets (list of samson.SBVisualPreset objects) – A list of visual presets

  1. __init__(self: samson.SBVisualPresetGroup, visualPresetGroup: samson.SBVisualPresetGroup) -> None

Constructs a visual preset group based on the provided visual preset group.

Parameters:

visualPresetGroup (samson.SBVisualPresetGroup) – Another visual preset group

addVisualPreset(self: samson.SBVisualPresetGroup, visualPreset: samson.SBVisualPreset) bool#

Adds a clone of the visual preset visualPreset to this group.

Parameters:

visualPreset (samson.SBVisualPreset) – A visual preset to be added to the group. A clone of the visual preset is added to the visual preset group, since the group takes ownership of the visual preset.

apply(self: samson.SBVisualPresetGroup, nodeIndexer: samson.SBNodeIndexer, preferredFolder: samson.SBFolder = None) None#

Applies the visual preset group to nodes in nodeIndexer and adds the visual models (if any) to preferredFolder.

Parameters:
  • nodeIndexer (samson.SBNodeIndexer) – An indexer of nodes to which the visual preset group 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 group name and it will be added to the active document.

clone(self: samson.SBVisualPresetGroup) samson.SBVisualPresetGroup#

Returns a copy of the visual preset group

deleteVisualPreset(*args, **kwargs)#

Overloaded function.

  1. deleteVisualPreset(self: samson.SBVisualPresetGroup, index: int) -> None

Deletes the visual preset with index index from the visual preset group.

Parameters:

index (int) – An index of a visual preset to be removed from the group.

  1. deleteVisualPreset(self: samson.SBVisualPresetGroup, visualPreset: samson.SBVisualPreset) -> None

Removes the visual preset visualPreset from the visual preset group if it has any, and, if found, deletes the visual preset visualPreset.

Parameters:

visualPreset (samson.SBVisualPreset) – A visual preset to be removed from the group.

static getDefaultVisualPresetGroups() list[samson.SBVisualPresetGroup]#

Returns a vector of the default visual preset groups

property name#

The name of the visual preset group