haddock.modules.sampling.gdock.gdock module
Wrapper around the gdock package.
- class haddock.modules.sampling.gdock.gdock.GdockWrapper(receptor_pdb_file: str | Path, ligand_pdb_file: str | Path, restraints: list[tuple[int, int]] | None = None, max_generations: int = 250, number_of_individuals: int = 150, ncores: int = 1, seed: int = 42, sampling: int | None = None)[source]
Bases:
objectWrapper to run gdock’s genetic algorithm docking and save its models.
- save_models(output_dir: str | Path, prefix: str = 'gdock') list[dict][source]
Write all ranked models as PDB files to output_dir.
Each model PDB already contains the full receptor+ligand complex as returned by gdock. The segID column (cols 73-76) is filled from the chain ID before writing so that CNS can map atoms to the PSF, and atom serials are renumbered to ensure they are strictly increasing.
- Returns:
list[dict] – One entry per saved model with keys file_name, fitness, vdw, elec, desolv and air.
- haddock.modules.sampling.gdock.gdock.extract_pairs_from_tbl(tbl_filename: str | Path, receptor_chain: str, ligand_chain: str) list[tuple[int, int]][source]
Extract active-active restraint pairs from a HADDOCK TBL file.
Only pairs where both residues appear as anchors (active residues) are returned. Residues that appear exclusively in OR groups (passive) are ignored. This matches HADDOCK’s active/passive residue distinction.
- Parameters:
tbl_filename (FilePath) – Path to the AIR.tbl restraints file.
receptor_chain (str) – Chain ID of the receptor.
ligand_chain (str) – Chain ID of the ligand.
- Returns:
list[tuple[int, int]] – Sorted list of (receptor_resseq, ligand_resseq) active-active pairs.
- haddock.modules.sampling.gdock.gdock.gdock_is_available() bool[source]
Check whether the gdock package is importable.
- haddock.modules.sampling.gdock.gdock.parse_restraints(tbl_filename: str | Path, receptor_chain: str, ligand_chain: str) list[tuple[int, int]][source]
Convert a TBL ambiguous restraints file into gdock restraint pairs.
Each assign entry is treated as one anchor selection followed by one or more (possibly OR-combined) partner selections, which is the standard HADDOCK AIR format. A pair (receptor_resseq, ligand_resseq) is emitted for every anchor/partner combination spanning receptor_chain and ligand_chain.
- Parameters:
tbl_filename (FilePath) – Path to the AIR.tbl restraints file.
receptor_chain (str) – Chain ID of the receptor.
ligand_chain (str) – Chain ID of the ligand.
- Returns:
list[tuple[int, int]] – Sorted list of (receptor_resseq, ligand_resseq) pairs.