qp.cluster.spheres.extract_clusters¶
- qp.cluster.spheres.extract_clusters(path, out, center_residue: CenterResidue, sphere_count=2, first_sphere_radius=4.0, max_atom_count=None, merge_cutoff=0.0, smooth_method='box_plot', ligands=[], capping=1, charge=True, ligand_charge={}, count=True, xyz=True, hetero_pdb=False, include_ligands=2, **smooth_params)[source]¶
Extract active site coordination spheres using Voronoi tessellation.
The main entry point for cluster extraction. Identifies center residues, builds coordination spheres using Voronoi neighbors, applies optional capping, and writes output files (PDB, XYZ, charge.csv, count.csv).
- Parameters:
path (str) – Path to the input PDB file.
out (str) – Path to the output directory.
center_residue (CenterResidue) – Definition of residues to use as the cluster center.
sphere_count (int, optional) – Number of coordination spheres to extract (default 2).
first_sphere_radius (float, optional) – Distance cutoff in angstroms for the first sphere (default 4.0).
max_atom_count (int, optional) – Maximum atom count; residues are pruned if exceeded (default None).
merge_cutoff (float, optional) – Distance cutoff for merging nearby centers (default 0.0).
smooth_method (str, optional) – Sphere smoothing method:
'box_plot','dbscan', or'dummy_atom'(default'box_plot').ligands (list, optional) – Additional ligand residue names to include (default []).
capping (int, optional) – Capping mode: 0 = none, 1 = hydrogen, 2 = ACE/NME (default 1).
charge (bool, optional) – If True, write amino acid charges to
charge.csv(default True).ligand_charge (dict, optional) – Mapping of ligand IDs to formal charges (default {}).
count (bool, optional) – If True, write residue counts to
count.csv(default True).xyz (bool, optional) – If True, write XYZ coordinate files (default True).
hetero_pdb (bool, optional) – If True, include HETATM records in combined PDB (default False).
include_ligands (int, optional) – Ligand inclusion mode: 0 = first sphere only unless in
ligands, 1 = all non-water, 2 = all (default 2).**smooth_params – Additional parameters for the smoothing method.
- Returns:
Paths to the generated cluster directories (e.g.,
['out/A199', 'out/B350']).- Return type:
list of str