Skip to main content

Access the RCSB Search API

Project description

PyPi Release Build Status Documentation Status

rcsbsearch

Python interface for the RCSB search API.

Currently the 'text search' part of the API has been implemented.

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 "builder" syntax where terms are chained together. Which to use is a matter of preference.

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)

Builder Example

Here is the same example using the builder 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)

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:

https://rcsbsearch.readthedocs.io

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rcsbsearch-0.2.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rcsbsearch-0.2.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file rcsbsearch-0.2.2.tar.gz.

File metadata

  • Download URL: rcsbsearch-0.2.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for rcsbsearch-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b59b6a86dbd5211419395d4d43cbec4ee44e2fe8c8bf5c3eeb69c18b6acb0516
MD5 3326c42c367bf068c382b359bc11ada6
BLAKE2b-256 ad3ea4aeafc507f4ac2a5c13ea4f84d87c9c6809dc55e4579cfc184f7fc9e16c

See more details on using hashes here.

File details

Details for the file rcsbsearch-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rcsbsearch-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for rcsbsearch-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79baefdf52d0e7e9eb579a530c080d4a69e1e45bc4e59ddb6f3c3b408458633b
MD5 7a2cf24e81bb3ff2b144ef421a6543d4
BLAKE2b-256 f6bb0f9ce5b1b1f12fd67fdcac6bf96666faf097db4dabd508367163dc19e91e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page