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.

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.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

rcsbsearch-0.2.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rcsbsearch-0.2.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1.post20200515 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for rcsbsearch-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a2300e08b38cd593226f392a51dcc3d5a573727075f72e0f4865d8c7bc9557f4
MD5 268759e85389da5594e3a744ed258022
BLAKE2b-256 cb22d6673e0a087292bc2cc0aa32b87a90c9f569e9a13e34ebf72fc3812e5d06

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rcsbsearch-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1.post20200515 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for rcsbsearch-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2800428d2d1b5be9373f1875c0694e87fe07cf8ffef3c409a9e8513d27e7980
MD5 3d78c7d1a439f9eb24b6e918656b8071
BLAKE2b-256 994eb713a403dbd1aeb744acc1bed2e282322ddb8abf1e83224babcc07960d05

See more details on using hashes here.

Supported by

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