primer-scout is a fast, single-binary Rust CLI for primer off-target scanning on FASTA references.
Point it at a primer panel and one or more references; it reports every place each primer (and its reverse complement) matches — exact or within a mismatch budget — as stable, script-friendly TSV or NDJSON.
primer-scout --primers panel.tsv --reference genome.fa --summary- The problem
- Where primer-scout fits
- Why it's open source
- Clinical disclaimer
- Features
- Install and run
- Quick start
- Command reference
- Input and output formats
- Security and safety defaults
- Performance and benchmarking
- Development
- License
Before any PCR, sequencing, or panel run, you want a quick answer to a simple question: "where else do my primers stick?" A primer that matches dozens of off-target sites — or whose reverse complement does — wastes reagents, muddies results, and is cheaper to catch on a laptop than in the lab.
In practice the existing options each have a rough edge for this specific check:
- Full aligners (BLAST and friends) are powerful and sensitive, but they are heavy to set up and slower than you want for a tight "edit panel → re-screen" loop, and their output needs parsing before it answers a primer-level question.
grep/ ripgrep are blazing fast but DNA-naive: no IUPAC ambiguity codes, no reverse-complement search, no mismatch tolerance, and no per-primer summary.- Ad-hoc scripts fill the gap but tend to be unmaintained, un-benchmarked, and inconsistent from one team to the next.
primer-scout targets exactly that middle layer: quick, repeatable,
automation-friendly primer specificity screening, with the DNA semantics that a
plain text search lacks.
| Tool | Best at | Why it's awkward for fast panel screening |
|---|---|---|
| BLAST / aligners | Sensitive, gapped, indel-aware alignment | Heavier setup, slower for repeated quick sweeps, output needs post-processing |
grep / ripgrep |
Raw exact/regex search speed | No IUPAC codes, no reverse complement, no mismatch budget, no primer-level rollups |
| Ad-hoc scripts | Flexibility | Hard to maintain, rarely tested or benchmarked, inconsistent across teams |
| primer-scout | Fast IUPAC- and revcomp-aware screening with stable machine output | Screening layer only — not a replacement for deep alignment |
Use primer-scout as a high-throughput screening pass, then move the
shortlisted candidates to deeper, slower tools.
In scope today:
- Scan a panel against one or many references, fast.
- Allow a controlled mismatch threshold and inspect every hit coordinate.
- Produce stable machine-readable output for CI and pipelines.
Out of scope (by design):
- Thermodynamic scoring (Tm, dimers, hairpins).
- Gapped / indel-aware alignment.
- Full amplicon-pair simulation and product-size modeling.
primer-scout is MIT-licensed and intended to stay that way. Specificity
pre-checks are infrastructure, not a product — they belong in the open where labs
and pipelines can read the matching logic, reproduce the benchmarks, and trust the
output contracts instead of treating them as a black box.
What that commitment looks like in the repo:
- MIT license, no contributor license assignment, no telemetry.
- Reproducible benchmarks rather than marketing numbers (see Performance).
- Tested, linted CI on every push, plus an automated
cargo auditdependency-vulnerability scan. - Documented, stable output contracts so downstream scripts don't break silently.
Contributions are welcome — see CONTRIBUTING.md. Security
reports have a private channel described in SECURITY.md.
primer-scout is for research and engineering workflows only. It is not a
medical device and must not be used for medical diagnosis, treatment decisions,
or patient-facing clinical decisions.
- Rust single-binary CLI (no Python runtime to manage)
- FASTA input, including
.gz - Primer panel input as TSV/CSV
- IUPAC-aware matching (
A C G T/U R Y S W K M B D H V N) - Configurable mismatch threshold (
--max-mismatches) - Reverse-complement scanning enabled by default
- Parallel execution (
--threads) - Three output modes: hit-level rows, per-primer summary, count-only
- TSV or NDJSON output for pipeline ingestion
- Resource guards for safe processing of untrusted input files
# 1) Install Rust toolchain
xcode-select --install || true
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
# 2) Install primer-scout from GitHub
cargo install --git https://github.com/yash27-lab/primer-scout --branch main --force
# 3) Verify install
primer-scout --help
# 4) Smoke test
git clone https://github.com/yash27-lab/primer-scout.git
cd primer-scout
primer-scout --primers data/demo_primers.tsv --reference data/demo.fa --count-onlyExpected smoke-test output:
27
Installed commands:
primer(interactive console + CLI entrypoint)primer-scout(direct scanner command)
If primer: command not found appears:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profileFor zsh:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc# 1) Install Rust toolchain
winget install --id Rustlang.Rustup -e
rustup default stable-x86_64-pc-windows-msvc
# 2) Install primer-scout from GitHub
cargo install --git https://github.com/yash27-lab/primer-scout --branch main --force
# 3) Verify install
primer-scout --help
# 4) Smoke test
git clone https://github.com/yash27-lab/primer-scout.git
cd primer-scout
primer-scout --primers data\demo_primers.tsv --reference data\demo.fa --count-onlyExpected smoke-test output:
27
cargo install --path .Tagged releases publish prebuilt binaries for Linux, macOS (Intel and Apple
Silicon), and Windows, built automatically by the
release workflow when a v* tag is pushed.
When a build is available for your platform, grab it from the Releases page:
- Download the archive for your platform:
- Linux (x86_64):
primer-scout-<version>-x86_64-unknown-linux-gnu.tar.gz - macOS (Apple Silicon):
primer-scout-<version>-aarch64-apple-darwin.tar.gz - macOS (Intel):
primer-scout-<version>-x86_64-apple-darwin.tar.gz - Windows (x86_64):
primer-scout-<version>-x86_64-pc-windows-msvc.zip
- Linux (x86_64):
- Extract it (
tar -xzf <archive>.tar.gz, or unzip on Windows). Each archive contains theprimer-scoutandprimerbinaries plusLICENSEand this README. - Move
primer-scout(and optionallyprimer) onto yourPATH, e.g.sudo mv primer-scout /usr/local/bin/. On macOS, clear the quarantine flag the first time withxattr -d com.apple.quarantine primer-scout. - Verify with
primer-scout --version.
If the Releases page doesn't list a binary for your platform yet, install from source using one of the methods above.
Open the interactive console:
primerOpen the console explicitly (same mode):
primer --splashprimer console behavior:
- runs in its own full-screen terminal view (separate from your normal shell prompt)
- exit with
Ctrl+Cor by typingxthen Enter - automatically saves session history before exit
- auto-restores previous history on next launch
- shows an update banner when a newer GitHub release is available
- typing
/shows live command suggestions (type-ahead filter) - accepts both
/scan ...and directprimer-scout ...style commands
Inside the console:
/help
/basics
/examples
/scan --primers data/demo_primers.tsv --reference data/demo.fa --summary
primer-scout --primers data/demo_primers.tsv --reference data/demo.fa --count-only
--primers data/demo_primers.tsv --reference data/demo.fa --summary
/upgrade
/version
/history
/clear
x
Per-primer summary against the bundled demo data:
primer-scout --primers data/demo_primers.tsv --reference data/demo.fa --summaryp_ambig 4 14 8 8 6 2
p_atgc 4 12 7 7 5 2
p_gatc 4 1 1 1 0 1
Hit-level scan with one allowed mismatch:
primer-scout \
--primers data/demo_primers.tsv \
--reference data/demo.fa \
--max-mismatches 1Count-only (fast sanity check):
primer-scout \
--primers data/demo_primers.tsv \
--reference data/demo.fa \
--count-onlyNDJSON output for pipelines:
primer-scout \
--primers data/demo_primers.tsv \
--reference data/demo.fa \
--summary \
--jsonDisable reverse-complement scanning:
primer-scout \
--primers data/demo_primers.tsv \
--reference data/demo.fa \
--no-revcomp- Primer panel preflight before sequencing runs — scan host genome plus contamination references and rank primers by hit burden.
- Off-target triage in assay development — quickly flag primers with many
near-matches at
k=1ork=2. - CI regression checks — re-run panel scans when primer files change and fail the build if hit counts jump.
- Multi-reference screening — test one panel against many assemblies without rewriting custom scripts.
- Large-scale filtering — use count-only mode for fast dashboards and trend tracking.
primer # full-screen console with session restore
primer --splash # explicitly open the same console
primer --help # show CLI options for direct, non-interactive scan mode/help: full command list and usage./basics: beginner quickstart commands./examples: more advanced scan examples./scan <args>: run a realprimer-scoutscan.- direct
primer-scout <args>: also supported inside the console. - direct
<args>(starting with--): also supported inside the console. /upgrade: print the one-line upgrade command./version: show installed version./history: show the saved session file path./clear: clear the visible console history.xor/exitorCtrl+C: save the session and quit.
primer-scout --help # all scanner flags
primer-scout --primers <p.tsv> --reference <ref.fa> --count-only # total hit count
primer-scout --primers <p.tsv> --reference <ref.fa> --summary # per-primer stats
primer-scout --primers <p.tsv> --reference <ref.fa> --json # NDJSON rows
primer-scout --primers <p.tsv> --reference <ref.fa> --max-mismatches 2 # fuzzy matchPrimer file (.tsv or .csv):
name sequence
primer_1 ATGCCGTAGCTA
primer_2 TTYACCGGTTAA
name is optional. If missing, names are auto-generated.
Reference input:
- one or more FASTA files with
--reference - plain text or
.gz
Hit-level TSV columns:
file contig primer primer_len start end strand mismatches matched
Summary TSV columns:
primer primer_len total_hits perfect_hits forward_hits reverse_hits contigs_with_hits
Coordinate system: 0-based, half-open [start, end).
primer-scout is built to process untrusted input files safely. See
SECURITY.md for the full policy and how to report a vulnerability.
- Console session history is stored under
$HOME/.primer-scout/with restricted permissions (0700dir,0600file on Unix). PRIMER_SCOUT_SESSION_FILEis path-sanitized and cannot point outside$HOME/.primer-scout/; symlink targets are rejected.- The console runs the scanner binary installed alongside it rather than resolving
the bare name through
PATH. - Resource guards are enabled by default to reduce denial-of-service risk from malformed or huge input files.
- The only outbound network call is an optional GitHub release check, disabled with
PRIMER_SCOUT_NO_UPDATE_CHECK=1.
Runtime safety limits (override only when needed):
PRIMER_SCOUT_MAX_PRIMER_FILE_BYTESdefault:16777216(16 MiB)PRIMER_SCOUT_MAX_PRIMER_LINE_BYTESdefault:32768(32 KiB)PRIMER_SCOUT_MAX_FASTA_LINE_BYTESdefault:8388608(8 MiB)PRIMER_SCOUT_MAX_CONTIG_BASESdefault:250000000(250M bases per contig)
Example override:
PRIMER_SCOUT_MAX_CONTIG_BASES=350000000 primer-scout --primers panel.tsv --reference hg38.fa --summaryUpgrade to latest:
cargo install --git https://github.com/yash27-lab/primer-scout --branch main --forcePin install to a release tag:
cargo install --git https://github.com/yash27-lab/primer-scout --tag v0.1.0 --forceUninstall:
cargo uninstall primer-scoutThis project does not claim performance without reproducible evidence.
Run the macro benchmark:
./scripts/run_benchmark.shArtifacts produced:
benchmarks/RESULTS.mdbenchmarks/generated/timings.csv
Run microbenchmarks:
cargo bench --bench engineArtifacts:
benchmarks/CRITERION_RESULTS.md
Latest local macro run (2026-02-18, Apple M2, 8 threads):
- dataset: 5,000,000 bases, 128 primers, length 20,
k=1 - mean runtime: 1.214 s
- throughput: 4.119 million-bases/s
Numbers are hardware- and input-dependent; re-run the scripts on your own machine for figures you can trust.
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets --all-features
cargo audit # dependency vulnerability scan (install with `cargo install cargo-audit`)- Architecture & algorithm notes:
docs/ARCHITECTURE.md - Contributing guide:
CONTRIBUTING.md - Security policy:
SECURITY.md - Changelog:
CHANGELOG.md - Release notes:
releases/v0.1.0.md - GitHub launch metadata:
docs/github-launch.md
