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.2.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.2-cp38-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.8+Windows x86-64

seqa_py-0.3.2-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.2-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.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (7.3 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.2.tar.gz.

File metadata

  • Download URL: seqa_py-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 97d31905abb4fc507bfc18a44f5a628a4f5dc189e1b3cfdf1d7ee248921aac94
MD5 e1c9f8ff443858a2e9b67d398fdafae7
BLAKE2b-256 ba284e78e537be25e0976ccfbf0141bb639d17fe3c0bedfb8fb0746c08a75655

See more details on using hashes here.

File details

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

File metadata

  • Download URL: seqa_py-0.3.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.4 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.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 04a10b3e69f055fe5d0db70e37ae5a8e1e546a17e5da6f69cac7d9ee27f804b0
MD5 21c850e4e4561fca403769bc0cbafa89
BLAKE2b-256 89093336bcce34292530a423d61e23a9e289f8104b4b4547704cb3171546e88c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for seqa_py-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b0c0b26d9e3cf99ed3e9733aea58d8bddfce09c6e158a486231a1146a02456a
MD5 9bf5d4d412792a1abc5b3a5143dbfb1d
BLAKE2b-256 8e9ea62b9a782f3238cd8a0cba06bab7cdd80dbc0bc108aaa61c7dba0c014e98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for seqa_py-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b73560757c8d3214b3e196c71ab958a1af5349fb75025ea1ba1e044d1d3de379
MD5 7e0bbecd6113dfacf0cb2eeab48988c5
BLAKE2b-256 d755aa35201bd47359fc85edf831d798690218e1b078695c0b359dac3d598726

See more details on using hashes here.

File details

Details for the file seqa_py-0.3.2-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.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d3ac31ba3d063b7084d4f7a76344d211af9ee7401298d0dd5feb8c44266d75a9
MD5 a468a8ece0cef9b40c47a538236f15ed
BLAKE2b-256 730237735b35e51c52a65dbf1505d9e5788bd139d781db84589cd884869b8a9c

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