MHCXGraph.app

MHCXGraph.app.clean_graph_name(graph)[source]

Extract cleaned stem name from graph tuple.

MHCXGraph.app.create_master_dashboard(export_data, output_dir, log)[source]

Helper to inject the master aggregated JSON into the dashboard template.

MHCXGraph.app.main()[source]

Run the MHCXGraph command-line pipeline.

This function orchestrates the full workflow:

  1. Parse command-line arguments.

  2. Load the execution manifest.

  3. Configure logging and runtime tracking.

  4. Generate graph representations from input structures.

  5. Execute the association workflow.

The workflow can operate in two modes defined in the manifest:

multiple

Process all graphs together in a single association task.

pairwise

Perform pairwise comparisons between all graph combinations.

Return type:

None

Raises:

ValueError – If the configured run_mode is not "multiple" or "pairwise".

MHCXGraph.app.renumber(args)[source]
MHCXGraph.app.run(args)[source]
MHCXGraph.app.run_multiple_mode(graphs, base_output, run_name, config, log)[source]

Execute the association workflow in multiple-graphs mode.

In this mode all graphs are processed together in a single association task.

Parameters:
  • graphs (list) – Collection of graph objects produced by the preprocessing stage.

  • base_output (pathlib.Path) – Base directory where output results are written.

  • run_name (str) – Identifier for the current execution run.

  • config (dict[str, Any]) – Association configuration dictionary controlling the graph association algorithm.

  • log (logging.Logger) – Logger instance used to record runtime messages.

Return type:

None

MHCXGraph.app.run_pairwise_mode(graphs, base_output, run_name, config, log)[source]

Execute the association workflow in pairwise mode.

Each unique pair of graphs is processed independently and written to a dedicated output directory.

Parameters:
  • graphs (list) – Collection of graph objects produced by preprocessing.

  • base_output (pathlib.Path) – Root directory where pairwise comparison results will be saved.

  • run_name (str) – Base identifier for the run.

  • config (dict[str, Any]) – Association configuration dictionary controlling the graph association algorithm.

  • log (logging.Logger) – Logger instance used to record runtime messages.

Return type:

None

MHCXGraph.app.run_screening_mode(ref_graph, target_graphs, base_output, run_name, config, log)[source]

Execute the association workflow in screening mode (1-vs-All).

This mode compares a single reference graph against a collection of target graphs. Each target is processed individually against the reference, and the results are aggregated into a single interactive dashboard. To leverage existing frontend logic, the dashboard payload mimics the “pairwise” mode structure but includes an actual_mode flag to trigger specific UI text replacements during HTML generation.

Parameters:
  • ref_graph (tuple) – A tuple containing the reference graph data produced by the preprocessing stage. Typically structured as (networkx.Graph, file_path, base_name).

  • target_graphs (list of tuple) – A list of graph tuples to be compared against the reference graph.

  • base_output (pathlib.Path) – The root directory where the screening results and the final HTML dashboard will be saved.

  • run_name (str) – A unique base identifier for the current execution run.

  • config (dict[str, Any]) – The association configuration dictionary controlling the graph association algorithm’s parameters and thresholds.

  • log (logging.Logger) – Logger instance used to record runtime progress, warnings, and errors.

Return type:

None

MHCXGraph.app.setup_trackers(output_dir, settings)[source]

Initialize runtime tracking utilities.

This function configures the global tracking system used to store intermediate artifacts produced during execution and optionally creates a ResidueTracker to monitor selected residues.

Parameters:
  • output_dir (pathlib.Path) – Directory where tracking artifacts and debug files will be stored.

  • settings (dict[str, Any]) – Runtime configuration dictionary loaded from the manifest. Relevant keys include watch_residues and debug_tracking.

Returns:

tracker_residues – Residue tracker instance if residue monitoring is enabled, otherwise None.

Return type:

ResidueTracker or None

Functions

clean_graph_name(graph)

Extract cleaned stem name from graph tuple.

create_master_dashboard(export_data, ...)

Helper to inject the master aggregated JSON into the dashboard template.

main()

Run the MHCXGraph command-line pipeline.

renumber(args)

run(args)

run_multiple_mode(graphs, base_output, ...)

Execute the association workflow in multiple-graphs mode.

run_pairwise_mode(graphs, base_output, ...)

Execute the association workflow in pairwise mode.

run_screening_mode(ref_graph, target_graphs, ...)

Execute the association workflow in screening mode (1-vs-All).

setup_trackers(output_dir, settings)

Initialize runtime tracking utilities.