biors-python
Python bindings for bio-rs via PyO3.
Installation
pip install biors
Requires Python 3.9+.
Quickstart
import json
import biors
fasta_text = (
">seq1\nACDEFGHIKLMNPQRSTVWY\n"
">seq2\nMKWVTFISLLFLFSSAYSRGVFRRDAHKSEVAHRFKDLGEENFKALVLIAFAQYLQQCP\n"
)
# Parse FASTA text
records = biors.parse_fasta_records(fasta_text)
# Validate
report = biors.validate_fasta_input(fasta_text)
rna_report = biors.validate_fasta_input_with_kind(">rna\nACGUN\n", "rna")
print(f"Valid records: {report.valid_records}/{report.records}")
for record in report.sequences:
for issue in record.warnings:
print(f"{record.id}: ambiguous residue {issue.residue} at {issue.position}")
for issue in record.errors:
print(f"{record.id}: invalid residue {issue.residue} at {issue.position}")
# Tokenize
tokenized = biors.tokenize_fasta_records(fasta_text)
for t in tokenized:
print(t.id, t.alphabet, t.valid, t.tokens)
for issue in t.warnings + t.errors:
print(issue.residue, issue.position)
# Tokenize one in-memory sequence with a caller-provided ID
single = biors.tokenize_protein("ACDEFG", id="sample-001")
print(single.id, single.tokens)
# DNA/RNA use explicit tokenizer profiles.
dna = biors.tokenize_fasta_records(">dna\nACGT\n", profile="dna-iupac")
rna_workflow = biors.prepare_workflow_from_fasta(
">rna\nACGU\n",
max_length=8,
profile="rna-iupac",
)
# Build model input
model_input = biors.build_model_inputs_checked(
tokenized,
max_length=512,
pad_token_id=0,
padding="fixed_length",
)
for r in model_input.records:
print(r.id, r.input_ids, r.attention_mask)
# End-to-end workflow
output = biors.prepare_workflow_from_fasta(
fasta_text,
max_length=512,
pad_token_id=0,
padding="fixed_length",
)
print(f"Model ready: {output.model_ready}")
print(output.report_json)
# Validate a package on disk, including artifact paths and checksums.
package_report = json.loads(
biors.validate_package_manifest_file("./protein-package/manifest.json")
)
print(package_report["valid"])
validate_package_manifest(manifest_json) is field-only validation for an
in-memory manifest. Use validate_package_manifest_artifacts(manifest_json, base_dir) or validate_package_manifest_file(manifest_path) when package
files, checksums, and layout placement must be verified.
Errors raised by core parsing, model-input, and package helpers are
BioRsError values with stable code, message, and optional location
attributes, while still subclassing ValueError.
Development
Build locally with maturin:
cd crates/biors-python
maturin develop
pytest
License
MIT OR Apache-2.0
Metadata
Release files for biors 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| biors-1.0.0.tar.gz | 175.2 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| biors-1.0.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| biors-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| biors-1.0.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 1.8 MB
Release files / biors-1.0.0.tar.gz
| Download URL | biors-1.0.0.tar.gz |
|---|---|
| Size | 175.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39e3531abb2c2f83beb5f9fca69ec6d49be765edc3aa94f07da00c5d4aa73eb1
|
|
BLAKE2b-256 checksum How to use checksums |
bdb000d9dea4af63fdaf483cddf2b0d1603abb3573c9f9d0277c61b1e93650a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / biors-1.0.0-cp39-abi3-win_amd64.whl
| Download URL | biors-1.0.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 439.2 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f0e97668229ff6d00a60424149d4de75f36d10c549a9310642401a111fb00965
|
|
BLAKE2b-256 checksum How to use checksums |
15358fa91752b38edd2f8ad51f6cad3c60d16a6f5f0583515e4803ab9d53a599
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / biors-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | biors-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 624.2 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d1c05ed4f77018b50f3a36d1181eea2db586e9e7db1fceb0de3fbc17774418c3
|
|
BLAKE2b-256 checksum How to use checksums |
6e443a463f351a059810da5ad774d37fe62d8f525bbf206fe52d6a1708f38e70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / biors-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | biors-1.0.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 559.6 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
86ec5e40e01055a302768f3276ded0bf7300d12cd2fa6c236794922d9a76fa95
|
|
BLAKE2b-256 checksum How to use checksums |
f135de51957add07b8751c08d80b499f922e73b9e62a57613caab23e76262c5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Security for biors 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.