Skip to main content

Bioinformatic requisitions

Project description

BioReqs: Bioinformatic Requisitions

PyPI Python Version License

bioreqs is a Python library that defines lightweight client interfaces for a number of publicly accessible, bioinformatics-focused web APIs, including those from organizations like the National Center for Biotechnology Information (NCBI). In so doing, it provides users with programmatic access to essential bioinformatics data without also requiring them to have an overt familiarity with their underlying API schemata.

Quick Start

If you're using a dependency manager like uv or poetry and plan to invoke bioreqs clients from within a project context, simply add it to your pyproject.toml dependency list:

  • poetry: poetry add bioreqs
  • uv: uv add bioreqs

On the other hand, if you're using vanilla pip but still want to work out of a virtual environment (as you should!), do:

python -m venv rqenv           # Create a new virtual environment named `rqenv`.
source ./rqenv/bin/activate    # Activate the `rqenv` virtual environment.
pip install --upgrade pip      # Upgrade to the latest version of `pip`.
pip install bioreqs       # Install the `bioreqs` package.

Finally, if you only want to use it interactively — or in a script meant to be invoked by your system-level Python interpreter — you can simply do:

# Assuming the system-level `pip` binary is in your `PATH` environment variable:
pip install --upgrade pip      # Upgrade to the latest version of `pip`.
pip install bioreqs       # Install the library system-wide.

Each of the package's modules corresponds to an individual organization and implements the relevant API client(s) for that organization. As a convenience, all clients are also surfaced at the package level, making them directly available in the bioreqs namespace. Thus, for example, to initialize a client object for the NCBI's popular Entrez E-utilities web API, the following code suffices:

# Import the Entrez E-utilities API client.
# from bioreqs.ncbi import Entrez
#
# Or, equivalently:
from bioreqs import Entrez

# Initialize the client, providing a valid email address, as required.
client = Entrez("email@example.com")

Clients

Presently, bioreqs provides only the above introduced client for the Entrez E-utilities web API, but it will hopefully tout a much more robust client library soon enough.

Entrez E-utilities (NCBI)

Use bioreqs.ncbi.Entrez and its instance methods to interact with the E-utilities web API. Since the NCBI requires one to include their email address when querying these endpoints, you should call Entrez with yours as the first argument. Alternatively, you can set your system's NCBI_EMAIL environment variable to store your email address; Entrez automatically detects it.

from bioreqs import Entrez

# Assuming the `NCBI_EMAIL` environment variable is set to your email address,
# this is a valid invocation of the `Entrez` constructor.
client = Entrez()

After creating and storing an instance of the API client (client, in the example above), you call instance methods on that object to query specific endpoints:

# Get the RefSeq for human COL5A2 as a FASTA-formatted string via its accession.
COL5A2_ACCESSION = "NM_000393.5"
COL5A2_REFERENCE = client.get_refseq(COL5A2_ACCESSION)
print(COL5A2_REFERENCE)  # Print the FASTA output.

# Download the FASTA-formatted RefSeq data for human kallikrein-related
# peptidase 15 via its accession, and write it to disk, storing the returned
# output path, if successful.
KLK15_ACCESSION = "NM_001277081.2"
ouput_path = client.save_refseq(KLK15_ACCESSION)

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

bioreqs-0.1.0.dev3.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

bioreqs-0.1.0.dev3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file bioreqs-0.1.0.dev3.tar.gz.

File metadata

  • Download URL: bioreqs-0.1.0.dev3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bioreqs-0.1.0.dev3.tar.gz
Algorithm Hash digest
SHA256 63d41b4c3d2c846565b4e4a239b9dfbc16d7bb0600d13f72f9817a53ad858d0d
MD5 7a5fca0ddfbab6228789d5175d83e1d0
BLAKE2b-256 84ba77300427805603e4a93c13ed7ed69f1474624632584802dca4ae0dd8b6fd

See more details on using hashes here.

File details

Details for the file bioreqs-0.1.0.dev3-py3-none-any.whl.

File metadata

  • Download URL: bioreqs-0.1.0.dev3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bioreqs-0.1.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 f619163056bbc78510000a2ce22d553ffd1433be854e6269590f5036b8adf487
MD5 7cac7bca8482e4794ec0fd48fc45f202
BLAKE2b-256 a792ed1493a6bc1d55bb498ad06dbc6440f1abb467ec08e9bf12d0b22b8ca04e

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