primer-design/primer-specificity/SKILL.md
Checks whether a PCR primer PAIR amplifies only the intended target genome-wide, using pair-aware in-silico PCR (MFEprimer-3.0, UCSC isPcr, NCBI Primer-BLAST) plus a primer3-py 3'-end-stability prefilter, against the correct database. Covers why plain BLAST is the wrong tool (it scores per-primer similarity, blind to 3'-terminal anchoring and to whether the two primers form a convergent amplicon in range), why a single 3'-terminal mismatch suppresses amplification while internal mismatches are tolerated, why intron-spanning RT-qPCR is defeated by processed pseudogenes that force a GENOME search not transcriptome-only, how to read a Primer-BLAST report (empty unintended-products means none passed its filter, not none exist), and that in-silico checking reduces but never replaces empirical validation. Use when confirming specificity, screening off-target amplicons, avoiding paralog/pseudogene hits, or checking SNPs under the 3' end. Design is primer-basics; dimers primer-validation; alignment read-alignment.
npx skillsauth add GPTomics/bioSkills bio-primer-design-primer-specificityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reference examples tested with: primer3-py 2.3+ (offline prefilter). In-silico PCR tools: MFEprimer 3.x, UCSC isPcr, BLAST+ 2.14+, NCBI Primer-BLAST (web).
Before using code patterns, verify installed versions match. If versions differ:
pip show primer3-py then help(primer3.calc_end_stability) to check signaturesmfeprimer --help, isPcr, blastn -help to confirm subcommands and flagsIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Are these primers specific?" -> Predict every amplicon the primer PAIR would generate against the correct database and confirm only the intended one survives -- because specificity is a property of a convergent, 3'-anchored, in-range PAIR, not of one primer's similarity to the genome.
mfeprimer -i primers.fa -d genome.fa (or UCSC isPcr, or NCBI Primer-BLAST) predicts amplicons from the pair.primer3.calc_end_stability(primer, site) ranks 3'-end anchoring -- the variable BLAST ignores.Scope: genome/transcriptome-wide off-target and mispriming assessment of a chosen primer PAIR via in-silico PCR. Designing primers -> primer-basics. Intramolecular dimers/hairpins of the oligos -> primer-validation. General read alignment / building a BLAST DB -> read-alignment/bwa-alignment, database-access/blast-searches.
BLASTn defaults are wrong for a ~20 nt primer: megablast (the default blastn) seeds at word 28 and so cannot seed a 20-mer at all; plain blastn (word 11) does seed a perfect 20-mer, but its scoring and E-value defaults are tuned for long queries, so short or partial off-target hits fall below threshold; only blastn-short (word 7, short-query scoring) is the appropriate task -- and even then it scores similarity, not amplification. And BLAST evaluates each primer independently against the database; it never asks whether the forward and reverse hits face each other within an amplifiable span. So blastn-short is acceptable only as a quick EXPLORATORY check for gross multi-copy/repeat problems of a single primer, read with the 3' alignment inspected by hand -- never as the final specificity decision.
| Tool / method | Citation | Mechanism / role | When |
|---------------|----------|------------------|------|
| MFEprimer-3.0 | Wang 2019 Nucleic Acids Res 47:W610 | k-mer index forbids a mismatch at the first 3' base, then nearest-neighbor scores stable binding; outputs amplicons + Ta/dG + dimer/hairpin modules; CLI/JSON | scriptable local in-silico PCR with thermodynamics; the default programmatic checker |
| NCBI Primer-BLAST | Ye 2012 BMC Bioinformatics 13:134 | BLAST candidate-find + convergent-pair + 3'-mismatch filter; "intended vs unintended products" report; any NCBI organism | tunable-mismatch, report-driven web check |
| UCSC In-Silico PCR (isPcr) | Kent (UCSC Genome Browser) | exact predicted product(s) of a pair on a chosen assembly, with coordinates | confirm the intended amplicon exists and is unique on a specific UCSC assembly; local batch |
| blastn -task blastn-short | Altschul 1990 J Mol Biol 215:403 | similarity seed at word_size 7 | EXPLORATORY single-primer repeat/multi-copy scan only |
| primer3.calc_end_stability | SantaLucia & Hicks 2004 Annu Rev Biophys 33:415 | dG of a primer's 3' end annealing to a site | rank candidate off-target sites by 3'-anchor strength (the BLAST-blind variable) |
| Scenario | Recommended | Why |
|----------|-------------|-----|
| Any qPCR / quantitative assay | MFEprimer or Primer-BLAST against genome + transcriptome | off-targets and gDNA corrupt the quantitative number |
| Intron-spanning RT-qPCR | search the GENOME (pseudogenes), not transcriptome-only | processed pseudogenes usually carry the junction and amplify from gDNA |
| Genotyping / allele-specific | weight the 3' end; check SNPs under the anchor (dbSNP/gnomAD) | the 3'-terminal base is the whole assay (Kwok 1990) |
| Confirm intended amplicon on a UCSC assembly | UCSC isPcr | exact product + genomic coordinates on that assembly |
| Tunable mismatch sensitivity + report | Primer-BLAST (loosen/tighten the 3'-mismatch filter) | stress-test how robust specificity is |
| Quick single-primer repeat scan | blastn-short word_size 7, dust off | gross multi-copy triage only; never final |
| Multiplex (N primers) | run in-silico PCR over the POOLED primer set + all-pairs cross-dimer | the pooled set enumerates cross-pair amplicons (Fwd_A + Rev_B, convergent and in-range), which per-pair checks miss; Primer-BLAST does NOT check inter-pair dimers either (O(N^2)) |
| Eukaryotic target with gene families / segmental duplications | pair-level genome + transcriptome search | paralogs in conserved exons amplify multiple members; segmental duplications / recent CNV families (e.g. SMN1/SMN2) give two near-identical loci a pair cannot distinguish |
Default when uncertain: run pair-aware in-silico PCR (MFEprimer or Primer-BLAST) against the genome AND, for RT work, the transcriptome; require exactly one intended amplicon, no qualifying off-target, and 3' ends clear of common SNPs -- then still validate empirically.
Goal: Enumerate every amplicon the pair would make against the correct database and confirm only the intended one survives.
Approach: Build the database index once, run the pair-aware tool, and read the predicted products; require a single on-target amplicon of expected size and no qualifying off-target. The commands below need the tool binaries and a genome/transcriptome FASTA, so they are NOT offline-spot-runnable here -- verify flags with --help against the installed version.
# MFEprimer-3.0 (local, thermodynamic; build the k-mer index once, then run)
mfeprimer index -i genome.fa
mfeprimer -i primers.fa -d genome.fa -o specificity.txt # add --json for pipeline parsing; verify flags with: mfeprimer --help
# UCSC isPcr (exact products on one assembly; primers.txt = "name<TAB>FWD<TAB>REV" per line)
isPcr genome.2bit primers.txt stdout -out=fa
# blastn-short: EXPLORATORY single-primer repeat scan ONLY (not a specificity verdict)
blastn -task blastn-short -word_size 7 -dust no -query primers.fa -db genome -outfmt 6
NCBI Primer-BLAST (web, any organism): paste the pair, pick the organism and a database that includes the genome (not "RefSeq mRNA only" for RT-qPCR), set the max product size, and read the report.
Goal: Show why a candidate off-target site that BLAST would surface may or may not actually prime, using the 3'-anchor thermodynamics BLAST ignores.
Approach: For each candidate site (the complementary strand the primer would anneal to), contrast the overall duplex dG (calc_heterodimer, what a similarity search tracks) with the 3'-anchor dG (calc_end_stability); a 3'-terminal mismatch keeps the overall dG strong but collapses the anchor, so the site will not prime despite the similarity.
import primer3
COMP = str.maketrans('ACGT', 'TGCA')
primer = 'GTCTCCTCTGACTTCAACAGCG'
site = primer.translate(COMP)[::-1] # the strand the primer anneals to; primer 3' base pairs site[0]
def mut(s, i):
return s[:i] + ('A' if s[i] != 'A' else 'C') + s[i + 1:]
sites = {'on-target': site, 'internal mismatch': mut(site, len(site) // 2), '3-prime mismatch': mut(site, 0)}
for label, s in sites.items():
overall = primer3.calc_heterodimer(primer, s).dg / 1000 # what overall similarity tracks
anchor = primer3.calc_end_stability(primer, s).dg / 1000 # the 3'-anchor BLAST ignores
print(f'{label}: overall dG={overall:.2f} 3-prime anchor dG={anchor:.2f} kcal/mol') # 3' mismatch: overall stays strong, anchor collapses
Trigger: Treating a per-primer BLAST result as a specificity verdict. Mechanism: BLAST scores similarity per primer, ignores 3'-anchoring and pairing. Symptom: primers pass BLAST but amplify off-target on the bench. Fix: use pair-aware in-silico PCR (MFEprimer / Primer-BLAST / isPcr).
Trigger: Searching "RefSeq mRNA" and concluding gDNA-safe. Mechanism: processed pseudogenes are intronless and carry the junction, amplifying like cDNA. Symptom: a genomic amplicon at the cDNA size; no-RT control is positive. Fix: search the genome (with pseudogenes); keep DNase + no-RT control.
Trigger: Treating an empty section as proof of uniqueness. Mechanism: Primer-BLAST ignores any off-target with >=6 total mismatches OR >=2 mismatches in the last 5 bp at the 3' end -- equivalently it LISTS only hits with <6 total and <2 near the 3', so an empty section means "none my model predicts will amplify," not "none similar exist." Symptom: false confidence. Fix: loosen the mismatch settings to stress-test, and combine with isPcr.
Trigger: Searching primary assembly only, or one chromosome, or a single transcript set. Mechanism: off-targets on alt/unplaced contigs, repeats, or paralog transcripts are excluded. Symptom: "unique" in-silico, multiple bands in vitro. Fix: match the database to the assay (genome + transcriptome for RT-qPCR; include alt/unplaced contigs).
Trigger: Validating against the reference only. Mechanism: an individual carrying a variant under the 3' anchor fails to amplify that allele (Kwok 1990 Nucleic Acids Res 18:999). Symptom: allele dropout in some samples. Fix: check primer 3' ends against dbSNP/gnomAD common variants and redesign (primer-basics).
Trigger: Per-pair Primer-BLAST/in-silico PCR on a multiplex set. Mechanism: two off-target classes only appear in the POOLED set -- inter-pair cross-dimers (O(N^2), unexamined) and cross-pair amplicons where one pair's forward meets another pair's reverse convergently and in-range. Symptom: one channel silently fails or an unexpected band appears. Fix: run in-silico PCR over the pooled primer set AND all-pairs cross-dimer screening (primer-validation), not pair-by-pair.
| Threshold | Source | Rationale |
|-----------|--------|-----------|
| Primer-BLAST ignores off-target if >=6 total mismatches OR >=2 in last 5 bp at 3' | Ye 2012 BMC Bioinformatics 13:134 | encodes the 3'-anchor biology BLAST lacks (its actual default filter) |
| 3'-terminal mismatch suppresses ~20-100x (A:G/G:A/C:C worst, G:T/T:G weakest) | Kwok 1990 Nucleic Acids Res 18:999 | why a 3' anchor decides priming; wobble is not automatically safe |
| blastn-short word_size 7, dust off | Altschul 1990 J Mol Biol 215:403 | short-query-tuned scoring/E-value; megablast (word 28) cannot seed a 20-mer, default blastn (word 11) seeds it but its long-query scoring drops marginal hits |
| Require exactly 1 intended amplicon, expected size | -- | the in-silico pass condition before empirical validation |
| RT-qPCR: search genome + transcriptome | Ye 2012 BMC Bioinformatics 13:134 | genome catches pseudogenes/gDNA; transcriptome catches isoforms/paralogs |
A passing in-silico check removes most bad designs but does not license an assay. Confirm empirically: a gradient PCR to find the annealing temperature giving a single product; a single band on a gel (or single fragment on a TapeStation); for SYBR qPCR a single sharp melt peak with no low-Tm dimer shoulder; and Sanger sequencing of the product to prove identity (a same-size off-target is invisible on a gel). State this honestly -- "Primer-BLAST said it is specific" is not validation of a quantitative assay.
| Error / symptom | Cause | Solution |
|-----------------|-------|----------|
| Primers pass BLAST, fail in vitro | per-primer similarity, not pair amplicon | run pair-aware in-silico PCR |
| RT-qPCR amplifies gDNA despite intron-spanning | processed pseudogene usually carries the junction | search the genome; DNase + no-RT control |
| Empty Primer-BLAST off-targets but multiple bands | filter hid a 3'-anchored off-target / wrong DB | loosen mismatch settings; search the genome incl. alts |
| isPcr returns nothing for the intended pair | wrong assembly / over-strict default match | confirm the assembly and target presence |
| mfeprimer errors on the database | index not built | run mfeprimer index -i db.fa first |
| Allele dropout in some individuals | SNP under the 3' end | check 3' ends vs gnomAD; redesign (primer-basics) |
tools
End-to-end CLIP-seq pipeline from FASTQ to ENCODE-compliant binding sites, single-nucleotide crosslink maps, annotation, motifs, and (optionally) differential binding. Use when running the full Yeo lab eCLIP / iCLIP / iCLIP2 / iCLIP3 / irCLIP / PAR-CLIP analysis with SMInput control, protocol-specific UMI extraction, ENCODE STAR parameters, CLIPper or Skipper peak calling with stringent log2 FC and -log10 p thresholds, IDR rescue and self-consistency QC, and downstream motif registration with mCross or PEKA.
development
Detect, date, and contextualize whole-genome duplication (WGD / paleopolyploidy) events using wgd v2 (Chen et al 2024), KsRates (Sensalari 2022 substitution-rate-corrected Ks dating), DupGen_finder (Qiao 2019), MAPS (Li 2018 phylogenomic), POInT (Conant 2008 ordered-block), SLEDGe (2024 ML-based), Whale.jl (Bayesian DL+WGD), and synteny-anchored paranome construction. Use when identifying ancient polyploidy from Ks distributions and synteny block analysis, positioning WGD events relative to speciation, distinguishing tandem from segmental from WGD duplications, dating the 2R/3R vertebrate / fish / salmonid WGDs, building paranome and Ks-age mixture models, applying KsRates substitution-rate correction across lineages, or testing alternative biased-fractionation / dosage-balance models post-WGD.
tools
Build whole-genome alignments using Progressive Cactus (Armstrong 2020 reference-free clade-level WGA), Minigraph-Cactus (Hickey 2024 pangenome-aware), LASTZ chain/net (UCSC pipeline), MUMmer4 (Marçais 2018 pairwise), minimap2 -x asm5/10/20 (Li 2018 fast pairwise), AnchorWave (Song 2022 WGD-aware), and Mauve / progressiveMauve (bacterial). Operates the HAL toolkit (Hickey 2013) for downstream extraction including halSynteny, halLiftover, halBranchMutations, and hal2maf. Use when constructing multi-species alignments for comparative-annotation projection (TOGA), synteny detection, conservation analyses (phyloP / PhastCons), or pangenome graph construction; selecting between reference-free (Cactus) and reference-anchored (LASTZ chains/nets) approaches; tuning sensitivity for closely vs distantly related genomes; or producing HAL files for genome-wide downstream tools.
development
Detect syntenic blocks and structural rearrangements between genomes using MCScanX (Wang 2012), JCVI/MCScan (Tang 2008 Python), GENESPACE (Lovell 2022) for orthology-anchored riparian visualization, SyRI for structural variation, AnchorWave for sequence-level synteny, i-ADHoRe 3.0 for highly diverged species, SynNet for synteny networks, and ntSynt for multi-genome macrosynteny. Use when identifying collinear gene blocks across species, distinguishing macrosynteny from microsynteny, detecting inversions/translocations/duplications, anchoring orthology in WGD lineages, producing publication riparian plots, computing synteny block age via Ks (cross-references whole-genome-duplication), or running synteny-aware ortholog inference in polyploids.