Skip to content

Architecture

snipe is an alignment-free QC tool for sequencing data. As a codebase, it is one workspace producing two deliverables: a Rust library and a Python extension module (PyO3 + maturin) whose Typer console-script is the sole CLI. All user-visible output — files, stdout, error text, exit codes — is produced by the Rust core; Python owns argument parsing and calls the core through cmd_* bindings.

src/
├── lib.rs Library entry — re-exports the public api surface
├── utils.rs DNA tables, canonical reverse-complement, murmur3 (seed 42)
├── api/ The actual implementation — the source of truth
│ ├── commands/ Per-command surface (sketch, qc, set-ops, info, …)
│ ├── signature*.rs SnipeSignature (edgemer) + K1Signature, set ops, .snipesig I/O
│ ├── sketch.rs ProcessingStats; the sketch loop lives in input/{fastx,sra}
│ ├── qc.rs QC metrics (the frozen science) — see the metrics catalog
│ └── workflows.rs Higher-level orchestration (pangenome, guided-merge)
└── python/ PyO3 bindings — PySignature + the cmd_* command bindings

api is the source of truth. The python/ layer is a thin marshalling shim; the Typer app in python/snipe/cli.py is the sole CLI, one command per subcommand calling a cmd_* binding.

There are two in-memory signature types. SnipeSignature is the edgemer type (K1 + K2 + abundance) — the form that round-trips through .snipesig. K1Signature is a K1-only variant, faster for set operations and the type returned when loading a sourmash .sig. The Python API presents a single user-facing Signature class backed by either.

The core subsystems — the QC metrics engine, the .snipesig format codec, the sketching orchestration, and the Python signature bindings — line up with the modules above.