Skip to main content

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.


Releasing

Releases are published to PyPI by .github/workflows/publish.yml, triggered by pushing a v* tag. The workflow builds wheels for Linux (x86_64, aarch64), macOS (universal2), and Windows (x86_64), plus an sdist, then uploads via maturin upload.

One-time setup: a pypi GitHub environment with a PYPI_API_TOKEN secret.

To cut a release:

  1. Bump version in Cargo.toml. The workflow's check-version job fails if the tag and Cargo.toml version don't match.
  2. Commit the bump.
  3. Tag and push:
    git tag vX.Y.Z
    git push origin main --tags
    
  4. Watch the Publish to PyPI workflow in the Actions tab.

Uploads use --skip-existing, so re-running on an already-published version is safe.

Release files for seqa-py 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seqa-py 0.3.5
File Size Uploaded
seqa_py-0.3.5.tar.gz 33.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for seqa-py 0.3.5
File
seqa_py-0.3.5-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
seqa_py-0.3.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
seqa_py-0.3.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
seqa_py-0.3.5-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.8 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details

Total release size: 18.8 MB

Release files / seqa_py-0.3.5.tar.gz

Download URL seqa_py-0.3.5.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0c12d195544b5d51a431c2fa2bf4801e072b55685c8f3d45713f7901792364b2
BLAKE2b-256 checksum
How to use checksums
82e72c51f417eb6eedebb379dba4783a5c8fa675b9369d936a33aab7d95ab39d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.13.1

Release files / seqa_py-0.3.5-cp38-abi3-win_amd64.whl

Download URL seqa_py-0.3.5-cp38-abi3-win_amd64.whl
Size 3.4 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e6a0646b6d4af6ed5094a8866f3dfa953829b0bc6d9037b0eb2469cf98eb3606
BLAKE2b-256 checksum
How to use checksums
f9025543f751f12bea53eb502f108cf7f8c924ecd75c5016c6fc3c2b60d15d38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.13.1

Release files / seqa_py-0.3.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL seqa_py-0.3.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.0 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2667ccbe3b92cb423927391b2a2ecbce6faa9f525c3cb0aa0dc82f983465f830
BLAKE2b-256 checksum
How to use checksums
443a05f0c7265ddf47c20a48e22817123a8a2869e58c527ec6e184cf4770b58c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.13.1

Release files / seqa_py-0.3.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL seqa_py-0.3.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.0 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
87b2a8b7723c4525a6a9b713fa07edbc81291d8db58e2a09663df08484b20df2
BLAKE2b-256 checksum
How to use checksums
dd1d7c23f9b9ce233a5ab897ae3a977a9460bf4766614f96c9f9b24bbf7723d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.13.1

Release files / seqa_py-0.3.5-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL seqa_py-0.3.5-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 7.3 MB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ba0263a362b03d0ab1452503e34f373f6e59fa65b91d72cfcd402fc2ae675931
BLAKE2b-256 checksum
How to use checksums
a8bb7fae8154443f9fe9ccd094111650f23361d32a5dbc2f1f6f7ca97fd3ebe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.13.1

Release history Release notifications | RSS feed

This release

0.3.5 This release

5 release files

0.3.4

5 release files

0.3.3

5 release files

0.3.2

5 release files

0.3.1

5 release files

0.3.0

5 release files

0.2.1

2 release files

0.1.1

5 release files

0.1.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page