biotite.database.rcsb.fetch(pdb_ids, format, target_path, overwrite=False, verbose=False)[source]

Download structure files from the RCSB PDB in various formats.

This function requires an internet connection.

pdb_ids : str or iterable object of str

A single PDB ID or a list of PDB IDs of the structure(s) to be downloaded .

format : str

The format of the files to be downloaded. ‘pdb’, ‘pdbx’, ‘cif’ or ‘mmtf’ are allowed.

target_path : str

The target directory of the downloaded files.

overwrite : bool, optional

If true, existing files will be overwritten. Otherwise the respective file will only be downloaded if the file does not exist yet in the specified target directory. (Default: False)

verbose: bool, optional

If true, the function will output the download progress. (Default: False)

files : str or list of str

The file path(s) to the downloaded files. If a single string (a single ID) was given in pdb_ids, a single string is returned. If a list (or other iterable object) was given, a list of strings is returned.


>>> import os.path
>>> files = fetch(["1l2y", "3o5r"], "cif", path_to_directory)
>>> print([os.path.basename(file) for file in files])
['1l2y.cif', '3o5r.cif']