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.dev2.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.dev2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bioreqs-0.1.0.dev2.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.dev2.tar.gz
Algorithm Hash digest
SHA256 c6b471574b308a3060e5b6d2e3672010aceeb99c10a51be1c1f4d78f191619a4
MD5 459a1e5731e031a71c9f39650ff4657c
BLAKE2b-256 9a3c19ef91fff3d2fe36014f948264539e64255d8beff790fd72c9293f5b9da0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bioreqs-0.1.0.dev2-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.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 11a05a0b51a5ed3c3854e9424ea5de407e33e913dfa5e0fd27e58d9121b49133
MD5 49f1794e69f258c7f73e7214e6d78635
BLAKE2b-256 5d91d2a6f1962757207fe64b332627b01e6a5b84fd2955df296288870347abe3

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