SBVisualPreset#
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.
# get an indexer of all structural models
structuralModelIndexer = SAMSON.getNodes("n.t sm")
# create a visual preset
visualPreset = SBVisualPreset(
# 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
visualPreset.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 is a base class for visual presets.
Overloaded function.
__init__(self: samson.SBVisualPreset) -> None
Default constructor
__init__(self: samson.SBVisualPreset, selectionFilterString: str, selectionFilterName: str, visualModelName: str = ‘’, hideStructureFlag: bool = True) -> None
Constructs a visual preset 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.
hideStructureFlag (bool, default=True) – Whether to hide the structure corresponding to the selection filter
Examples
Create a visual preset for receptors depicted as ribbons
>>> visualPreset = SBVisualPreset(selectionFilterString = "n.c receptor", selectionFilterName = "Receptor", visualModelName = "Ribbons")
__init__(self: samson.SBVisualPreset, selectionFilterString: str, selectionFilterName: str, visualModelClassName: str, visualModelExtensionUUID: samson.SBUUID, hideStructureFlag: bool = True) -> None
Constructs a visual preset 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
hideStructureFlag (bool, default=True) – Whether to hide the structure corresponding to the selection filter
__init__(self: samson.SBVisualPreset, selectionFilterString: str, selectionFilterName: str, visualModelName: str, colorSchemeName: str, color: samson.SBColor, hideStructureFlag: bool = True) -> None
Constructs a visual preset 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
hideStructureFlag (bool, default=True) – Whether to hide the structure corresponding to the selection filter
Examples
Create a visual preset for receptors depicted as van der Waals
>>> visualPreset = SBVisualPreset(selectionFilterString = "n.c receptor", selectionFilterName = "Receptor", visualModelName = "Van der Waals", colorSchemeName = "ConstantIllustrate", color = SBColor(255, 255, 255))
__init__(self: samson.SBVisualPreset, selectionFilterString: str, selectionFilterName: str, visualModelClassName: str, visualModelExtensionUUID: samson.SBUUID, colorSchemeClassName: str, colorSchemeExtensionUUID: samson.SBUUID, color: samson.SBColor, hideStructureFlag: bool = True) -> None
Constructs a visual preset 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: SBDColorSchemeConstant, SBDColorSchemeConstantIllustrate, SBDColorSchemeCPK
colorSchemeExtensionUUID (samson.SBUUID) – A color scheme extension UUID
color (samson.SBColor) – A color for the color scheme
hideStructureFlag (bool, default=True) – Whether to hide the structure corresponding to the selection filter
__init__(self: samson.SBVisualPreset, selectionFilterString: str, selectionFilterName: str, visualModelName: str, colorSchemeName: str, colorPalette: samson.SBPalette = None, hideStructureFlag: bool = True) -> None
Constructs a visual preset 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.
hideStructureFlag (bool, default=True) – Whether to hide the structure corresponding to the selection filter
Examples
Create a visual preset for receptors depicted as ribbons
>>> visualPreset = SBVisualPreset(selectionFilterString = "n.c receptor", selectionFilterName = "Receptor", visualModelName = "Ribbons", colorSchemeName = "PerSecondaryStructureType", colorPalette = SBPaletteDefaultPalette.qualitativeHCLDynamic)
__init__(self: samson.SBVisualPreset, selectionFilterString: str, selectionFilterName: str, visualModelClassName: str, visualModelExtensionUUID: samson.SBUUID, colorSchemeClassName: str, colorSchemeExtensionUUID: samson.SBUUID, colorPalette: samson.SBPalette = None, hideStructureFlag: bool = True) -> None
Constructs a visual preset 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. SBDColorSchemePerChainIllustrate, SBDColorSchemePerFormalCharge, 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.
hideStructureFlag (bool, default=True) – Whether to hide the structure corresponding to the selection filter
- apply(self: samson.SBVisualPreset, nodeIndexer: samson.SBNodeIndexer, preferredFolder: samson.SBFolder = None) None #
Applies the visual preset 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, 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.SBVisualPreset) None #
Clears the color
- clearColorScheme(self: samson.SBVisualPreset) None #
Clears the color scheme
- clearSelectionFilter(self: samson.SBVisualPreset) None #
Clears the selection filter
- clearSelector(self: samson.SBVisualPreset) None #
Clears the selector
- clearVisualModel(self: samson.SBVisualPreset) None #
Clears the visual model
- clone(self: samson.SBVisualPreset) samson.SBVisualPreset #
Returns a copy of the visual preset
- static createColorScheme(colorSchemeClassName: str, nodeIndexer: samson.SBNodeIndexer, colorPalette: samson.SBPalette) samson.SBNodeColorScheme #
Creates a color scheme colorSchemeClassName
- getColor(self: samson.SBVisualPreset) samson.SBColor #
Returns the color
- getColorSchemeProxy(self: samson.SBVisualPreset) samson.SBProxy #
Returns a proxy to the color scheme
- getDefaultColorPaletteForCurrentColorScheme(self: samson.SBVisualPreset) samson.SBPalette #
Returns the default color palette of the color scheme
- getPalette(self: samson.SBVisualPreset) samson.SBPalette #
Returns the color palette
- getSelectorProxy(self: samson.SBVisualPreset) samson.SBProxy #
Returns a proxy to the selector
- getVisualModelProxy(self: samson.SBVisualPreset) samson.SBProxy #
Returns a proxy to the visual model
- static isPerAttributeColorScheme(colorSchemeClassName: str) bool #
Returns True if the color scheme colorSchemeClassName is a per-attribute color scheme
- resetPalette(self: samson.SBVisualPreset) None #
Sets the color palette to the default color palette for this color scheme
- setColor(self: samson.SBVisualPreset, color: samson.SBColor) None #
Sets the color
- setColorSchemeProxy(self: samson.SBVisualPreset, colorSchemeProxy: samson.SBProxy) None #
Sets the color scheme by proxy
- setPalette(self: samson.SBVisualPreset, colorPalette: samson.SBPalette) None #
Sets the color palette
- setSelectionFilter(self: samson.SBVisualPreset, arg0: str, arg1: str) None #
Sets the selection filter string and name
- setSelectorProxy(self: samson.SBVisualPreset, selectorProxy: samson.SBProxy) None #
Sets the selector by proxy
- setVisualModelProxy(self: samson.SBVisualPreset, 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 has a color
- property hasColorScheme#
Returns True if the visual preset 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 has a selector
- property hasVisualModel#
Returns True if the visual preset has a visual model
- property hideStructureFlag#
The hide structure flag
- 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