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 byblast_verification.mode:
remote: Queries the NCBIntdatabase over the internet via BLAST+ APIlocal: Queries custom local databases (human_db+virus_db) built bybuild_db.smk
Input Requirements
Configuration Parameters
Processing
Rule: m09_blast_verification
Script: scripts/m09_blast_verification.pyEnvironment:
envs/primerlab.yaml
The rule shell block performs upfront validation before calling the Python script:
Local mode validation sequence:
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:
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
Eachspecificity_report_{CANDIDATE}.md contains:
- Forward primer, reverse primer, and probe all have top hits to the target sequence
- No significant hits (E-value
<evalue_cutoff) to the human genome - No significant hits to non-target pathogen sequences in
virus_db
Conda Environment
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_KEYor 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 enablingcustom_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.01is conservative. For short primers (~30 bp), an E-value of1e-3to1e-5is more appropriate for detecting meaningful off-target hits. Adjust based on primer length and acceptable specificity threshold.
