schrodinger.protein.helm.helm_renderer module¶
- class schrodinger.protein.helm.helm_renderer.HexColor¶
Bases:
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¶
Bases:
IntEnumEnum 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: 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: PolymerType, is_branch: bool, is_smiles: bool, position: 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: Weight = Weight.Normal, color: HexColor = HexColor.Black, parent=None)¶
Bases:
QGraphicsPathItemGraphicsItem 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.
- class schrodinger.protein.helm.helm_renderer.HelmMonomerItemMixin(monomer: HelmMonomer)¶
Bases:
objectMixin 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: 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: HelmMonomer)¶
Bases:
HelmMonomerItemMixin,QGraphicsRectItemItem representing an amino acid’s position and graphical details in the scene
- setShape()¶
Set the size of the monomer rectangle
- paint(self, painter: Optional[QPainter], option: Optional[QStyleOptionGraphicsItem], widget: Optional[QWidget] = None)¶
- class schrodinger.protein.helm.helm_renderer.StandardAminoAcidMonomerItem(monomer: HelmMonomer)¶
Bases:
AminoAcidMonomerBase
- class schrodinger.protein.helm.helm_renderer.DAminoAcidMonomerItem(monomer: HelmMonomer)¶
Bases:
AminoAcidMonomerBase- DEFAULT_X_RADIUS = 16.0¶
- class schrodinger.protein.helm.helm_renderer.OtherAminoAcidMonomerItem(monomer: HelmMonomer)¶
Bases:
AminoAcidMonomerBase
- class schrodinger.protein.helm.helm_renderer.BBPhosphateMonomerBase(monomer: HelmMonomer)¶
Bases:
HelmMonomerItemMixin,QGraphicsEllipseItemItem 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: HelmMonomer)¶
Bases:
BBPhosphateMonomerBase
- class schrodinger.protein.helm.helm_renderer.BBModifiedPhosphateMonomerItem(monomer: HelmMonomer)¶
Bases:
BBPhosphateMonomerBase
- class schrodinger.protein.helm.helm_renderer.BBSugarMonomerBase(monomer: HelmMonomer)¶
Bases:
HelmMonomerItemMixin,QGraphicsRectItemItem 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: HelmMonomer)¶
Bases:
BBSugarMonomerBase
- class schrodinger.protein.helm.helm_renderer.BBModifiedSugarMonomerItem(monomer: HelmMonomer)¶
Bases:
BBSugarMonomerBase
- class schrodinger.protein.helm.helm_renderer.NABaseMonomerBase(monomer: HelmMonomer)¶
Bases:
HelmMonomerItemMixin,QGraphicsPolygonItemItem 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[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: HelmMonomer)¶
Bases:
NABaseMonomerBase
- class schrodinger.protein.helm.helm_renderer.NAUnnaturalBaseMonomerItem(monomer: HelmMonomer)¶
Bases:
NABaseMonomerBase
- class schrodinger.protein.helm.helm_renderer.ChemMonomerItem(monomer: HelmMonomer)¶
Bases:
HelmMonomerItemMixin,QGraphicsRectItemCatchall class for non-peptide, non-nucleotide elements.
- setShape()¶
Set the size of the monomer rectangle
- schrodinger.protein.helm.helm_renderer.monomer_item_factory(monomer: HelmMonomer) 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: HelmMonomerItemMixin, end: HelmMonomerItemMixin, is_cyclic: bool = True)¶
Bases:
object- start: HelmMonomerItemMixin¶
- is_cyclic: bool = True¶
- getMonomers() Tuple[HelmMonomer, HelmMonomer]¶
Convenience function returning a 2-tuple of the (start, end) monomer definitions.
- getMonomerTypes() Tuple[PolymerType, PolymerType]¶
Convenience function returning a 2-tuple of the
PolymerTypeof the start and end monomers.
- property has_branch: bool¶
- property is_disulfide_bridge: bool¶
- property polymer_type: PolymerType¶
Determine the
PolymerTypeof the connector, based on thePolymerTypeof the two monomers it connects.
- __init__(start: HelmMonomerItemMixin, end: HelmMonomerItemMixin, is_cyclic: bool = True) None¶
- class schrodinger.protein.helm.helm_renderer.HelmConnectorItemMixin(connector: HelmConnector, parent=None)¶
Bases:
objectBase class for all connectors.
- __init__(connector: HelmConnector, parent=None)¶
- getStartPos() QPointF¶
- getEndPos() QPointF¶
- setup() None¶
- class schrodinger.protein.helm.helm_renderer.LineHelmConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
HelmConnectorItemMixin,QGraphicsLineItemBase class for all connectors rendered as a straight line.
- setup() None¶
- class schrodinger.protein.helm.helm_renderer.PolylineHelmConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
HelmConnectorItemMixin,QGraphicsPathItemBase class for all connectors rendered as a polyline (”
/‾\”).- setup() None¶
- class schrodinger.protein.helm.helm_renderer.ArrowheadConnectorMixin¶
Bases:
objectMixin for adding arrowheads to the start or end of a
HelmConnectorItemMixingraphics item.- add_arrowhead(pos: QPointF) QAbstractGraphicsShapeItem¶
- getArrowheadPos(monomer: HelmMonomerItemMixin, other_monomer: HelmMonomerItemMixin) QPointF¶
Logic for determining where the arrowhead should be attached to
monomer, given that the other end of the connector is attached toother_monomer. Returns a position in the global QGraphicsScene coordinate system.
- class schrodinger.protein.helm.helm_renderer.AALinearConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
LineHelmConnectorItemGraphics Item representing a non-branching connector between two amino acids.
- class schrodinger.protein.helm.helm_renderer.AABranchingConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
ArrowheadConnectorMixin,LineHelmConnectorItemGraphics Item representing a branching connector between two amino acids.
- __init__(connector: HelmConnector, parent=None)¶
- getStartPos() QPointF¶
- getEndPos() QPointF¶
- class schrodinger.protein.helm.helm_renderer.DisulfideConnectorMixin(connector: HelmConnector, parent=None)¶
Bases:
ArrowheadConnectorMixinMixin for representing disulfide bridges.
- __init__(connector: HelmConnector, parent=None)¶
- getStartPos() QPointF¶
- getEndPos() QPointF¶
- class schrodinger.protein.helm.helm_renderer.DisulfideLinearConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
DisulfideConnectorMixin,PolylineHelmConnectorItemGraphics 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: HelmConnector, parent=None)¶
Bases:
DisulfideConnectorMixin,LineHelmConnectorItemGraphics 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: HelmConnector, parent=None)¶
Bases:
LineHelmConnectorItemGraphics Item representing backbone connections between nucleotides.
- class schrodinger.protein.helm.helm_renderer.NABackboneBaseConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
LineHelmConnectorItemGraphics Item representing a connection between a nucleotide backbone and base.
- class schrodinger.protein.helm.helm_renderer.NABaseConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
LineHelmConnectorItemGraphics Item representing a connection between two base pairs.
- class schrodinger.protein.helm.helm_renderer.ChemConnectorItem(connector: HelmConnector, parent=None)¶
Bases:
LineHelmConnectorItemCatchall 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: HelmConnector) 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.HelmScene¶
Bases:
QGraphicsSceneScene object for rendering a helm molecule
- __init__()¶
- setHelmMolecule(helm_mol: Mol)¶
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: Atom) Tuple[int, HelmMonomer]¶
Compute the properties of
monomerneeded for the logic that determines its graphical representation: theHelmMonomerItemMixinchild class thatmonomer_item_factoryshould dispatch to.- Parameters:
monomer – Representation of the monomer in the input
rdkitmolecule.- Returns:
2-tuple of the index of the monomer in the conformer object and a
HelmMonomerobject with the needed properties.
- getConnectorData(bond: Bond, monomer_lookup: dict) HelmConnector¶
Compute the properties of
bondneeded for the logic that determines its graphical representation: theHelmConnectorItemMixinchild class thatconnector_item_factoryshould dispatch to.- Parameters:
bond – Representation of the connector in the input
rdkitmolecule.monomer_lookup – A dict mapping the monomer’s index in the conformer to its
HelmMonomerrepresentation.
- Returns:
A
HelmConnectorobject with the needed properties.
- class schrodinger.protein.helm.helm_renderer.HelmWidget(helm_mol: Optional[Mol] = None, *args, **kwargs)¶
Bases:
QWidgetA widget which creates a visual representation of a coarse-grained 2D helm molecule
- __init__(helm_mol: Optional[Mol] = 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: 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