Skip to main content

Module M09: BLAST Specificity Verification

M09 is the off-target contamination screen for candidate primer sets output by M08. For each top-ranked candidate, it runs BLAST to confirm that the primer/probe sequences match the target viral genome and do not cross-hybridise to the human genome or closely related non-target pathogens. This module operates in two modes controlled by blast_verification.mode:
  • remote: Queries the NCBI nt database over the internet via BLAST+ API
  • local: Queries custom local databases (human_db + virus_db) built by build_db.smk

Input Requirements

Configuration Parameters


Processing

Rule: m09_blast_verification

Script: scripts/m09_blast_verification.py
Environment: envs/primerlab.yaml
The rule shell block performs upfront validation before calling the Python script: Local mode validation sequence:
Local mode — dual database query:
Remote mode query:
Remote mode requires a stable internet connection and preferably an NCBI API key for reliable throughput. Set NCBI_API_KEY as an environment variable to raise the query rate limit from 3 to 10 requests/second.

Building Local BLAST Databases (build_db.smk)

The build_db.smk rule file handles automated construction of the local databases. To trigger a database build:
Databases created: Each database is indexed with makeblastdb -dbtype nucl. For multi-file databases (e.g., human genome across multiple chromosomes), an alias file (.nal) is created to allow querying across all files. Manual database creation:

Outputs

Reading the Specificity Report

Each specificity_report_{CANDIDATE}.md contains:
A candidate passes verification if:
  1. Forward primer, reverse primer, and probe all have top hits to the target sequence
  2. No significant hits (E-value < evalue_cutoff) to the human genome
  3. No significant hits to non-target pathogen sequences in virus_db

Conda Environment

Key packages: blast+, python, pandas

Known Limitations & Edge Cases

  • Remote mode rate limits: NCBI enforces 3 BLAST API requests/second without an API key. For batches of >10 candidate sets, remote mode may take hours. Use NCBI_API_KEY or switch to local mode for HPC workflows.
  • Human genome database size: A full human genome database (GRCh38) is approximately 3 GB compressed. Ensure sufficient disk space in resources/blast_db/ before enabling custom_db_build.
  • Degenerate primer BLAST hits: IUPAC degenerate bases (e.g., R, Y, W) in primer sequences are interpreted as ambiguities by BLAST. A primer with high degeneracy may produce fewer hits than expected. Review BLAST output manually for highly degenerate candidates.
  • Resume/skip logic: The BLAST verification script implements a resume mechanism. If a candidate-level verification file already exists, it is skipped on re-runs. This prevents expensive re-BLAST of already-verified candidates after pipeline interruption.
  • E-value threshold sensitivity: The default evalue_cutoff: 0.01 is conservative. For short primers (~30 bp), an E-value of 1e-3 to 1e-5 is more appropriate for detecting meaningful off-target hits. Adjust based on primer length and acceptable specificity threshold.