Random DNA generator

Random DNA, RNA, coding DNA or protein sequences as FASTA, from a seed you can repeat.

Sequences to make

FASTA

The same seed rebuilds the same sequences

How are the sequences generated?

Each position is drawn independently in the browser: for DNA, first a coin flip, weighted by the GC content you choose, decides whether the base is G or C versus A or T, then a second, even flip picks which of the pair to place. No sequence is stored or sent anywhere.

P(G or C) = GC% ÷ 100, split evenly between G and C
P(A or T) = 1 − GC% ÷ 100, split evenly between A and T

The flips come from a seeded generator rather than from the browser's own randomness, so a draw can be repeated. The seed sits under the result, and the same seed with the same settings always gives the same FASTA, in any browser. Press Generate again for a new seed and a fresh set.

Random coding DNA

The Coding DNA tab builds an open reading frame rather than a plain stretch of bases. The length is given in codons, and the sequence is put together in three parts:

ATG + (n − 2 codons, none of them a stop codon) + one stop codon

Every internal codon is drawn base by base with the GC weighting above and redrawn if it comes out as a stop codon, so nothing interrupts the reading frame. The result therefore translates to a protein of n − 1 residues, starting with methionine, and any gene finder or translation tool will read it as a complete coding sequence. Stop codons in the other two frames are not touched, and they turn up as often as chance dictates, which is what a real gene looks like.

Which codons count as stops depends on the genetic code, so the code is yours to pick. The NCBI translation tables behind the seven options:

Genetic codeNCBI tableStop codons
Standard1TAA, TAG, TGA
Bacterial11TAA, TAG, TGA
Vertebrate mito2TAA, TAG, AGA, AGG
Yeast mito3TAA, TAG
Mold mito4TAA, TAG
Invertebrate mito5TAA, TAG
Ciliate nuclear6TGA

Throwing stop codons away pulls the GC content up a little, because two of the three standard stops, TAA and TAG, are the AT-rich ones. At a 50% target a long standard-code sequence averages50.9% GC rather than 50.0%, and the header of each record reports what it actually came out at.

Random protein

The Protein tab draws from the 20 standard amino acids, one residue at a time and independently, with no start or stop to worry about. Three compositions are offered:

  • Equal, 5% each. Every amino acid is as likely as every other. The right null model when you want no composition bias at all.
  • Average protein. The Robinson and Robinson frequencies, the background BLAST uses: leucine is the commonest residue at 9.0%, then alanine 7.8%, glycine 7.4% and serine 7.1%, while tryptophan is the rarest at 1.3% and cysteine next at 1.9%. Sequences drawn this way pass a composition check.
  • Custom. Type letters and weights, such as A 8 L 9 G 7. Anything you leave out is never drawn, and the weights are scaled for you, so 8 9 7 and 0.8 0.9 0.7 mean the same thing.

Worked example

DNA. "Try an example" sets the length to 150, GC content to 45%, the count to3 and the seed to 1. The result is 3 FASTA records of 150 bases, 450 nt in total, at44.2% GC overall. The individual records come out at 49.3%, 42.0% and 41.3%, so the headers read>random_1 length=150 gc=49.3% and so on: short sequences scatter around the target rather than hitting it.

Coding DNA. The example is 100 codons at 50% GC, 3 sequences, standard code, seed 1. Each record is 300 nt, begins ATG, ends in a stop codon and has none in between; the first isATG GCG GGC GTT … and finishes … ATC TGA. The three come out at 52.3%, 52.7% and 55.7% GC.

Protein. The example is 150 residues, 3 sequences, average composition, seed 1. Across the 450 residues leucine comes to 8.7% and tryptophan to 1.1%, against the 9.0% and 1.3% they are drawn at.

When to use random sequences

  • Test data for a new pipeline or script before real sequencing data is available.
  • Negative controls or decoy sequences alongside a real dataset.
  • Benchmarking the speed of an alignment or search tool.
  • Sequences with a chosen GC content, to see how a downstream tool behaves at the extremes.
  • Random coding DNA to check that a gene finder, an ORF finder or a translation step handles a clean reading frame, and to give a codon-aware tool something to chew on.
  • Random protein as a decoy database, as padding for a search benchmark, or as the null model for a motif or domain hit.

To reorder a real sequence instead of inventing one, use shuffle DNA; to draw from the composition of a sequence you already have, use sample DNA. To read a coding sequence back into protein, use DNA to RNA and check the composition with GC content.

Frequently asked questions

How random is this generator?

Each residue is drawn from a seeded generator, the same mulberry32 arithmetic the shuffle and sample tools use. That is fine for test data, primers to try out a pipeline, or negative controls, but it is not cryptographically secure and should not be used to generate anything security-sensitive. The seed is shown with the result: the same seed and settings always rebuild the same sequences, and Generate again picks a new seed.

Why is the actual GC content not exactly what I typed?

Each base is chosen independently: first a coin flip decides G/C versus A/T using your target percentage, then a second flip picks which of the pair. Over a long sequence the average lands close to the target, but any single short sequence will vary around it, the same way a fair coin flipped 20 times rarely lands exactly 10-10. The GC content each sequence actually came out at is printed in its FASTA header.

Can I generate RNA instead of DNA?

Yes, turn on Output as RNA in the DNA tab and every T is drawn as U instead, with the same GC targeting. Coding sequences are always written as DNA, because start and stop codons are defined on the DNA alphabet.

How do you make sure a random coding sequence has no internal stop codon?

Every internal codon is drawn on its own and redrawn whenever it comes out as a stop codon of the genetic code you chose, so the finished sequence has ATG at the front, one stop codon at the back and none in frame in between. Stop codons in the other two reading frames are left alone, and they do occur, which is what a real open reading frame looks like.

What does a custom amino acid composition look like?

A letter followed by its weight, separated by spaces or commas: A 8 L 9 G 7 means alanine, leucine and glycine only, in the proportions 8:9:7. The weights do not need to add up to 100, they are scaled for you, and any of the 20 amino acids you leave out is never drawn. If nothing in the box can be read as a composition the generator falls back to equal proportions and says so.

Is there a limit on length or number of sequences?

Length is capped at 100,000 bases or amino acids, coding sequences at 33,333 codons, and the sequence count at 100 per generation, which keeps the page responsive in the browser. GC content defaults to 50% and the count to 1 when you leave those boxes empty.