mkt.databases.pymol.PyMOLGenerator
- class mkt.databases.pymol.PyMOLGenerator(viz: ~mkt.databases.app.structures.StructureVisualizer, str_attr: str, dict_filenames: dict = <factory>)[source]
Bases:
objectGenerate PDB file with embedded color/style info and standalone PyMOL script.
- __init__(viz: ~mkt.databases.app.structures.StructureVisualizer, str_attr: str, dict_filenames: dict = <factory>) None
Methods
__eq__(other)Return self==value.
__init__(viz, str_attr[, dict_filenames])__post_init__()_convert_color_to_hex(color)Convert named color to hex, with fallback options.
Generate residue-to-color mapping, stick residue list, and label mapping.
generate_annotated_pdb(output_path)Generate PDB file with renumbered residues and color/style annotations.
generate_instructions(output_dir)Generate instructions for manual PyMOL execution.
generate_pymol_script(pdb_path, output_path)Generate PyMOL script that reads annotations from PDB and applies styling.
return_filepath_dict(output_dir)Return dictionary of filenames with paths.
save_pymol_files(output_dir)Generate PDB file and PyMOL script for manual PyMOL execution.
Attributes
__dataclass_fields____dataclass_params____match_args__StructureVisualizer object with loaded structure and config.
Granular attribute name of the structure visualization (e.g., KLIFS_IMPORTANT not just KLIFS).
Gene name of the structure.
Dictionary of filenames for PDB, script, and instructions.
- __init__(viz: ~mkt.databases.app.structures.StructureVisualizer, str_attr: str, dict_filenames: dict = <factory>) None
- _convert_color_to_hex(color: str) str[source]
Convert named color to hex, with fallback options.
- Parameters:
color (str) – Color name or hex string.
- Returns:
Hex color string.
- Return type:
str
- _get_color_and_style_mapping() tuple[dict[int, str], list[int], dict[int, str]][source]
Generate residue-to-color mapping, stick residue list, and label mapping.
Uses the get_highlight_data() from StructureVisualizer which gets data from the config.
- Returns:
Dictionary mapping residue numbers to hex colors, list of stick residue numbers, dictionary mapping residue numbers to label strings.
- Return type:
tuple[dict[int, str], list[int], dict[int, str]]
- dict_filenames: dict
Dictionary of filenames for PDB, script, and instructions.
- gene_name: str
Gene name of the structure.
- generate_annotated_pdb(output_path: str) str[source]
Generate PDB file with renumbered residues and color/style annotations.
- Parameters:
output_path (str) – Path to save the annotated PDB file.
- Returns:
Path to the saved annotated PDB file.
- Return type:
str
- generate_instructions(output_dir: str) str[source]
Generate instructions for manual PyMOL execution.
- Parameters:
output_dir (str) – Directory where files are saved
- Returns:
Instructions text
- Return type:
str
- generate_pymol_script(pdb_path: str, output_path: str) str[source]
Generate PyMOL script that reads annotations from PDB and applies styling.
- Parameters:
pdb_path (str) – Path to the annotated PDB file.
output_path (str) – Path to save the PyMOL script.
- Returns:
Path to the saved PyMOL script.
- Return type:
str
- return_filepath_dict(output_dir: str) dict[str, str][source]
Return dictionary of filenames with paths.
- Parameters:
output_dir (str) – Directory where files are saved.
- Returns:
Dictionary mapping file types to full file paths.
- Return type:
dict[str, str]
- save_pymol_files(output_dir: str)[source]
Generate PDB file and PyMOL script for manual PyMOL execution.
- Parameters:
output_dir (str) – Directory to save files
- str_attr: str
Granular attribute name of the structure visualization (e.g., KLIFS_IMPORTANT not just KLIFS).
- viz: StructureVisualizer
StructureVisualizer object with loaded structure and config.