mkt.databases.app.schema.StructureConfig

class mkt.databases.app.schema.StructureConfig(seq_align: SequenceAlignment, str_attr: str, label_offset: float = 20.0, label_min_dist: float = 6.0, label_spring_strength: float = 0.0, label_size: int = 14, label_connector: bool = True, highlight_cartoon_transparency: float = 0.0)[source]

Bases: ABC

Configuration for generating PyMOL files.

Uses dependency injection: receives a SequenceAlignment object which provides access to kinase info and aligned sequences.

__init__(seq_align: SequenceAlignment, str_attr: str, label_offset: float = 20.0, label_min_dist: float = 6.0, label_spring_strength: float = 0.0, label_size: int = 14, label_connector: bool = True, highlight_cartoon_transparency: float = 0.0) None

Methods

__eq__(other)

Return self==value.

__init__(seq_align, str_attr[, ...])

__post_init__()

_generate_list_idx_from_dict_align_with_attr()

Generate list of 0-indexed attribute positions from dict_align.

generate_labels(list_idx)

Generate labels for highlighted residues.

generate_list_idx()

Generate list of 0-indexed positions for the residues to be highlighted.

generate_style_color_lists(list_idx)

Generate style and color lists for StructureVisualizer based on the configuration.

return_list_cif_idx()

Return list of 0-indexed positions corresponding to the CIF sequence.

return_list_idx_intersect()

Return list of 0-indexed positions at intersection of CIF and attribute sequences.

return_list_intersect_color_style()

Generate the indices, styles, and colors for highlighting.

Attributes

__dataclass_fields__

__dataclass_params__

__match_args__

highlight_cartoon_transparency

Cartoon transparency applied to colored/highlighted residues (0 = opaque, 1 = invisible).

label_connector

Whether to draw leader/connector lines from each residue to its label.

label_min_dist

Minimum distance (angstroms) between labels for collision avoidance.

label_offset

Angstroms offset from CA for label pseudoatom placement.

label_size

Font size for residue labels.

label_spring_strength

Spring force pulling labels back toward ideal position (0 = no spring).

seq_align

SequenceAlignment object providing kinase info and dict_align.

str_attr

Attribute to highlight in the structure.

list_idx

List of 1-indexed residue positions to be highlighted, generated in __post_init__.

list_color

List of colors for the residues to be highlighted, generated in __post_init__.

list_style

List of styles for the residues to be highlighted, generated in __post_init__.

list_label

List of labels for the residues to be highlighted (None for no label).

__init__(seq_align: SequenceAlignment, str_attr: str, label_offset: float = 20.0, label_min_dist: float = 6.0, label_spring_strength: float = 0.0, label_size: int = 14, label_connector: bool = True, highlight_cartoon_transparency: float = 0.0) None
_generate_list_idx_from_dict_align_with_attr() list[int] | None[source]

Generate list of 0-indexed attribute positions from dict_align.

Returns:

List of 0-indexed positions where attribute sequence has residues, or None if attribute not found in dict_align.

Return type:

list[int] | None

generate_labels(list_idx: list[int]) list[str | None][source]

Generate labels for highlighted residues.

Override in subclasses to provide specific label formats.

Parameters:

list_idx (list[int]) – List of 0-indexed residue positions.

Returns:

List of labels (None for residues that should not be labeled).

Return type:

list[str | None]

abstract generate_list_idx() list[int][source]

Generate list of 0-indexed positions for the residues to be highlighted.

Returns:

List of 0-indexed residue positions.

Return type:

list[int]

abstract generate_style_color_lists(list_idx: list[int]) tuple[list[str], list[str]][source]

Generate style and color lists for StructureVisualizer based on the configuration.

Parameters:

list_idx (list[int]) – List of 0-indexed residue positions (before +1 conversion).

Returns:

Tuple of (list_style, list_color).

Return type:

tuple[list[str], list[str]]

highlight_cartoon_transparency: float = 0.0

Cartoon transparency applied to colored/highlighted residues (0 = opaque, 1 = invisible).

label_connector: bool = True

Whether to draw leader/connector lines from each residue to its label.

label_min_dist: float = 6.0

Minimum distance (angstroms) between labels for collision avoidance.

label_offset: float = 20.0

Angstroms offset from CA for label pseudoatom placement.

label_size: int = 14

Font size for residue labels.

label_spring_strength: float = 0.0

Spring force pulling labels back toward ideal position (0 = no spring).

list_color: list[str]

List of colors for the residues to be highlighted, generated in __post_init__.

list_idx: list[int]

List of 1-indexed residue positions to be highlighted, generated in __post_init__.

list_label: list[str | None]

List of labels for the residues to be highlighted (None for no label).

list_style: list[str]

List of styles for the residues to be highlighted, generated in __post_init__.

return_list_cif_idx() list[int][source]

Return list of 0-indexed positions corresponding to the CIF sequence.

Returns:

List of 0-indexed positions where CIF sequence has residues (not gaps).

Return type:

list[int]

return_list_idx_intersect() list[int][source]

Return list of 0-indexed positions at intersection of CIF and attribute sequences.

Returns:

Sorted list of 0-indexed positions present in both CIF and attribute sequences.

Return type:

list[int]

Raises:

ValueError – If attribute sequence cannot be generated from dict_align.

return_list_intersect_color_style() tuple[list[int], list[str], list[str]][source]

Generate the indices, styles, and colors for highlighting.

Returns:

Tuple of (list_idx, list_color, list_style) where list_idx is 1-indexed.

Return type:

tuple[list[int], list[str], list[str]]

seq_align: SequenceAlignment

SequenceAlignment object providing kinase info and dict_align.

str_attr: str

Attribute to highlight in the structure.