Skip to main content

A modular, AI-friendly bioinformatics framework for automated primer and probe design.

Project description

๐Ÿงฌ PrimerLab Genomic

A modular bioinformatics framework for automated primer and probe design, built with clean architecture and reproducible workflows.

Python License Tests Docker Docs PyPI Status

๐Ÿ”ฐ Latest Release: v1.0.0 - Stable Release ๐ŸŽ‰


๐Ÿ“‹ Overview

PrimerLab Genomic is a Python-based toolkit for automated primer and probe design in molecular biology workflows. It provides a structured and reproducible framework for:

  • PCR โ€” Standard primer design with quality control
  • qPCR โ€” Probe design with thermodynamic checks
  • Off-target Check โ€” BLAST-based specificity analysis
  • In-silico PCR โ€” Virtual PCR simulation and validation

PrimerLab focuses on deterministic, transparent bioinformatics, following strict modularity and best practices.

๐Ÿ”‘ Key Features

  • End-to-End Workflow: Sequence input โ†’ Primer/Probe design โ†’ QC โ†’ Report
  • Thermodynamic Validation: Secondary structure prediction via ViennaRNA
  • QC Framework: Hairpins, dimers, GC%, Tm ranges, amplicon checks
  • qPCR Support: TaqMan-style probe design with efficiency estimation
  • Safe Execution: Timeout protection for complex sequences
  • Structured Output: JSON + Markdown + HTML reports with interpretable metrics

๐Ÿ“ฆ Feature Highlights

Category Features
Primer Design PCR, qPCR, Nested PCR, Semi-Nested PCR
Analysis BLAST off-target, In-silico PCR, Dimer matrix
qPCR Tools TaqMan probe design, Melt curve, Efficiency calc
Quality Control Hairpin, Homodimer, Heterodimer, Tm balance
Species Check Cross-reactivity, Multi-species comparison
Batch Processing Parallel processing, SQLite caching, CSV export
Visualization Coverage maps, Melt curves, Dimer heatmaps
Export JSON, Markdown, HTML, Excel, IDT plate format

๐Ÿ“š Documentation

Resource Link
Getting Started Installation & Quick Start
CLI Reference Command Reference
API Reference Python API
Tutorials Step-by-Step Guides
Changelog Version History

๐Ÿš€ Quick Start

Installation

Option 1: PyPI (Recommended)

pip install primerlab-genomic

Option 2: Docker (No setup required)

# Pull and run
docker pull ghcr.io/engkinandatama/primerlab-genomic:1.0.0
docker run ghcr.io/engkinandatama/primerlab-genomic:1.0.0 --version

# Run with your config
docker run -v $(pwd):/data ghcr.io/engkinandatama/primerlab-genomic:1.0.0 run pcr --config /data/config.yaml

Option 3: From Source (For Development)

git clone https://github.com/engkinandatama/primerlab-genomic.git
cd primerlab-genomic
pip install -e .

Optional: ViennaRNA (for Secondary Structure)

# Via pip (recommended)
pip install viennarna

# Via Conda
conda install -c bioconda viennarna

Without ViennaRNA, PrimerLab uses a fallback estimation method.

Once installed, verify the installation:

primerlab --version

๐Ÿ”ง Usage

Command-Line Interface (CLI)

PCR Workflow:

primerlab run pcr --config test_pcr.yaml

qPCR Workflow:

primerlab run qpcr --config test_qpcr.yaml

Sequence Stats (v0.1.6):

# Check sequence before design
primerlab stats input.fasta

# JSON output for pipelines
primerlab stats input.fasta --json

Quiet Mode (v0.1.6):

# Suppress warnings for scripted pipelines
primerlab run pcr --config test_pcr.yaml --quiet

In-silico PCR Simulation (v0.2.0):

# Validate primers against template
primerlab insilico -p primers.json -t template.fasta

# With custom output directory
primerlab insilico -p primers.json -t template.fasta -o results/

# JSON output for pipelines
primerlab insilico -p primers.json -t template.fasta --json

Example primers.json:

{
  "forward": "ATGGTGAGCAAGGGCGAGGAG",
  "reverse": "TTACTTGTACAGCTCGTCCATGCC"
}

Primer Compatibility Check (v0.4.0):

# Check if multiple primer pairs can work together
primerlab check-compat --primers primer_set.json

# With custom output directory
primerlab check-compat --primers primer_set.json --output results/

# Integrated with PCR design (auto-check after design)
primerlab run pcr --config design.yaml --check-compat

Example primer_set.json:

[
  {"name": "GAPDH", "fwd": "ATGGGGAAGGTGAAGGTCGG", "rev": "GGATCTCGCTCCTGGAAGATG", "tm": 60.0},
  {"name": "ACTB", "fwd": "CATGTACGTTGCTATCCAGGC", "rev": "CTCCTTAATGTCACGCACGAT", "tm": 59.0}
]

qPCR Analysis Commands (v0.6.0):

# Check TaqMan probe binding
primerlab probe-check --probe ATGCGATCGATCGATCGATCG

# Predict SYBR melt curve
primerlab melt-curve --amplicon ATGCGATCGATCGATCGATCGATCGATCGATCG --format svg

# Validate qPCR amplicon quality
primerlab amplicon-qc --amplicon ATGCGATCGATCGATCGATCGATCGATCGATCG

# Generate melt plot during workflow (v0.6.1)
primerlab run qpcr --config design.yaml --plot-melt --plot-format png

PCR Variants (v0.7.0):

# Design Nested PCR primers
primerlab nested-design --sequence "ATGC..." --outer-size 400-600 --inner-size 150-250

# Design Semi-Nested PCR (shared forward primer)
primerlab seminested-design --sequence "ATGC..." --shared forward

Analysis Tools (v0.7.1):

# Analyze primer dimer matrix
primerlab dimer-matrix --primers primers.json --format svg

# Compare batch design runs
primerlab compare-batch result1.json result2.json --format markdown

Visualization (v0.7.2):

# Generate coverage map
primerlab coverage-map --result result.json --format svg

qPCR Efficiency (v0.7.4):

# Calculate efficiency from standard curve
primerlab qpcr-efficiency calculate --data curve.json

# Predict primer efficiency
primerlab qpcr-efficiency predict --forward "ATGCATGC..." --reverse "GCATGCAT..."

Programmatic API (Python)

For integration into your own Python scripts:

from primerlab.api.public import design_pcr_primers, design_qpcr_assays

# PCR primer design
sequence = "ATGAGTAAAGGAGAAGAACTTTTCACTGGAGT..."
result = design_pcr_primers(sequence)

print(f"Forward: {result.primers['forward'].sequence}")
print(f"Reverse: {result.primers['reverse'].sequence}")
print(f"Amplicon: {result.amplicons[0].length} bp")

# qPCR assay design (with custom parameters)
config = {
    "parameters": {
        "product_size_range": [[70, 200]],
        "probe": {"tm": {"min": 68.0, "opt": 70.0, "max": 72.0}}
    }
}
result = design_qpcr_assays(sequence, config)

print(f"Probe: {result.primers['probe'].sequence}")
print(f"Efficiency: {result.efficiency}%")

๐Ÿ“– Documentation

Full documentation is available in the docs/ directory:

Section Description
Getting Started Installation and first steps
CLI Reference All 25+ commands
Configuration YAML config reference
Presets Pre-configured parameter sets
API Reference Programmatic interface
Features Advanced features
Troubleshooting Common issues and solutions

Additional Resources:


๐Ÿงช Example Configurations

PCR Configuration

workflow: pcr

input:
  sequence: "ATGAGTAAAGGAGAAGAACTTTTCACTGGAGT..."  # Or use sequence_path: "input.fasta"

parameters:
  primer_size: {min: 18, opt: 20, max: 24}
  tm: {min: 58.0, opt: 60.0, max: 62.0}
  product_size: {min: 200, opt: 400, max: 600}  # v0.1.1: Simplified syntax

output:
  directory: "output_pcr"

qPCR Configuration (TaqMan - Default)

workflow: qpcr
# mode: taqman (default - includes probe design)

input:
  sequence: "ATGGGGAAGGTGAAGGTCGGAGT..."

parameters:
  primer_size: {min: 18, opt: 20, max: 24}
  tm: {min: 55.0, opt: 60.0, max: 65.0}
  
  probe:
    size: {min: 18, opt: 24, max: 30}
    tm: {min: 68.0, opt: 70.0, max: 72.0}

output:
  directory: "output_qpcr"

qPCR Configuration (SYBR Green)

workflow: qpcr

parameters:
  mode: sybr  # v0.1.1: Disables probe design automatically
  
  primer_size: {min: 18, opt: 20, max: 24}
  tm: {min: 58.0, opt: 60.0, max: 62.0}
  product_size: {min: 70, opt: 100, max: 150}

output:
  directory: "output_qpcr_sybr"

๐Ÿ“Š Output Overview

PrimerLab generates a structured report containing:

  • Primer & Probe Details โ€” Sequences, GC%, Tm, positions
  • qPCR Metrics โ€” Estimated amplification efficiency
  • Amplicon Properties โ€” Length, GC%, suitability
  • QC Checks โ€” Dimers, hairpins, Tm balance
  • Warnings โ€” Optimization suggestions

Run a workflow to generate your own report!


๐Ÿ—๏ธ Project Structure

primerlab-genomic/
โ”œโ”€โ”€ primerlab/
โ”‚   โ”œโ”€โ”€ cli/              # Command-line interface
โ”‚   โ”œโ”€โ”€ core/             # Reusable utilities
โ”‚   โ”‚   โ”œโ”€โ”€ insilico/     # In-silico PCR simulation (v0.2.0)
โ”‚   โ”‚   โ””โ”€โ”€ tools/        # Primer3, ViennaRNA wrappers
โ”‚   โ”œโ”€โ”€ workflows/        # Workflow modules
โ”‚   โ”‚   โ”œโ”€โ”€ pcr/          # PCR workflow
โ”‚   โ”‚   โ””โ”€โ”€ qpcr/         # qPCR workflow
โ”‚   โ”œโ”€โ”€ api/              # Public API
โ”‚   โ””โ”€โ”€ config/           # Default configurations
โ”œโ”€โ”€ tests/                # 1286 automated tests
โ”œโ”€โ”€ docs/                 # User documentation
โ”œโ”€โ”€ examples/             # Example files
โ”‚   โ””โ”€โ”€ insilico/         # In-silico PCR examples
โ””โ”€โ”€ .dev/                 # Internal dev docs

๐Ÿ“Œ Development Status

โœ… v1.0.0 (Current)

  • Performance Optimization (core/cache.py):
    • LRU caching for Tm, GC, and ฮ”G calculations
    • 2-5x speedup for repeated computations
  • Model Standardization (v0.8.2):
    • to_dict() methods for 10+ dataclasses
    • Comprehensive STRUCTURE.md documentation
  • Code Quality Foundation (v0.8.0):
    • Type hints infrastructure (mypy config)
    • Exception testing (20+ tests)
    • Flake8 fixes (8,600+ fixes)
  • 1286 Tests - Comprehensive test coverage

v0.7.x Features (PCR Variants & qPCR Advanced)

  • Nested PCR Design (core/variants/nested.py)
  • Semi-Nested PCR (core/variants/seminested.py)
  • Dimer Matrix Analysis (core/analysis/dimer_matrix.py)
  • Batch Comparison (core/analysis/batch_compare.py)
  • Coverage Map (core/visualization/coverage_map.py)
  • qPCR Efficiency (core/qpcr/efficiency.py)
  • Advanced qPCR (core/qpcr/advanced.py): HRM, dPCR, quencher recommendations

v0.6.x Features (Genotyping & Visualization)

  • Allele Discrimination (core/genotyping/)
  • RT-qPCR Validation (core/rtpcr/)
  • Melt Curve Visualization
  • CLI Commands: probe-check, melt-curve, amplicon-qc

v0.5.0 Features

  • Probe Binding Simulation (TaqMan Tm calculation)
  • qPCR Amplicon Validation (Length/GC/structure)
  • SYBR Melt Curve Prediction

v0.4.x Features

  • Primer Compatibility Check (v0.4.0)
  • Amplicon Analysis (v0.4.1)
  • Species Specificity (v0.4.2)
  • Tm Gradient Simulation (v0.4.3)

Earlier Versions

  • v0.6.x: Allele discrimination, RT-qPCR, melt curve visualization
  • v0.3.x: BLAST off-target, reporting, Tm correction
  • v0.2.x: In-silico PCR simulation
  • v0.1.x: Core design, stats, batch processing

๐Ÿ› ๏ธ Requirements

  • Python 3.10+
  • Primer3 (primer3-py)
  • ViennaRNA for secondary structure prediction
  • WSL recommended for Windows users

๐Ÿค Contributing

We welcome contributions! Please read our guidelines first:

๐Ÿ“„ CONTRIBUTING.md โ€” How to contribute, coding standards, PR checklist

Key principles:

  • No cross-layer imports
  • Deterministic, reproducible outputs
  • All features need tests

๐Ÿ“„ License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

ยฉ 2025โ€“present โ€” Engki Nandatama


๐Ÿ™ Acknowledgments

  • Primer3 โ€” Primary primer design engine
  • ViennaRNA โ€” Thermodynamic folding & secondary structure analysis

๐Ÿ“ฌ Contact

For issues, suggestions, or contributions:

โžก๏ธ Open an issue on GitHub

Project details


Download files

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

Source Distribution

primerlab_genomic-1.0.1.tar.gz (325.0 kB view details)

Uploaded Source

Built Distribution

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

primerlab_genomic-1.0.1-py3-none-any.whl (261.8 kB view details)

Uploaded Python 3

File details

Details for the file primerlab_genomic-1.0.1.tar.gz.

File metadata

  • Download URL: primerlab_genomic-1.0.1.tar.gz
  • Upload date:
  • Size: 325.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for primerlab_genomic-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c142e3ff5cd874f20e9fe760ff3125b6e261cc5b53d26e2774d7f07ed3e540a4
MD5 6c5ad17a5af655d9173ad77f7d8698ed
BLAKE2b-256 92483ba59dc58d9de405ce343aaab1f1a2333e676cca5cdb6b482d3c95a5e356

See more details on using hashes here.

File details

Details for the file primerlab_genomic-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for primerlab_genomic-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4cb444818797bd7f45d8cb3f9b83b544fe96d8104d7bd68136321ff50b86b6e5
MD5 a51fe75a527cd26472bbafd04c5cd569
BLAKE2b-256 a4e02938b4bd29ff13f2d91c7ca2eadab4207bbd969983592254e37a07e60d6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page