mkt.databases.app.schema.MutationsGroupConfig

class mkt.databases.app.schema.MutationsGroupConfig(seq_align: SequenceAlignment, 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, *, str_attr: str = 'Mutations', bool_mutations_by_group: bool = True, bool_klifs_only: bool = True, bool_show_sticks: bool = False, str_filepath_json: str)[source]

Bases: MutationsConfig

Group-averaged configuration for mutation visualization in PyMOL.

__init__(seq_align: SequenceAlignment, 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, *, str_attr: str = 'Mutations', bool_mutations_by_group: bool = True, bool_klifs_only: bool = True, bool_show_sticks: bool = False, str_filepath_json: str) None

Methods

__eq__(other)

Return self==value.

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

__post_init__()

_filter_mutations_to_klifs()

Filter dict_mutations to only include residues in the 85 KLIFS pocket positions.

_generate_list_idx_from_dict_align_with_attr()

Generate list of 0-indexed attribute positions from dict_align.

_get_klifs_label(idx_0based)

Get KLIFS pocket label for a position (e.g., 'GK:45').

_get_klifs_uniprot_mapping(klifs_mapping[, ...])

Create mapping between UniProt positions and KLIFS indices.

_get_klifs_uniprot_positions(klifs_mapping)

Get the set of UniProt positions (1-indexed) in the KLIFS pocket.

_get_uniprot_label(idx_0based)

Get amino acid + UniProt position label (e.g., 'T790').

_index_mutation_region()

Extract the indices of the top mutation residues for stick highlighting.

_map_group_klifs_to_uniprot(dict_group_data)

Map group-averaged KLIFS-indexed data to target kinase's UniProt positions.

_preprocess_mutation_dict()

Preprocess mutation dictionary from JSON file.

generate_labels(list_idx)

Generate labels for top mutations: KLIFS pocket label (e.g., 'GK:45').

generate_list_idx()

Generate list of 0-indexed positions for mutation residues.

generate_style_color_lists(list_idx)

Generate style and color lists for mutation residues.

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__

bool_klifs_only

True).

bool_mutations_by_group

True).

bool_show_sticks

False for group-averaged).

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).

str_attr

'Mutations').

str_filepath_json

File path to the JSON file containing the mutation dictionary.

dict_mutations

Dictionary of mutation positions (1-indexed) with corresponding normalized counts.

seq_align

SequenceAlignment object providing kinase info and dict_align.

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, 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, *, str_attr: str = 'Mutations', bool_mutations_by_group: bool = True, bool_klifs_only: bool = True, bool_show_sticks: bool = False, str_filepath_json: str) None
bool_klifs_only: bool = True

True).

Type:

Whether to only highlight KLIFS pocket residues (default

bool_mutations_by_group: bool = True

True).

Type:

Whether to average mutation counts by kinase group (default

bool_show_sticks: bool = False

False for group-averaged).

Type:

Whether to show top mutations as sticks (default

dict_mutations: dict[int, float]

Dictionary of mutation positions (1-indexed) with corresponding normalized counts.

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

Generate labels for top mutations: KLIFS pocket label (e.g., ‘GK:45’).

Parameters:

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

Returns:

KLIFS labels for top mutation positions, None for others.

Return type:

list[str | None]

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__.

seq_align: SequenceAlignment

SequenceAlignment object providing kinase info and dict_align.

str_filepath_json: str

File path to the JSON file containing the mutation dictionary.