Skip to main content

spoars (Python)

Python bindings for spoars — a faithful, SIMD-accelerated native-Rust reimplementation of the spoa partial order alignment (POA) library, for consensus generation and multiple sequence alignment.

Install

pip install spoars

Usage

import spoars

# One-call convenience:
g = spoars.poa(["ACGTACGT", "ACGTTCGT", "ACGTACGT"])
print(g.consensus())  # "ACGTACGT"
print(g.msa())  # ['ACGTACGT', 'ACGTTCGT', 'ACGTACGT']

# Or build incrementally, with an alignment type and scoring:
g = spoars.Poa(alignment_type="global", scoring=spoars.Scoring.default())
for read in ["ACGTACGT", "ACGTTCGT", "ACGTACGT"]:
    g.add(read)
print(g.consensus(min_coverage=2))
print(g.gfa())  # GFA v1
print(g.dot())  # Graphviz DOT

# Consensus with per-base total coverage, or the per-column base composition:
consensus, coverage = g.consensus(with_coverage=True)  # (str, list[int])
consensus, matrix = g.consensus_composition()  # rows = codes + a trailing gap row
# Cache or transmit a graph — pickle, or JSON via to_json / from_json:
import pickle

restored = pickle.loads(pickle.dumps(g))
restored = spoars.Poa.from_json(g.to_json())

# Inspect the graph directly — node ids are plain ints:
g.num_codes()  # size of the code alphabet
g.rank_order()  # node ids in topological order
g.node_code(3), g.node_base(3), g.node_coverage(3)
g.node_successor(3, 0)  # next node id sequence 0 visits after node 3 (or None)
g.sequence_path(0)  # node ids sequence 0 traverses
g.consensus_nodes()  # node ids on the consensus path
g.edges()  # [(tail, head, weight), ...]
g.msa_columns()  # (column-of-each-node, num_columns)
g.column_members()  # per column: [(sequence_index, node_id), ...]

alignment_type is one of "global", "local", or "overlap". Scoring takes (match, mismatch, gap_open, gap_extend, gap_open2, gap_extend2); the gap model (linear/affine/convex) is inferred, and Scoring.default() is spoa's convex default (5, -4, -8, -6, -10, -4).

Development

This package is built with maturin and developed with pixi:

pixi run develop      # build & install the extension into the dev env
pixi run test         # rebuild + pytest
pixi run format-check
pixi run lint
pixi run typecheck

License

MIT — see the repository.

Metadata

Release files for spoars 0.1.4

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

Built distributions (wheels)

Table of built distributions (wheels) for spoars 0.1.4
File Interpreter ABI Platform
spoars-0.1.4-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details
spoars-0.1.4-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details
spoars-0.1.4-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Total release size: 1.2 MB

Release files / spoars-0.1.4-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL spoars-0.1.4-cp310-abi3-manylinux_2_28_x86_64.whl
Size 457.8 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
c718b6a8c44b623275a3fac58433ebe5a21dce0d476748d756110a1c1feb9c90
BLAKE2b-256 checksum
How to use checksums
ce94c4b810fb80c74728c21ba8466b5f567b6ac9c36e82541b122a9cf7f2018c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / spoars-0.1.4-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL spoars-0.1.4-cp310-abi3-manylinux_2_28_aarch64.whl
Size 392.9 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
dec974eb572e0c7f10c4e5811f99cb1c97562df985094d7c8cfed60d15210641
BLAKE2b-256 checksum
How to use checksums
e900beabfb75420f65f3a5a37c91ceb56af42b4cfa8ee0fbf7c1ca4941fd8ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / spoars-0.1.4-cp310-abi3-macosx_11_0_arm64.whl

Download URL spoars-0.1.4-cp310-abi3-macosx_11_0_arm64.whl
Size 374.9 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7dbc3839e36c1c8cc2a0ed3fad59201ef4334bd988a8799a84910f4bf36c5514
BLAKE2b-256 checksum
How to use checksums
18dedbd2be0b9c371403db2585c3fc8482b904176322610a2a68500f6fa49e80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Security for spoars 0.1.4

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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for spoars-0.1.4-cp310-abi3-manylinux_2_28_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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