API Documentation for highlighting

class FigureHighlighter(complex_pdb_file, ligand_no_h_pdb_file)

dentifies and highlights ligand atoms involved in various types of protein-ligand interactions.

param str complex_pdb_file:

Path to the protein-ligand complex PDB file.

param str ligand_no_h_pdb_file:

Path to the ligand PDB file without hydrogens.

ivar mda.Universe complex:

MDAnalysis Universe object of the protein-ligand complex.

ivar mda.Universe ligand_no_h:

MDAnalysis Universe object of the ligand without hydrogens.

ivar mda.AtomGroup lig_noh:

AtomGroup of all atoms in the ligand without hydrogens.

split_interaction_data(data)

Splits the input data into multiple parts.

Parameters:

data (list) – A list containing strings with protein residue name, interacting indices and interaction type.

Returns:

List of separate formatted strings with separated protein residue name, interacting indices and interaction type.

Return type:

list

highlight_numbers(split_data, starting_idx)

Extracts the data from the split_data output of the interactions and categorizes it to the correct interaction list.

Parameters:
  • split_data (list) – Split interaction data strings with the protein residue name, interacting indices and interaction type.

  • starting_idx (list) – Starting indices of ligand atoms used to correctly identify atoms.

Returns:

A tuple of lists of highlighted atom indices by interaction type.

Return type:

tuple

generate_interaction_dict(interaction_type, keys)

Generates a dictionary of interaction RGB color model based on the provided interaction type.

Parameters:
  • interaction_type (str) – The type of interaction (e.g., ‘hydrophobic’, ‘hbond_donor’).

  • keys (list) – Atom indices corresponding to the given interaction type.

Returns:

Dictionary mapping each atom index to an RGB color code tuple.

Return type:

dict

class LigandImageGenerator(ligand_name, complex_pdb_file, ligand_no_h_pdb_file, output_svg_filename, fig_type='svg')

Generates 2D images of the ligand structure from a protein-ligand complex with atom indices mapped.

Parameters:
  • ligand_name (str) – Name of the ligand (3 letters) in the protein-ligand complex topology.

  • complex_pdb_file (str) – Path to the protein-ligand complex PDB file.

  • ligand_no_h_pdb_file (str) – Path to the ligand PDB file without hydrogens.

  • output_svg_filename (str) – Output filename for the generated SVG image.

  • fig_type (str) – Type of image to generate. Can be “svg” or “png”.

generate_image()

Generates and saves a 2D depiction of the ligand with atom indices labeled. Converts to PNG if specified.

Returns:

None. This function writes out a figure and does not return anything.

Return type:

None