rcsbsearch
Python interface for the RCSB search API.
Currently the 'text search' part of the API has been implemented. See 'Supported features' below.
This package requires python 3.7 or later.
Example
Here is a quick example of how the package is used. Two syntaxes are available for constructing queries: an "operator" API using python's comparators, and a "fluent" syntax where terms are chained together. Which to use is a matter of preference.
A runnable jupyter notebook with this example is available in notebooks/quickstart.ipynb, or can be run online using binder:
An additional example including a Covid-19 related example is in notebooks/covid.ipynb:
Operator example
Here is an example from the RCSB Search API page, using the operator syntax. This query finds symmetric dimers having a twofold rotation with the DNA-binding domain of a heat-shock transcription factor.
from rcsbsearch import TextQuery
from rcsbsearch import rcsb_attributes as attrs
# Create terminals for each query
q1 = TextQuery('"heat-shock transcription factor"')
q2 = attrs.rcsb_struct_symmetry.symbol == "C2"
q3 = attrs.rcsb_struct_symmetry.kind == "Global Symmetry"
q4 = attrs.rcsb_entry_info.polymer_entity_count_DNA >= 1
# combined using bitwise operators (&, |, ~, etc)
query = q1 & q2 & q3 & q4 # AND of all queries
# Call the query to execute it
for assemblyid in query("assembly"):
print(assemblyid)
For a full list of attributes, please refer to the RCSB schema.
Fluent Example
Here is the same example using the fluent syntax.
from rcsbsearch import TextQuery
# Start with a Attr or TextQuery, then add terms
results = TextQuery('"heat-shock transcription factor"') \
.and_("rcsb_struct_symmetry.symbol").exact_match("C2") \
.and_("rcsb_struct_symmetry.kind").exact_match("Global Symmetry") \
.and_("rcsb_entry_info.polymer_entity_count_DNA").greater_or_equal(1) \
.exec("assembly")
# Exec produces an iterator of IDs
for assemblyid in results:
print(assemblyid)
Supported Features
The following table lists the status of current and planned features.
- Attribute Comparison operations
- Query set operations
- Attribute
contains,in_(fluent only) - Sequence search
- Sequence motif search
- Structural search
- Structural motif search
- Chemical search
Contributions are welcome for unchecked items!
Installation
Get it from pypi:
pip install rcsbsearch
Or, download from github
Documentation
Detailed documentation is at rcsbsearch.readthedocs.io
License
Code is licensed under the BSD 3-clause license. See LICENSE for details.
Citing rcsbsearch
Please cite the rcsbsearch package by URL:
You should also cite the RCSB service this package utilizes:
Yana Rose, Jose M. Duarte, Robert Lowe, Joan Segura, Chunxiao Bi, Charmi Bhikadiya, Li Chen, Alexander S. Rose, Sebastian Bittrich, Stephen K. Burley, John D. Westbrook. RCSB Protein Data Bank: Architectural Advances Towards Integrated Searching and Efficient Access to Macromolecular Structure Data from the PDB Archive, Journal of Molecular Biology, 2020. DOI: 10.1016/j.jmb.2020.11.003
Developers
For information about building and developing rcsbsearch, see
CONTRIBUTING.md
Metadata
Release files for rcsbsearch 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rcsbsearch-0.2.3.tar.gz | 131.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rcsbsearch-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 262.1 kB
Release files / rcsbsearch-0.2.3.tar.gz
| Download URL | rcsbsearch-0.2.3.tar.gz |
|---|---|
| Size | 131.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63b29e6df4809a6e47a83874cd166bd3753a0df0db96e644bebff1743c08faa8
|
|
BLAKE2b-256 checksum How to use checksums |
e710253b47e8b2f1451403461d3086273f7d517f422e65f85a751357113e7e40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Release files / rcsbsearch-0.2.3-py3-none-any.whl
| Download URL | rcsbsearch-0.2.3-py3-none-any.whl |
|---|---|
| Size | 131.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a04e4167d43ce3ebe83fe3dd20ffd6c0fae3a0a7fab75991fbcca53ad430481c
|
|
BLAKE2b-256 checksum How to use checksums |
8a091175e109ac509a271dfc811fee0fe3e9cf44b192fdba72580693804a6fa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Security for rcsbsearch 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.