Skip to main content

Python library for querying genomic files across cloud and local storage

Reason this release was yanked:

changing to apache license

Project description

seqa_py

Python library for querying genomic files (BAM, VCF, BED, BigWig, BigBed, FASTA, GFF, GTF) across local and cloud storage. Built on seqa_core via PyO3.

Installation

Requires uv and a Rust toolchain (rustup).

git clone <repo>
cd seqa_py
uv run maturin develop   # compile the Rust extension
uv sync --all-groups     # install runtime + dev dependencies (pytest, ruff, maturin)

After any change to src/lib.rs, re-run maturin develop.

Quick start

from seqa_py import file_search

lines = file_search("s3://my-bucket/sample.vcf.gz", "chr1:100000-200000")
for line in lines:
    print(line)

file_search

file_search(
    file_path: str,
    coordinates: str,
    include_header: bool = True,
    header_only: bool = False,
    genome: str | None = None,
) -> list[str]

Returns a list of tab-delimited result lines.

Parameter Description
file_path Local path or cloud URI (s3://, az://, gs://, https://)
coordinates Genomic region — see formats below
include_header Include file header lines in the result (default True)
header_only Return only header lines, no data records (default False)
genome Reference build for whole-chromosome length resolution: hg38, hg19, grch38, grch37

Coordinate formats

Input Meaning
chr1:100000-200000 Range
chr1:100000 Single position
chr1:100,000-200,000 Commas ignored
chr1 Whole chromosome

Supported file types

Extension Format
.bam BAM (requires .bai index alongside)
.vcf.gz VCF (requires .tbi index)
.bed.gz / .bed BED (requires .tbi index)
.bedgraph.gz BedGraph (requires .tbi)
.gff.gz GFF3 (requires .tbi)
.gtf.gz GTF (requires .tbi)
.bw / .bigwig BigWig (self-indexed)
.bb / .bigbed BigBed (self-indexed)
.fa / .fasta FASTA (requires .fai index)

Index files must be at <file>.<ext> — e.g. sample.bam.bai, variants.vcf.gz.tbi. BigWig and BigBed embed their own index and need no companion file.

Errors

file_search raises ValueError for invalid paths, unsupported extensions, bad coordinates, or search failures.


Cloud credentials

Set environment variables before querying cloud files. A .env file in the working directory is loaded automatically.

AWS S3

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
S3_BUCKET=

Azure Blob Storage

AZURE_TENANT_ID=
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_STORAGE_ACCOUNT=
AZURE_STORAGE_CONTAINER=

Google Cloud Storage

GOOGLE_STORAGE_ACCOUNT=
GOOGLE_BUCKET=

Copy .env.example to .env and fill in the values.


Development

uv run maturin develop          # rebuild Rust extension
uv sync --all-groups            # restore dev dependencies (maturin develop resets the venv)
uv run pytest                   # all tests
uv run pytest tests/test_local.py -v    # local tests only (no cloud creds needed)
uv run ruff check .             # lint
uv run ruff format .            # format

Tests in tests/test_cloud.py are skipped automatically unless the relevant credentials are present in the environment.

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

seqa_py-0.3.1.tar.gz (40.8 kB view details)

Uploaded Source

Built Distributions

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

seqa_py-0.3.1-cp38-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.8+Windows x86-64

seqa_py-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

seqa_py-0.3.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

seqa_py-0.3.1-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (7.4 MB view details)

Uploaded CPython 3.8+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file seqa_py-0.3.1.tar.gz.

File metadata

  • Download URL: seqa_py-0.3.1.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.1

File hashes

Hashes for seqa_py-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7c2f54e1d2849d2dc0046dd89b7a1acb1ca120f62ab672b4f92b9c5233f668bc
MD5 fd7524ade8c4f30baf2d079f30db5d67
BLAKE2b-256 887bd42ac843014aad1bc0bc617834426e5d5fec23af124ca0d009aef5ed4f8c

See more details on using hashes here.

File details

Details for the file seqa_py-0.3.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: seqa_py-0.3.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.1

File hashes

Hashes for seqa_py-0.3.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 306753e6588744ba3f396c61098caae0fec2df48844529d56d17b670689c8f2c
MD5 7dc2f1edfd1c96785476e5761cd3c96b
BLAKE2b-256 fec61edd48d26b65913b812bbdb9968b4e713bf138ea6f7802e3a24ee151f11d

See more details on using hashes here.

File details

Details for the file seqa_py-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for seqa_py-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d26540fd1ecb655a1e032acf7921414f233e7d9ed53eff0cc898af1051ef1a5d
MD5 0a4659900b126351d61051c16a8a94a2
BLAKE2b-256 56ab01a8ddfb7bdfc204ae0277728c6a8f6e1c50a313e97ba2fb2cae760524f8

See more details on using hashes here.

File details

Details for the file seqa_py-0.3.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for seqa_py-0.3.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 450e5eca8986f18f85428bf5bb3b46c785b31f4cc054a73a946f17886b7406df
MD5 1bc608da6cda0e0e4e3d70ed4bbc94ac
BLAKE2b-256 69fef104039311653bd0a96fa1c6f3fc779188309432b934ff72c41a3860b811

See more details on using hashes here.

File details

Details for the file seqa_py-0.3.1-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for seqa_py-0.3.1-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 438bb75827b33f262a4c32ddd2948da82ca9da1442c1ba08e9b2523a3239bd5a
MD5 b996f2f1e77166f486b3c1a7b8ab7d3f
BLAKE2b-256 40f791bccbc012901c30fe6d832fadfbe11c0efcfcc25d95bae3985ab7bcbf55

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