Bioinformatic requisitions
Project description
BioReqs: Bioinformatic Requisitions
bioreqs is a Python library that defines lightweight client interfaces
for a number of publicly accessible, scientific 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bioreqs-0.1.0.dev1.tar.gz.
File metadata
- Download URL: bioreqs-0.1.0.dev1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c86296fc29d96a1114746d4c02fafa4e93b9685e2cace2b24f22b1a53b885847
|
|
| MD5 |
98dc69c874a4e55a16192a9c2a6f1b4b
|
|
| BLAKE2b-256 |
3026d33d8afe12cddd9323c7901f8072e2bb8118f2564cfcf9f43d8627583e91
|
File details
Details for the file bioreqs-0.1.0.dev1-py3-none-any.whl.
File metadata
- Download URL: bioreqs-0.1.0.dev1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e50b8ca491dfd50d90f7237b082664875ed65ec51df1c8a0fe37a15e2efe59d5
|
|
| MD5 |
ca758df07ae262355a019309e2370811
|
|
| BLAKE2b-256 |
2e81fcfd607cfb246d3273e5c3e401efe4643fc020807b956d29498c7ed5b294
|