fetch#
- biotite.database.rcsb.fetch(pdb_ids: str | Iterable[str], format: Literal['pdb', 'pdbx', 'cif', 'mmcif', 'bcif', 'fasta'], target_path: str | PathLike[str] | None = None, overwrite: bool = False, gzip: bool = False) Path | StringIO | BytesIO | list[Path] | list[StringIO | BytesIO][source]#
Download structure files (or sequence files) from the RCSB PDB in various formats.
This function requires an internet connection.
- Parameters:
- pdb_idsstr or iterable object of str
A single PDB ID or a list of PDB IDs of the structure(s) to be downloaded.
- format{‘pdb’, ‘pdbx’, ‘cif’, ‘mmcif’, ‘bcif’, ‘fasta’}
The format of the files to be downloaded.
'pdbx','cif'and'mmcif'are synonyms for the same format.- target_pathstr or PathLike, optional
The target directory of the downloaded files. By default, the file content is stored in a file-like object (
StringIOorBytesIO, 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.
- gzipbool, optional
If set to true, the file will be downloaded in gzipped format. If format is not
None, the written files get the additional.gzextension. Not supported for"fasta"format.
- Returns:
- filesPath or StringIO or BytesIO or list of (Path or StringIO or BytesIO)
The file path(s) to the downloaded files. If a single PDB ID was given in pdb_ids, a single
Pathis returned. If a list (or other iterable object) was given, a list ofPathobjects is returned. If no target_path was given, the file contents are stored in eitherStringIOorBytesIOobjects.
Warning
Even if you give valid input to this function, in rare cases the database might return no or malformed data to you. In these cases the request should be retried. When the issue occurs repeatedly, the error is probably in your input.
Examples
>>> file = fetch("1l2y", "cif", path_to_directory) >>> print(file.name) 1l2y.cif >>> files = fetch(["1l2y", "3o5r"], "cif", path_to_directory) >>> print([file.name for file in files]) ['1l2y.cif', '3o5r.cif']
Gallery#
Mutual information as measure for coevolution of residues
Three ways to get the secondary structure of a protein
Visualization of normal modes from an elastic network model
Multiple Structural alignment of orthologous proteins
Searching for structural homologs in a protein structure database
Identifying unresolved regions in protein structures