fetch
#
- biotite.database.afdb.fetch(ids, format, target_path=None, overwrite=False, verbose=False)[source]#
Download predicted protein structures from the AlphaFold DB.
This function requires an internet connection.
- Parameters:
- idsstr or iterable object of str
A single ID or a list of IDs of the file(s) to be downloaded. They can be either UniProt IDs (e.g.
P12345
) or AlphaFold DB IDs (e.g.AF-P12345F1
).- format{‘pdb’, ‘pdbx’, ‘cif’, ‘mmcif’, ‘bcif’, ‘fasta’}
The format of the files to be downloaded.
- target_pathstr, optional
The target directory of the downloaded files. By default, the file content is stored in a file-like object (StringIO or BytesIO, respectively).
- overwritebool, 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 or if the file is empty.
- verbosebool, optional
If true, the function will output the download progress.
- Returns:
- filesstr or StringIO or BytesIO or list of (str or StringIO or BytesIO)
The file path(s) to the downloaded files. If a single string (a single ID) was given in ids, a single string is returned. If a list (or other iterable object) was given, a list of strings is returned. If no target_path was given, the file contents are stored in either
StringIO
orBytesIO
objects.
Examples
>>> from pathlib import Path >>> file = fetch("P12345", "cif", path_to_directory) >>> print(Path(file).name) P12345.cif >>> files = fetch(["P12345", "Q8K9I1"], "cif", path_to_directory) >>> print([Path(file).name for file in files]) ['P12345.cif', 'Q8K9I1.cif']