molsysmt.form.file_bcif_gz.download#

molsysmt.form.file_bcif_gz.download(pdb_id=None, output_filename=None, tempfile=False, wwPDB_Partner='RCSB PDB', retries=5, timeout=30, backoff_base=2.0)[source]#

Download <pdb_id>.bcif.gz from the specified wwPDB partner, handling rate limiting (HTTP 429) and transient network errors with retries and exponential backoff + jitter.

Parameters:
  • pdb_id (str) – 4-character PDB ID (case-insensitive).

  • tempfile (bool, default True) – If True, create a temporary filename via MolSysMT’s temp_filename(). If False and output_filename is None, the output will be “<pdb_id>.bcif.gz” in the current directory.

  • wwPDB_Partner (str, default 'RCSB PDB') – wwPDB partner source. Currently only ‘RCSB PDB’ is supported.

  • output_filename (str or None, default None) – If provided, write to this path. Otherwise it is computed from tempfile/pdb_id.

  • retries (int, default 5) – Maximum number of attempts before failing.

  • timeout (int or float, default 30) – Per-request timeout (seconds).

  • backoff_base (float, default 2.0) – Exponential backoff base. Retry wait ~ (backoff_base ** attempt) + jitter.

Returns:

Path to the downloaded file.

Return type:

str

Raises:
  • NotImplementedError – If the partner is not supported.

  • RuntimeError – If retries are exhausted or a non-recoverable HTTP error occurs (e.g., 404).