Skip to content

fetch

Module for fetching structures from PDBe.

fetch(ids, save_dir, max_parallel_downloads=5, cacher=None) async

Fetches mmCIF files from the PDBe database.

Parameters:

Name Type Description Default
ids Iterable[str]

A set of PDB IDs to fetch.

required
save_dir Path

The directory to save the fetched mmCIF files to.

required
max_parallel_downloads int

The maximum number of parallel downloads.

5
cacher Cacher | None

An optional cacher to use for caching downloaded files.

None

Returns:

Type Description
Mapping[str, Path]

A dict of id and paths to the downloaded mmCIF files.

read_pdb_ids_from_csv(file)

Reads PDB IDs from a CSV file.

The CSV file can provide PDB IDs in the pdb_id column. It can also provide generic identifiers through the model_provider and model_identifier columns. In that case, only rows with model_provider == "pdbe" are used. If the CSV contains only one column, every value in that column is treated as an ID, including the first row.

Parameters:

Name Type Description Default
file Path

A path to a file containing the CSV data.

required

Returns:

Type Description
set[str]

A set of PDB IDs extracted from the CSV file.

sync_fetch(ids, save_dir, max_parallel_downloads=5)

Synchronously fetches mmCIF files from the PDBe database.

Parameters:

Name Type Description Default
ids Iterable[str]

A set of PDB IDs to fetch.

required
save_dir Path

The directory to save the fetched mmCIF files to.

required
max_parallel_downloads int

The maximum number of parallel downloads.

5

Returns:

Type Description
Mapping[str, Path]

A dict of id and paths to the downloaded mmCIF files.