Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

auroraomics

Virtual spatial transcriptomics from H&E histology.

This package holds the pieces of that pipeline that are pure Python, so the same code runs on your laptop, in a GPU container and on the service:

  • auroraomics.qc — the three patch-quality predicates (foreground, blur, stained tissue) applied to every candidate tile before a model sees it, and the short-circuiting cascade that combines them.
  • auroraomics.pack — build the patches archive a prediction takes as input (pack_tiles), and validate one you have been handed (read_archive).
  • auroraomics.h5ad — write the standard .h5ad result with h5py alone, streaming the expression matrix batch by batch so peak memory is one batch rather than the whole matrix.
  • auroraomics.subsample — pick the densest contiguous square of spots when a slide yields more tiles than a run is allowed to spend.
  • auroraomics.contracts — the shared contract values (container layout, input-kind caps, result layout) as data, so nothing here re-types a number the service also reads.

Install

pip install auroraomics

The core needs only numpy, h5py, OpenCV and Pillow. Extras add the API client (client), a local model runtime (deepspotm) and pyramidal slide reading (slide).

Pack tiles, then look at the report

import auroraomics as ao

report = ao.pack_tiles(tiles, "sample.zip", mpp=0.499, thumbnail=thumb)
print(report.written, "tiles kept,", report.rejected, "dropped")
print(report.rejected_by_reason)          # {'foreground_ratio': 12, ...}

tiles is any iterable of ao.Tile(image, x, y), where image is an RGB uint8 array and x/y are the tile's top-left position in full-resolution pixels. Tiles are quality-checked as they stream past, and only the ones that pass are written, so an iterable that reads a slide lazily never has to hold more than one tile in memory.

Validate an archive before trusting it

archive = ao.read_archive("sample.zip")   # raises ArchiveError on anything odd
for tile in archive.tiles():              # decoded one at a time
    ...

read_archive checks the member names, the manifest, the tile geometry and the declared sizes before decoding a single pixel, and refuses an archive whose members do not match the container contract.

Write a result

ao.write_result(
    "result.h5ad",
    obs=obs,                    # per-spot columns, as plain arrays
    var=var,                    # per-gene columns, indexed by gene id
    spatial=coords,             # (n_spots, 2) array -> obsm["spatial"]
    x=batches,                  # an array, or an iterable of row batches
    uns={"model": {"id": "..."}},
    layers={"image_only": other_batches},
)

The file reads back as an ordinary AnnData in anndata 0.10 and 0.11. Passing an iterable for x streams it: each batch is compressed into the file as it arrives and then dropped, which is what makes a matrix larger than memory writable.

Typing

The package ships py.typed, so annotations are visible to type checkers in your project.

Licence

The code in this package is licensed under PolyForm Noncommercial 1.0.0, which permits use for any purpose that is not commercial. It is the same licence the model package this client is built for carries, so installing both puts you under one rule rather than two.

The model weights are licensed separately by whoever publishes them, and access to them may be gated. Read those terms before you use a model: they are not this licence, and a permission granted here is not a permission granted there.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auroraomics-0.1.0.dev0.tar.gz (481.6 kB view details)

Uploaded Source

Built Distribution

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

auroraomics-0.1.0.dev0-py3-none-any.whl (507.9 kB view details)

Uploaded Python 3

File details

Details for the file auroraomics-0.1.0.dev0.tar.gz.

File metadata

  • Download URL: auroraomics-0.1.0.dev0.tar.gz
  • Upload date:
  • Size: 481.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for auroraomics-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 798a56fbb3b82b513e03e460eb043c05928e27cf85ffa2560e4b7685d925e899
MD5 6ab32d07b9a6012feae272007a134a00
BLAKE2b-256 4f081c9104311739ca931ab4714fc89f8a8cbe8b50fef5562b5e945fa2e1faa5

See more details on using hashes here.

File details

Details for the file auroraomics-0.1.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for auroraomics-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 c07db52826bab0e49626734990a1d4c09145144aa62ec95d71c636202328dfc7
MD5 ae4359d92ca35dae7ba1c4b3e93b8443
BLAKE2b-256 ee0da97ca3f5d53c2ec7596b71383faf58d653780360127917a3b7ad5b67e01a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0.dev0 This release

2 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