MHCXGraph.core.residue_tracking.ResidueTracker

class MHCXGraph.core.residue_tracking.ResidueTracker(watch_residues: Iterable[tuple[int, str, int, str]] | None = None, *, out_dir: str = 'residue_tracking', max_examples_per_event: int = 25, keep_event_log: bool = True)[source]

Watches specific residues across the pipeline.

Design goals:
  • provenance rich (ctx includes step/chunk/comp/frame)

  • bounded memory (stores only when watched residue appears)

  • easy export to JSON

Typical use:

tracker = ResidueTracker(watch_residues={ (0,”A”,42,””), (1,”B”,15,””) }, out_dir=”tracking”) … tracker.triads_built(ctx, token, triads_absolute) tracker.combos_built(ctx, token, combos) tracker.frame_accepted(ctx, edges_residues, edges_indices) … tracker.dump_json()

__init__(watch_residues: Iterable[tuple[int, str, int, str]] | None = None, *, out_dir: str = 'residue_tracking', max_examples_per_event: int = 25, keep_event_log: bool = True) None[source]

Methods

__init__([watch_residues, out_dir, ...])

combos_built(ctx, token, combos)

component_selected(ctx, *, component_nodes)

component_skipped(ctx, *, reason, component_size)

dump_json([filename])

Writes a single JSON with:

frame_accepted(ctx, *, edges_residues[, ...])

resolve_from_pdb_dfs(pdb_dfs[, stage])

You call this already in association_product.

triad_filtered(ctx, reason, *[, triad_abs, ...])

triads_built(ctx, token, triads_absolute)