Skip to content

Fetcher API#

docksuitex.utils.fetcher #

Molecule fetching utilities for DockSuiteX.

fetch_pdb #

fetch_pdb(
    pdbid: Union[str, List[str]],
    save_to: Union[str, Path] = ".",
    parallel: int = 4,
) -> Union[Path, List[Path]]

Download PDB structure file(s) from the RCSB Protein Data Bank.

This function downloads .pdb files for the given PDB ID(s). It supports parallel downloading when a list of IDs is provided.

Parameters:

Name Type Description Default
pdbid Union[str, List[str]]

A single 4-character PDB ID (e.g., "1UBQ") or a list of PDB IDs.

required
save_to Union[str, Path]

Directory to save the file(s). Defaults to the current directory.

'.'
parallel int

Number of threads to use for parallel downloading. Defaults to 4.

4

Returns:

Type Description
Union[Path, List[Path]]

Union[Path, List[Path]]: The absolute path(s) to the downloaded .pdb file(s).

fetch_sdf #

fetch_sdf(
    molecule_id: Union[str, int, List[Union[str, int]]],
    save_to: Union[str, Path] = ".",
    parallel: int = 4,
) -> Union[Path, List[Path]]

Download SDF structure file(s) from PubChem or ChEMBL.

The source is auto-detected from each ID:

  • Numeric IDs (e.g. 2244) are fetched as 3D conformers from PubChem.
  • IDs starting with CHEMBL (e.g. CHEMBL25) are fetched from ChEMBL.

You can freely mix both types in a single call.

Parameters:

Name Type Description Default
molecule_id Union[str, int, List[Union[str, int]]]

A single ID or a list of IDs. Each ID can be a numeric PubChem CID or a ChEMBL ID.

required
save_to Union[str, Path]

Directory to save the file(s). Defaults to the current directory.

'.'
parallel int

Number of threads to use for parallel downloading. Defaults to 4.

4

Returns:

Type Description
Union[Path, List[Path]]

Union[Path, List[Path]]: The absolute path(s) to the downloaded .sdf file(s).