Metadata-Version: 2.4
Name: pypdb
Version: 2.10
Summary: A Python wrapper for the RCSB Protein Data Bank (PDB) API
Author-email: William Gilpin <firstnamelastname@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2014 William Gilpin
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        
Project-URL: Homepage, https://github.com/williamgilpin/pypdb
Project-URL: Repository, https://github.com/williamgilpin/pypdb
Project-URL: Issues, https://github.com/williamgilpin/pypdb/issues
Keywords: protein,pdb,rcsb,api,bioinformatics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pip>=26.0.1
Requires-Dist: requests>=2.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Provides-Extra: notebooks
Requires-Dist: ipykernel>=6.0; extra == "notebooks"
Requires-Dist: ipython>=8.0; extra == "notebooks"
Requires-Dist: jupyter>=1.0; extra == "notebooks"
Requires-Dist: matplotlib>=3.5; extra == "notebooks"
Requires-Dist: numpy>=1.23; extra == "notebooks"
Requires-Dist: scikit-learn>=1.2; extra == "notebooks"
Requires-Dist: scipy>=1.10; extra == "notebooks"
Dynamic: license-file

# PyPDB

A Python 3 toolkit for performing searches with the RCSB Protein Data Bank (PDB). This can be used to perform advanced searches for PDB IDs matching various criteria, as well as to look up information associated with specific PDB IDs. This tool allows standard operations that can be perfomed from within the PDB website (BLAST, PFAM lookup, etc.) to be performed from within Python scripts.

If you use this module for any published work, please consider citing the accompanying paper

      Gilpin, W. "PyPDB: A Python API for the Protein Data Bank."
      Bioinformatics, Oxford Journals, 2016.

## Installation

Install using pip:

    $ pip install pypdb

To install the development version, which contains the latest features and fixes, install directly from GitHub using

    $ pip install git+https://github.com/williamgilpin/pypdb

To install from a local checkout,

    $ pip install .

For development and test dependencies,

    $ pip install -e ".[dev]"

Test the installation, and check that the code successfully connects to the PDB, navigate to the root directory and run

    $ python -m pytest

This code has been designed and tested for Python 3.

## Usage

### PDB Text Search
This package can be used to get lists of PDB IDs associated with specific search terms, experiment types, structures, and other common criteria. To use the simple API, see the examples in [`demos/demos.ipynb`](demos/demos.ipynb). For advanced search and query logic, see the examples in [`search/EXAMPLES.md`](pypdb/clients/search/EXAMPLES.md).

### PDB Data Fetch
Given a list of PDBs, this package can be used to fetch data associated with those PDBs, including their dates of deposition, lists of authors and associated publications, their sequences or structures, their top BLAST matches, and other query-specific attributes like lists of a ligands or chemical structure. Integrated PubMed, UniProt, and structural interface data can be fetched as well. To use the simple API, see the examples in [`demos/demos.ipynb`](demos/demos.ipynb). For advanced search and query logic, see the examples in [`data/EXAMPLES.md`](pypdb/clients/data/EXAMPLES.md).

### Counting and paginating results
Searches return every matching entry by default, which can be slow for broad queries. To retrieve just a tally or the highest-scoring hits:

```python
from pypdb import count_results, get_top_results

print(count_results("ribosome"))            # 9560
print(get_top_results("crispr", max_results=5))
```

Searches can also be restricted to a page of results, scored with a particular strategy, or extended to include computed structure models (such as AlphaFold predictions) via `RequestOptions`. See [`search/EXAMPLES.md`](pypdb/clients/search/EXAMPLES.md).

## Releasing a new version

The git tag is the only place the version is written. To publish a release to PyPI, tag and push:

```bash
git tag v2.9 && git push origin v2.9
```

That's the whole process — there is no version file to edit. [setuptools-scm](https://setuptools-scm.readthedocs.io/) derives the package version from the tag at build time and writes it into `pypdb/_version.py`, which is generated rather than checked in (it is listed in `.gitignore`).

Pushing a `v*` tag runs the tests, builds the distributions, and uploads them to PyPI. This uses [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/), so no API token is stored in the repository — it requires a one-time publisher registration on PyPI pointing at the `python-publish.yml` workflow and the `pypi` environment.

Between releases, `pypdb.__version__` reports a development version derived from the most recent tag (e.g. `2.9.dev1+g1a2b3c4`).

## Issues and Feature Requests

If you run into an issue, or if you find a workaround for an existing issue, please post your question or code as a GitHub issue.

If posting a feature request, please check that your request is possible using [the current GUI on current RCSB website](https://www.rcsb.org/search/advanced). If so, please perform your search, and then click the link that says `JSON` in the upper right hand corner of the Advanced Search box. Please post that JSON code with your feature request.



