ColorScheme¶

This is a base class that describes a color scheme in SAMSON.

See also

You can find a list of color schemes available in SAMSON in the samson.DataModel.Color module e.g.: samson.DataModel.Color.ColorSchemeCPK, samson.DataModel.Color.ColorSchemePerResidueSequenceNumber, etc.

A data graph node (samson.DataModel.DataGraph.Node) has a function setColorScheme which allows you to directly apply a color scheme to this node.

Let’s colorize all molecules in the active document with a color scheme based on the residue sequence number. For that we will use the samson.DataModel.Color.ColorSchemePerResidueSequenceNumber color scheme.

# get all residues
nodeIndexer = SAMSON.getNodes('node.type sm')

# create a color scheme per residue sequence number
# by providing the node indexer of residues to the color scheme constructor
# we allow it to determine the color range based on the minimal and maximal residue sequence numbers
colorScheme = sam.DataModel.Color.ColorSchemePerResidueSequenceNumber(nodeIndexer)

# apply the color scheme to nodes
for node in nodeIndexer:
        node.setColorScheme(colorScheme)

Let’s colorize all molecules in the active document with a color scheme based on the temperature factor of atoms. For that we will use the samson.DataModel.Color.ColorSchemePerTemperatureFactor color scheme.

# get all structural models
nodeIndexer = SAMSON.getNodes('node.type sm')

# create a color scheme per temperature factor
# by providing the node indexer of all structural models to the color scheme constructor
# we allow it to determine the color range based on the minimal and maximal temperature factors in the system
colorScheme = sam.DataModel.Color.ColorSchemePerTemperatureFactor(nodeIndexer)

# apply the color scheme to nodes
for node in nodeIndexer:
        node.setColorScheme(colorScheme)

See also

SAMSON API: SBDDataGraphNodeColorScheme

class samson.DataModel.DataGraph.ColorScheme(self: samson.DataModel.DataGraph.ColorScheme) → None¶

Bases: pybind11_builtins.pybind11_object

This class describes a color scheme.

Constructs a color scheme

getColor(self: samson.DataModel.DataGraph.ColorScheme, node: samson.DataModel.DataGraph.Node=None) → List[float]¶

Returns a color given a node

isSerializable¶

Returns true when the class is serializable