MHCXGraph.classes.graph.Graph

class MHCXGraph.classes.graph.Graph(graph_path: str, config: GraphConfig)[source]

Graph representation of a protein structure.

This class loads a structural file (PDB or mmCIF), constructs a residue interaction graph using the configured pipeline, and provides utilities for extracting and exporting filtered subgraphs.

graph_path

Path to the structure file used to construct the graph.

Type:

str

config

Configuration object defining graph construction parameters.

Type:

GraphConfig

graph

Graph representation of the protein structure.

Type:

networkx.Graph

subgraphs

Dictionary storing named subgraphs or node selections.

Type:

dict[str, networkx.Graph | list[str]]

pdb_df

DataFrame containing PDB atom-level information.

Type:

pandas.DataFrame or None

raw_pdb_df

DataFrame containing raw PDB data before filtering.

Type:

pandas.DataFrame or None

dssp_df

DataFrame containing DSSP secondary structure annotations.

Type:

pandas.DataFrame or None

__init__(graph_path: str, config: GraphConfig)[source]

Initialize a protein structure graph.

Parameters:
  • graph_path (str) – Path to a PDB or mmCIF file.

  • config (GraphConfig) – Graph configuration object specifying node granularity, edge construction rules, and inclusion criteria for waters, ligands, and noncanonical residues.

Methods

__init__(graph_path, config)

Initialize a protein structure graph.

create_subgraph(name[, node_list, ...])

Create and store a subgraph.

get_subgraph(name)

Retrieve a stored subgraph by name.

save_filtered_pdb(g, output_path, name[, ...])

Save a filtered structural file containing only selected residues.