Skip to main content

System Architecture

PrimerLab uses a three-tier architecture for maintainability and flexibility.

Overview


Layer 1: User Interface

Command Line Interface

The CLI is the primary entry point for most users:
Key files:
  • primerlab/cli/main.py — Command routing and argument parsing
  • Rich library for formatted output

Python API

For programmatic access:
Key files:
  • primerlab/api/public.py — 15+ public functions

Layer 2: Workflow Orchestration

Workflows coordinate multi-step processes.

PCR Workflow

  1. Load and validate configuration
  2. Call Primer3 for candidate generation
  3. Apply quality control filters
  4. Rank candidates
  5. (Optional) Run in-silico PCR validation
  6. (Optional) Run BLAST off-target check
  7. Generate reports
  8. Save to database

qPCR Workflow

Same as PCR, plus:
  1. Probe design
  2. Probe-primer compatibility check
  3. Melt curve prediction (SYBR)

Database

All designs are persisted to SQLite:
  • ~/.primerlab/history.db
Enables:
  • Design history tracking
  • Result comparison
  • Reproducibility

Layer 3: Core Utilities

Primer3 Wrapper

Interfaces with the Primer3 tool:

Quality Control

Evaluates primer quality:

In-silico PCR

Simulates amplification to validate primer binding:

Off-target Finder

BLAST-based specificity analysis:

Configuration Pipeline

Priority: CLI args > YAML file > Defaults

Error Handling

Standardized exception hierarchy:
Each error includes:
  • error_code — Standardized code (e.g., ERR_CONFIG_001)
  • message — Human-readable description
  • details — Context dictionary