mkt.databases.app.structures

Structure visualization backing the Streamlit app.

Provides StructureVisualizer, which builds the interactive structure views rendered in the Streamlit app.

Classes

StructureVisualizer(config)

Load and process kinase structures for visualization.

class mkt.databases.app.structures.StructureVisualizer(config: StructureConfig)[source]

Bases: object

Load and process kinase structures for visualization.

This class handles structure loading from KinaseInfo CIF data and provides highlight data for visualization. Style/color logic is delegated to StructureConfig objects.

Parameters:

config (StructureConfig) – Configuration object containing seq_align (with kinase info) and pre-computed list_idx, list_color, list_style for highlighting.

Variables:
  • config (StructureConfig) – The configuration object.

  • obj_kinase (KinaseInfo) – KinaseInfo object from config.seq_align.obj_kinase.

  • structure (Structure) – Bio.PDB Structure object loaded from CIF.

  • pdb_text (str) – PDB-formatted string of the structure.

  • residues (list) – List of residues from the structure.

__init__(config: StructureConfig)[source]
_convert_mmcifdict2structure() Structure[source]

Convert this kinase’s MMCIF2Dict to a Bio.PDB Structure.

Returns:

Bio.PDB Structure object.

Return type:

Structure

_convert_structure2string() str[source]

Convert this Bio.PDB Structure object to a PDB format string.

Returns:

Structure in PDB string format.

Return type:

str

_generate_highlight_idx() tuple[list[int], dict[int, str], dict[int, str], dict[int, str | None]][source]

Alias for get_highlight_data() for backwards compatibility.

Deprecated since version Use: get_highlight_data() instead.

get_highlight_data() tuple[list[int], dict[int, str], dict[int, str], dict[int, str | None]][source]

Get highlight indices and color/style/label dictionaries for visualization.

The config provides list_idx (1-indexed), list_color, list_style, and list_label. This method converts them to the dict format expected by consumers.

Returns:

  • list_highlight: List of 1-indexed residue positions to highlight.

  • dict_color: Mapping from residue position to color.

  • dict_style: Mapping from residue position to style.

  • dict_label: Mapping from residue position to label (None for no label).

Return type:

tuple[list[int], dict[int, str], dict[int, str], dict[int, str | None]]

static parse_pdb_line(line: str) dict[str, Any] | None[source]

Parse a line from a PDB file and extract relevant information.

Parameters:

line (str) – Line from a PDB file.

Returns:

Dictionary containing extracted information or None if the line does not match the criteria (ATOM line with CA atom).

Return type:

dict[str, Any] | None