SBVisualPresetStep#

This class is a base class for visual presets.

A visual preset gets several arguments depending on the constructor:

  • A selection: a Node Specification Language (NSL) expression and an arbitrary name for the selection which will be used for naming the visual model if one should be created.

  • A visual model: a name of the visual model or a name of the visual model class and a UUID of its extension.

  • A color scheme: a name of the color scheme or a name of the color scheme class and a UUID of its extension.

  • A color (SBColor) for a constant color scheme or a color palette (SBPalette) for a per-attribute color scheme.

  • A boolean flag indicating whether structural nodes corresponding to the selection should be hidden or shown.

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

# create a visual preset
visualPresetStep = SBVisualPresetStep(
    # selection
    selectionFilterString = "n.c receptor", selectionFilterName = "Receptor",
    # visual model: Ribbons
    visualModelName = "Ribbons",
    # color scheme
    colorSchemeName = "Constant",
    color = SBColor.white,
    # hiding structural nodes
    hideStructureFlag = False)

# apply the visual preset
visualPresetStep.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: SBDVisualPresetStep

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

Bases: pybind11_object

This class describes a visual preset step.

Overloaded function.

  1. __init__(self: samson.SBVisualPresetStep) -> None

Default constructor

  1. __init__(self: samson.SBVisualPresetStep, selectionFilterString: str, selectionFilterName: str, visualModelName: str = ‘’, actions: list[samson.SBUUID] = []) -> None

Constructs a visual preset step based on the given parameters.

Parameters:
  • selectionFilterString (str) – A selection filter - Node Specification Language (NSL) expression string (SAMSON API: Node Specification Language)

  • selectionFilterName (str) – A selection filter name

  • visualModelName (str, default='') – A visual model name. If empty, then no visual model will be applied.

  • actions (list of SBUUID, default=[]) – A list of UUIDs of actions that should be applied to the ‘selected’ nodes

Examples

Create a visual preset step for receptors depicted as ribbons

>>> visualPreset = SBVisualPresetStep(selectionFilterString = "n.c receptor", selectionFilterName = "Receptor", visualModelName = "Ribbons")
  1. __init__(self: samson.SBVisualPresetStep, selectionFilterString: str, selectionFilterName: str, visualModelClassName: str, visualModelExtensionUUID: samson.SBUUID, actions: list[samson.SBUUID] = []) -> None

Constructs a visual preset step based on the given parameters.

Parameters:
  • selectionFilterString (str) – A selection filter - Node Specification Language (NSL) expression string (SAMSON API: Node Specification Language)

  • selectionFilterName (str) – A selection filter name

  • visualModelClassName (str) – A visual model class name

  • visualModelExtensionUUID (samson.SBUUID) – A visual model extension UUID

  • actions (list of SBUUID, default=[]) – A list of UUIDs of actions that should be applied to the ‘selected’ nodes

  1. __init__(self: samson.SBVisualPresetStep, selectionFilterString: str, selectionFilterName: str, visualModelName: str, colorSchemeName: str, color: samson.SBColor, actions: list[samson.SBUUID] = []) -> None

Constructs a visual preset step based on the given parameters.

Parameters:
  • selectionFilterString (str) – A selection filter - Node Specification Language (NSL) expression string (SAMSON API: Node Specification Language)

  • selectionFilterName (str) – A selection filter name

  • visualModelName (str) – A visual model name

  • colorSchemeName (str) – A name of a constant color scheme: Constant, ConstantIllustrate, CPK

  • color (samson.SBColor) – A color for the color scheme

  • actions (list of SBUUID, default=[]) – A list of UUIDs of actions that should be applied to the ‘selected’ nodes

Examples

Create a visual preset step for receptors depicted as van der Waals

>>> visualPreset = SBVisualPresetStep(selectionFilterString = "n.c receptor", selectionFilterName = "Receptor", visualModelName = "Van der Waals", colorSchemeName = "Constant", color = SBColor(255, 255, 255))
  1. __init__(self: samson.SBVisualPresetStep, selectionFilterString: str, selectionFilterName: str, visualModelClassName: str, visualModelExtensionUUID: samson.SBUUID, colorSchemeClassName: str, colorSchemeExtensionUUID: samson.SBUUID, color: samson.SBColor, actions: list[samson.SBUUID] = []) -> None

Constructs a visual preset step based on the given parameters.

Parameters:
  • selectionFilterString (str) – A selection filter - Node Specification Language (NSL) expression string (SAMSON API: Node Specification Language)

  • selectionFilterName (str) – A selection filter name

  • visualModelClassName (str) – A visual model class name

  • visualModelExtensionUUID (samson.SBUUID) – A visual model extension UUID

  • colorSchemeClassName (str) – A class name of a constant color scheme: SBColorSchemeConstant, SBColorSchemeConstantIllustrate, SBColorSchemeCPK

  • colorSchemeExtensionUUID (samson.SBUUID) – A color scheme extension UUID

  • color (samson.SBColor) – A color for the color scheme

  • actions (list of SBUUID, default=[]) – A list of UUIDs of actions that should be applied to the ‘selected’ nodes

  1. __init__(self: samson.SBVisualPresetStep, selectionFilterString: str, selectionFilterName: str, visualModelName: str, colorSchemeName: str, colorPalette: samson.SBPalette = None, actions: list[samson.SBUUID] = []) -> None

Constructs a visual preset step based on the given parameters.

Parameters:
  • selectionFilterString (str) – A selection filter - Node Specification Language (NSL) expression string (SAMSON API: Node Specification Language)

  • selectionFilterName (str) – A selection filter name

  • visualModelName (str) – A visual model name

  • colorSchemeName (str) – A name of a color scheme that uses a color palette (e.g. PerChainIllustrate, PerFormalCharge, etc.)

  • colorPalette (samson.SBPalette, default=None) – A color palette for the color scheme. If None, then the default color palette associated with this color scheme will be used.

  • actions (list of SBUUID, default=[]) – A list of UUIDs of actions that should be applied to the ‘selected’ nodes

Examples

Create a visual preset step for receptors depicted as ribbons

>>> visualPreset = SBVisualPresetStep(selectionFilterString = "n.c receptor", selectionFilterName = "Receptor", visualModelName = "Ribbons", colorSchemeName = "Secondary structure type", colorPalette = SBPaletteDefaultPalette.qualitativeHCLDynamic)
  1. __init__(self: samson.SBVisualPresetStep, selectionFilterString: str, selectionFilterName: str, visualModelClassName: str, visualModelExtensionUUID: samson.SBUUID, colorSchemeClassName: str, colorSchemeExtensionUUID: samson.SBUUID, colorPalette: samson.SBPalette = None, actions: list[samson.SBUUID] = []) -> None

Constructs a visual preset step based on the given parameters.

Parameters:
  • selectionFilterString (str) – A selection filter - Node Specification Language (NSL) expression string (SAMSON API: Node Specification Language)

  • selectionFilterName (str) – A selection filter name

  • visualModelClassName (str) – A visual model class name

  • visualModelExtensionUUID (samson.SBUUID) – A visual model extension UUID

  • colorSchemeClassName (str) – A class name of a color scheme that uses a color palette (e.g. SBColorSchemePerChainIllustrate, SBColorSchemePerFormalCharge, etc.)

  • colorSchemeExtensionUUID (samson.SBUUID) – A color scheme extension UUID

  • colorPalette (samson.SBPalette, default=None) – A color palette for the color scheme. If None, then the default color palette associated with this color scheme will be used.

  • actions (list of SBUUID, default=[]) – A list of UUIDs of actions that should be applied to the ‘selected’ nodes

addActionUUID(self: samson.SBVisualPresetStep, actionUUID: samson.SBUUID) bool#

Adds an UUID of an action to the action UUIDs list. Returns whether actionUUID has been added to the list. If this action UUID is already present in this visual preset step then it does nothing.

Parameters:

actionUUID (SBUUID) – A UUID of an SBAction

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

Applies the visual preset step 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 step should be applied

  • preferredFolder (samson.SBFolder, default=None) – A folder for the created visual models. If None, then the visual model will be added to the active document.

clearColor(self: samson.SBVisualPresetStep) None#

Clears the color

clearColorScheme(self: samson.SBVisualPresetStep) None#

Clears the color scheme

clearSelectionFilter(self: samson.SBVisualPresetStep) None#

Clears the selection filter

clearSelector(self: samson.SBVisualPresetStep) None#

Clears the selector

clearVisualModel(self: samson.SBVisualPresetStep) None#

Clears the visual model

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

Returns a copy of the visual preset step

static createColorScheme(colorSchemeClassName: str, nodeIndexer: samson.SBNodeIndexer, colorPalette: samson.SBPalette) samson.SBNodeColorScheme#

Creates a color scheme colorSchemeClassName

getActionUUIDs(self: samson.SBVisualPresetStep) list[samson.SBUUID]#

Returns a vector of UUIDs of actions that should be applied to the ‘selected’ nodes

getColor(self: samson.SBVisualPresetStep) samson.SBColor#

Returns the color

getColorSchemeProxy(self: samson.SBVisualPresetStep) samson.SBProxy#

Returns a proxy to the color scheme

static getColorSchemeProxyFromPublicName(publicName: str) samson.SBProxy#

Returns a proxy that corresponds to a color scheme with the public name publicName

getDefaultColorPaletteForCurrentColorScheme(self: samson.SBVisualPresetStep) samson.SBPalette#

Returns the default color palette of the color scheme

getPalette(self: samson.SBVisualPresetStep) samson.SBPalette#

Returns the color palette

getSelectorProxy(self: samson.SBVisualPresetStep) samson.SBProxy#

Returns a proxy to the selector

getVisualModelProxy(self: samson.SBVisualPresetStep) samson.SBProxy#

Returns a proxy to the visual model

static getVisualModelProxyFromPublicName(publicName: str) samson.SBProxy#

Returns a proxy that corresponds to a visual model with the public name publicName

static isPerAttributeColorScheme(colorSchemeClassName: str) bool#

Returns True if the color scheme colorSchemeClassName is a per-attribute color scheme

removeActionUUID(self: samson.SBVisualPresetStep, actionUUID: samson.SBUUID) None#

Removes an UUID of an action from the action UUIDs list.

Parameters:

actionUUID (SBUUID) – A UUID of an SBAction

resetPalette(self: samson.SBVisualPresetStep) None#

Sets the color palette to the default color palette for this color scheme

setActionUUIDs(self: samson.SBVisualPresetStep, actionUUIDs: list[samson.SBUUID]) None#

Sets UUIDs of actions that should be applied to the ‘selected’ nodes.

Parameters:

actionUUIDs (list of SBUUID) – A list of UUIDs of actions (SBAction)

setColor(self: samson.SBVisualPresetStep, color: samson.SBColor) None#

Sets the color

setColorSchemeProxy(self: samson.SBVisualPresetStep, colorSchemeProxy: samson.SBProxy) None#

Sets the color scheme by proxy

setPalette(self: samson.SBVisualPresetStep, colorPalette: samson.SBPalette) None#

Sets the color palette

setSelectionFilter(self: samson.SBVisualPresetStep, arg0: str, arg1: str) None#

Sets the selection filter string and name

setSelectorProxy(self: samson.SBVisualPresetStep, selectorProxy: samson.SBProxy) None#

Sets the selector by proxy

setVisualModelProxy(self: samson.SBVisualPresetStep, visualModelProxy: samson.SBProxy) None#

Sets the visual model by proxy

property colorSchemeClassName#

Returns the color scheme’s class name

property colorSchemeExtensionUUID#

Returns the color scheme’s extension UUID

property hasColor#

Returns True if the visual preset step has a color

property hasColorScheme#

Returns True if the visual preset step has a color scheme

property hasDefaultPalette#

Returns True if the color scheme has a default color palette

property hasSelector#

Returns True if the visual preset step has a selector

property hasVisualModel#

Returns True if the visual preset step has a visual model

property selectionFilterName#

Returns the selection filter name

property selectionFilterString#

Returns the selection filter string

property selectorClassName#

Returns the selector’s class name

property selectorExtensionUUID#

Returns the selector’s extension UUID

property visualModelClassName#

Returns the visual model’s class name

property visualModelExtensionUUID#

Returns the visual model’s extension UUID