schrodinger.protein.helm.helm_renderer module

class schrodinger.protein.helm.helm_renderer.HexColor(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

Acidic = <PyQt6.QtGui.QColor object>
Basic = <PyQt6.QtGui.QColor object>
Aliphatic = <PyQt6.QtGui.QColor object>
Aromatic = <PyQt6.QtGui.QColor object>
Hydrophilic = <PyQt6.QtGui.QColor object>
Thiol = <PyQt6.QtGui.QColor object>
IminoAcid = <PyQt6.QtGui.QColor object>
VariablePolar = <PyQt6.QtGui.QColor object>
NABackBone = <PyQt6.QtGui.QColor object>
Adenine = <PyQt6.QtGui.QColor object>
Cytosine = <PyQt6.QtGui.QColor object>
Guanine = <PyQt6.QtGui.QColor object>
Thymine = <PyQt6.QtGui.QColor object>
Uracil = <PyQt6.QtGui.QColor object>
Other = <PyQt6.QtGui.QColor object>
Chem = <PyQt6.QtGui.QColor object>
Black = <PyQt6.QtGui.QColor object>
Gray3 = <PyQt6.QtGui.QColor object>
Gray4 = <PyQt6.QtGui.QColor object>
Gray6 = <PyQt6.QtGui.QColor object>
DarkRed = <PyQt6.QtGui.QColor object>
White = <PyQt6.QtGui.QColor object>
class schrodinger.protein.helm.helm_renderer.ZOrder(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.IntEnum

Enum describing which layer (Z value) each GraphicsItem is drawn on.

BehindMonomer = 1
DefaultMonomerItem = 2
InFrontMonomer = 3
schrodinger.protein.helm.helm_renderer.get_natural_analog(monomer: rdkit.Chem.rdchem.Atom) str
schrodinger.protein.helm.helm_renderer.protect_painter(painter_method: Callable) Callable

Decorator which can be applied to paint methods to ensure the state of the painter isn’t modified

Parameters

painter_method – method to wrap. Should take a painter as its first argument

Returns

wrapped function

class schrodinger.protein.helm.helm_renderer.HelmMonomer(*, res_name: str, polymer_type: schrodinger.protein.helm._helm_parser.PolymerType, is_branch: bool, is_smiles: bool, position: PyQt6.QtCore.QPointF, res_display_type=None)

Bases: object

__init__(*, res_name: str, polymer_type: schrodinger.protein.helm._helm_parser.PolymerType, is_branch: bool, is_smiles: bool, position: PyQt6.QtCore.QPointF, res_display_type=None)
property is_standard: bool
property is_d_amino_acid: bool
property is_nucleotide_sugar: bool
property is_nucleotide_phosphate: bool
property is_nucleotide_backbone: bool
class schrodinger.protein.helm.helm_renderer.HelmMonomerTextLabel(text: str, size: int = 14, weight: PyQt6.QtGui.QFont.Weight = Weight.Normal, color: schrodinger.protein.helm.helm_renderer.HexColor = HexColor.Black, parent=None)

Bases: PyQt6.QtWidgets.QGraphicsPathItem

GraphicsItem used for text labeling all monomers. Sets default font, etc., specific to the Helm rendering use case.

Text is rendered as a path for portability across platforms.

__init__(text: str, size: int = 14, weight: PyQt6.QtGui.QFont.Weight = Weight.Normal, color: schrodinger.protein.helm.helm_renderer.HexColor = HexColor.Black, parent=None)
class schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: object

Mixin which establishes the necessary methods to render the monomer item in the QGraphicsScene. Handles position offsets so that the center of the shape appears at the position set in the monomer object

Also defines default brush and pen settings

MAGNIFY_FACTOR = 1.0
DEFAULT_X_RADIUS = 12.5
DEFAULT_Y_RADIUS = 12.5
__init__(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)
getLabelText() str

Get the text to be displayed in the monomer’s label.

If the assigned name is too long, truncate it and add an ellipsis.

setup()

Initialize the current monomer

getMonomerResizingProposal(text_x_radius: float, text_y_radius: float) Tuple[float, float]

Method with class-specific logic to figure out how to resize the monomer given the final size of its text label. Args are the text label’s size; returns size of the smallest monomer that properly contains the text.

setupTextLabel()

Updates the geometry of the monomer and monomer label in order to prevent the label text from overflowing the monomer shape.

setShape() None

Set the shape and/or bounding box of the monomer. Must be implemented by inheriting classes for them to be rendered in the scene

class schrodinger.protein.helm.helm_renderer.AminoAcidMonomerBase(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, PyQt6.QtWidgets.QGraphicsRectItem

Item representing an amino acid’s position and graphical details in the scene

setShape()

Set the size of the monomer rectangle

paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: Optional[QWidget] = None)
class schrodinger.protein.helm.helm_renderer.StandardAminoAcidMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.AminoAcidMonomerBase

class schrodinger.protein.helm.helm_renderer.DAminoAcidMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.AminoAcidMonomerBase

DEFAULT_X_RADIUS = 16.0
class schrodinger.protein.helm.helm_renderer.OtherAminoAcidMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.AminoAcidMonomerBase

class schrodinger.protein.helm.helm_renderer.BBPhosphateMonomerBase(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, PyQt6.QtWidgets.QGraphicsEllipseItem

Item representing a nucleic acid backbone phosphate group’s position and graphical details in the scene

MAGNIFY_FACTOR = 1.05
getMonomerResizingProposal(text_x_radius: float, text_y_radius: float) Tuple[float, float]

Compute the size of the smallest monomer GraphicsItem that can fit the text label, given that the monomer is ellipse-shaped.

setShape()

Set the size of the monomer ellipse

class schrodinger.protein.helm.helm_renderer.BBStandardPhosphateMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.BBPhosphateMonomerBase

class schrodinger.protein.helm.helm_renderer.BBModifiedPhosphateMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.BBPhosphateMonomerBase

class schrodinger.protein.helm.helm_renderer.BBSugarMonomerBase(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, PyQt6.QtWidgets.QGraphicsRectItem

Item representing a nucleic acid backbone sugar group’s position and graphical details in the scene. Used for both ribose and deoxyribose.

setShape()

Set the size of the monomer rectangle

class schrodinger.protein.helm.helm_renderer.BBStandardSugarMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.BBSugarMonomerBase

class schrodinger.protein.helm.helm_renderer.BBModifiedSugarMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.BBSugarMonomerBase

class schrodinger.protein.helm.helm_renderer.NABaseMonomerBase(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, PyQt6.QtWidgets.QGraphicsPolygonItem

Item representing a nucleobase’s position and graphical details in the scene

MAGNIFY_FACTOR = 1.15
getMonomerResizingProposal(text_x_radius: float, text_y_radius: float) Tuple[float, float]

Compute the size of the smallest monomer GraphicsItem that can fit the text label, given that the monomer is diamond-shaped.

getPolygonVertices() List[PyQt6.QtCore.QPointF]

Get the polygon vertices to create the required diamond shape

Returns

A list of vertices in clockwise order

setShape()

Set the size and vertices of the monomer item diamond

class schrodinger.protein.helm.helm_renderer.NAStandardBaseMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.NABaseMonomerBase

class schrodinger.protein.helm.helm_renderer.NAUnnaturalBaseMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.NABaseMonomerBase

class schrodinger.protein.helm.helm_renderer.ChemMonomerItem(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer)

Bases: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, PyQt6.QtWidgets.QGraphicsRectItem

Catchall class for non-peptide, non-nucleotide elements.

setShape()

Set the size of the monomer rectangle

schrodinger.protein.helm.helm_renderer.monomer_item_factory(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomer) schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin

Implement logic specifying different graphical styles (implemented by each child class) for a monomer.

Parameters

monomer – Monomer properties, determined by HelmScene.getMonomerData.

Returns

Graphics item to be added to the current QtWidgets.QGraphicsScene.

class schrodinger.protein.helm.helm_renderer.HelmConnector(start: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, end: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, is_cyclic: bool = True)

Bases: object

start: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin
end: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin
is_cyclic: bool = True
getMonomers() Tuple[schrodinger.protein.helm.helm_renderer.HelmMonomer, schrodinger.protein.helm.helm_renderer.HelmMonomer]

Convenience function returning a 2-tuple of the (start, end) monomer definitions.

getMonomerTypes() Tuple[schrodinger.protein.helm._helm_parser.PolymerType, schrodinger.protein.helm._helm_parser.PolymerType]

Convenience function returning a 2-tuple of the PolymerType of the start and end monomers.

property has_branch: bool
property is_disulfide_bridge: bool
property polymer_type: schrodinger.protein.helm._helm_parser.PolymerType

Determine the PolymerType of the connector, based on the PolymerType of the two monomers it connects.

__init__(start: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, end: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, is_cyclic: bool = True) None
class schrodinger.protein.helm.helm_renderer.HelmConnectorItemMixin(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: object

Base class for all connectors.

__init__(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)
getStartPos() PyQt6.QtCore.QPointF
getEndPos() PyQt6.QtCore.QPointF
setup() None
class schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.HelmConnectorItemMixin, PyQt6.QtWidgets.QGraphicsLineItem

Base class for all connectors rendered as a straight line.

setup() None
class schrodinger.protein.helm.helm_renderer.PolylineHelmConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.HelmConnectorItemMixin, PyQt6.QtWidgets.QGraphicsPathItem

Base class for all connectors rendered as a polyline (”/‾\”).

setup() None
class schrodinger.protein.helm.helm_renderer.ArrowheadConnectorMixin

Bases: object

Mixin for adding arrowheads to the start or end of a HelmConnectorItemMixin graphics item.

add_arrowhead(pos: PyQt6.QtCore.QPointF) PyQt6.QtWidgets.QAbstractGraphicsShapeItem
getArrowheadPos(monomer: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin, other_monomer: schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin) PyQt6.QtCore.QPointF

Logic for determining where the arrowhead should be attached to monomer, given that the other end of the connector is attached to other_monomer. Returns a position in the global QGraphicsScene coordinate system.

class schrodinger.protein.helm.helm_renderer.AALinearConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Graphics Item representing a non-branching connector between two amino acids.

class schrodinger.protein.helm.helm_renderer.AABranchingConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.ArrowheadConnectorMixin, schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Graphics Item representing a branching connector between two amino acids.

__init__(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)
getStartPos() PyQt6.QtCore.QPointF
getEndPos() PyQt6.QtCore.QPointF
class schrodinger.protein.helm.helm_renderer.DisulfideConnectorMixin(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.ArrowheadConnectorMixin

Mixin for representing disulfide bridges.

__init__(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)
getStartPos() PyQt6.QtCore.QPointF
getEndPos() PyQt6.QtCore.QPointF
class schrodinger.protein.helm.helm_renderer.DisulfideLinearConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.DisulfideConnectorMixin, schrodinger.protein.helm.helm_renderer.PolylineHelmConnectorItem

Graphics Item representing disulfide bridges between two amino acids that have been laid out in a linear arrangement.

class schrodinger.protein.helm.helm_renderer.DisulfideCyclicConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.DisulfideConnectorMixin, schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Graphics Item representing disulfide bridges between two amino acids that have been laid out in a cyclic arrangement, in which the bridge closes the cycle.

class schrodinger.protein.helm.helm_renderer.NABackboneConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Graphics Item representing backbone connections between nucleotides.

class schrodinger.protein.helm.helm_renderer.NABackboneBaseConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Graphics Item representing a connection between a nucleotide backbone and base.

class schrodinger.protein.helm.helm_renderer.NABaseConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Graphics Item representing a connection between two base pairs.

class schrodinger.protein.helm.helm_renderer.ChemConnectorItem(connector: schrodinger.protein.helm.helm_renderer.HelmConnector, parent=None)

Bases: schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem

Catchall class for all connectors where one or both endpoints is a Chem (non-peptide, non-nucleotide) element.

schrodinger.protein.helm.helm_renderer.connector_item_factory(connector: schrodinger.protein.helm.helm_renderer.HelmConnector) PyQt6.QtWidgets.QAbstractGraphicsShapeItem

Implement logic specifying different graphical styles (implemented by each child class) for a connector.

Parameters

connector – Connector properties, determined by HelmScene.getConnectorData.

Returns

Graphics item to be added to the current QtWidgets.QGraphicsScene.

class schrodinger.protein.helm.helm_renderer.HelmFallbackImage(entity_class: schrodinger.livedesign.entity_type.EntityClass)

Bases: PyQt6.QtSvgWidgets.QGraphicsSvgItem

GraphicsItem for the stock image (in .svg format) shown when the input polymer is too complex to display in detail, as measured by N_MONOMER_MAX

__init__(entity_class: schrodinger.livedesign.entity_type.EntityClass)
class schrodinger.protein.helm.helm_renderer.HelmScene

Bases: PyQt6.QtWidgets.QGraphicsScene

Scene object for rendering a helm molecule

__init__()
setHelmMolecule(helm_mol: rdkit.Chem.rdchem.Mol, fallback_entity: Optional[schrodinger.livedesign.entity_type.EntityClass])

Set the helm molecule to render and add bond and monomer representations to the scene.

Parameters
  • helm_mol – Helm data represented by a 2D coarse-grained molecule.

  • fallback_entity – entity class to use for a fallback image

getMonomerData(monomer: rdkit.Chem.rdchem.Atom) Tuple[int, schrodinger.protein.helm.helm_renderer.HelmMonomer]

Compute the properties of monomer needed for the logic that determines its graphical representation: the HelmMonomerItemMixin child class that monomer_item_factory should dispatch to.

Parameters

monomer – Representation of the monomer in the input rdkit molecule.

Returns

2-tuple of the index of the monomer in the conformer object and a HelmMonomer object with the needed properties.

getConnectorData(bond: rdkit.Chem.rdchem.Bond, monomer_lookup: dict) schrodinger.protein.helm.helm_renderer.HelmConnector

Compute the properties of bond needed for the logic that determines its graphical representation: the HelmConnectorItemMixin child class that connector_item_factory should dispatch to.

Parameters
  • bond – Representation of the connector in the input rdkit molecule.

  • monomer_lookup – A dict mapping the monomer’s index in the conformer to its HelmMonomer representation.

Returns

A HelmConnector object with the needed properties.

class schrodinger.protein.helm.helm_renderer.HelmWidget(helm_mol: Optional[rdkit.Chem.rdchem.Mol] = None, fallback_entity: Optional[schrodinger.livedesign.entity_type.EntityClass] = None, *args, **kwargs)

Bases: PyQt6.QtWidgets.QWidget

A widget which creates a visual representation of a coarse-grained 2D helm molecule

__init__(helm_mol: Optional[rdkit.Chem.rdchem.Mol] = None, fallback_entity: Optional[schrodinger.livedesign.entity_type.EntityClass] = None, *args, **kwargs)
setViewSize(size)

Set view size to requested width and height and rescale to show the entire scene :param size: the requested size in pixels

getScaleFactor(size: PyQt6.QtCore.QSizeF) float
Get the scaling factor to make a view of the requested width and height

fit the scene

Parameters

size – width and height of the view

Returns

Factor by which to rescale the view