IUPAC expander

Every sequence a degenerate primer stands for, and the count. Or the other way round.

Result

What are IUPAC ambiguity codes?

A single letter that stands for more than one base. They were agreed by the IUPAC and IUB nomenclature commission so that a position which is uncertain, variable between species, or deliberately mixed during oligonucleotide synthesis can be written in one character. R is A or G, N is any base, and so on. Degenerate primers, consensus motifs and restriction site definitions are all written this way.

CodeBasesMeaningDegeneracyComplement
AAAdenine1T
CCCytosine1G
GGGuanine1C
TTThymine (U in RNA)1A
RA GPurine2Y
YC TPyrimidine2R
SC GStrong, three hydrogen bonds2S
WA TWeak, two hydrogen bonds2W
KG TKeto2M
MA CAmino2K
BC G TNot A3V
DA G TNot C3H
HA C TNot G3D
VA C GNot T3B
NA C G TAny base4N

How many sequences does a degenerate sequence stand for?

Each position is independent, so the number of concrete sequences is the product of the degeneracies:

Combinations = d₁ × d₂ × … × dn
d = 1 (A C G T) · 2 (R Y S W K M) · 3 (B D H V) · 4 (N)

Worked example. The universal 16S primer 515F is GTGYCAGCMGCCGCGGTAA, 19 nt with one Y and one M. Its degeneracy is 2 × 2 = 4, so the tube holds four oligonucleotides:

GTGCCAGCAGCCGCGGTAA
GTGCCAGCCGCCGCGGTAA
GTGTCAGCAGCCGCGGTAA
GTGTCAGCCGCCGCGGTAA

The count is kept as an exact integer, so a sequence of 200 N is reported as 2.58 × 10120 combinations rather than overflowing to infinity. Only the list of sequences is limited.

When do you need to expand IUPAC codes?

  • Ordering a degenerate primer. The degeneracy sets how much of the mixture actually matches the target, so a 64-fold primer needs a higher total concentration than a 4-fold one and usually a lower annealing temperature.
  • Searching a database. Many search tools take no ambiguity codes, so a degenerate motif has to be given as a list of exact sequences.
  • Counting oligonucleotide mixtures. A synthesis quote and the complexity of a randomised library both follow from the same product.
  • Checking a restriction site. GGTNACC or GANTC expands to the exact sites an enzyme cuts.

Collapsing sequences into one IUPAC code

The second tab does the reverse. Give it aligned sequences of the same length, one per line or as FASTA, and every column is replaced by the code for the set of bases in it: a column with only A and G becomes R, a column with C, G and T becomes B. Feed the four sequences above back in and you get GTGYCAGCMGCCGCGGTAA again. Because the codes describe columns independently, a consensus can cover more sequences than you supplied; the tool reports how many, so you can tell an exact collapse from a loose one.

To flip a degenerate sequence to the other strand, use thereverse complement tool, which keeps IUPAC codes. To check a primer pair for self-annealing, use the primer dimer checker.

Frequently asked questions

How many sequences does a degenerate primer stand for?

Multiply the degeneracy of every position: 1 for A, C, G and T, 2 for R, Y, S, W, K and M, 3 for B, D, H and V, and 4 for N. The primer GTGYCAGCMGCCGCGGTAA has one Y and one M, so it is a mixture of 2 × 2 = 4 sequences.

Why does the tool show only the first sequences?

Degeneracy grows exponentially. Twelve N positions already give 16.7 million sequences, more than a browser can list. The count is always exact, and the list is cut at the limit you choose, 100, 1,000 or 10,000.

Does it work for RNA?

Yes. A sequence that contains U and no T is treated as RNA and the expanded sequences are written with U. IUPAC codes mean the same bases in both alphabets.

What does the collapse mode do?

It reads a set of aligned sequences of the same length and writes one sequence in which every column is replaced by the IUPAC code for the bases seen in that column. It is the inverse of expanding, and it is how a degenerate primer is designed from an alignment.

Why does my consensus cover more sequences than I put in?

IUPAC codes describe each position on its own, so they cannot record which bases go together. Two sequences ACG and TCT collapse to WCK, which also covers ACT and TCG. The tool reports how many sequences the consensus covers so you can see the difference.