prolint.plotting.structure

Structure export module.

This module provides functions for exporting contact metrics to PDB files for visualization in molecular viewers.

Functions

write_pdb(→ str)

Write contact metrics to a PDB file for visualization.

Module Contents

prolint.plotting.structure.write_pdb(contacts, metric: Literal['mean', 'max', 'sum', 'occupancy'] = 'occupancy', target_resname: str | None = None, filename: str | None = None, frame: int = 0) str[source]

Write contact metrics to a PDB file for visualization.

Exports query atoms to a PDB file with metric values stored in the B-factor column for coloring in molecular viewers.

Parameters:
  • contacts (ComputedContacts) – Computed contact data.

  • metric ({"mean", "max", "sum", "occupancy"}, default="occupancy") – Metric to write to B-factor column.

  • target_resname (str, optional) – Filter by database residue name (e.g., “CHOL”).

  • filename (str, optional) – Output filename. If None, creates a temporary file.

  • frame (int, default=0) – Trajectory frame to use for coordinates.

Returns:

Path to the written PDB file.

Return type:

str

Examples

>>> from prolint.plotting import write_pdb
>>> pdb_path = write_pdb(contacts, metric="occupancy")
>>> # Open in PyMOL/VMD and color by B-factor