plinder.core.utils.io#

Wrap all network requests in a retry decorator and use a convention of looking for a file in a pre-determined location before fetching it from the network.

plinder.core.utils.io.get_pdb_revision(pdb_or_system_id: str, *, manifest_path: Path | str | None = None) → tuple[int, int][source]#

Return the exact source mmCIF revision pinned by this release.

plinder.core.utils.io.pdb_mmcif_cache_path(pdb_or_system_id: str, *, cache_dir: Path | str | None = None, revision: tuple[int, int] | None = None, manifest_path: Path | str | None = None) → Path[source]#

Return the deterministic local path for a version-pinned PDB mmCIF.

plinder.core.utils.io.get_pdb_mmcif(pdb_or_system_id: str, *, cache_dir: Path | str | None = None, force_update: bool = False, revision: tuple[int, int] | None = None, manifest_path: Path | str | None = None, base_url: str = 'https://files-versioned.wwpdb.org/pdb_versioned/data/entries') → Path[source]#

Return the release-pinned source mmCIF, downloading it when allowed.

Online calls populate the release-local cache atomically. In offline mode the function performs no network or filesystem writes: a valid cached file is returned and a missing or corrupt file raises FileNotFoundError.

plinder.core.utils.io.download_pdb_mmcifs(pdb_or_system_ids: Iterable[str], *, cache_dir: Path | str | None = None, force_update: bool = False, max_workers: int = 8, manifest_path: Path | str | None = None) → dict[str, Path][source]#

Prefetch a release-pinned subset of PDB mmCIFs for offline use.

plinder.core.utils.io.retry(func: Callable[[...], T]) → Callable[[...], T][source]#
plinder.core.utils.io.download_alphafold_cif_file(uniprot_id: str, output_folder: Path, url: str = 'https://alphafold.ebi.ac.uk/files', force_update: bool = False) → Path | None[source]#