Sample DNA

Draws residues with replacement from the composition of your sequence, to any length you need.

Sampled sequences

What does sampling a sequence do?

It counts the residues in the sequence you paste, the guide, and then builds new sequences by drawing from those proportions with replacement. The result has the composition of the guide but none of its order, and can be any length you like: 20 sequences of 500 nt from a 150 nt guide is an ordinary request. It is the composition-matched background that motif searches, alignment score distributions and gene finders are usually tested against.

P(residue x) = count of x in the guide ÷ length of the guide
each position of the output is one independent draw from that distribution

Worked example

"Try an example" loads the first 120 nt of the EGFP coding sequence, whose composition is G 47, C 32, A 23 and T 18, that is G 39.2%, C 26.7%, A 19.2%, T 15.0% and 65.8% GC. With the default settings the tool draws 3 sequences of 100 nt. At seed 1 they come out at 68%, 62% and 64% GC: near the guide, not identical to it, which is exactly what independent draws look like. The guide and sampled compositions sit side by side under Details.

Sampling or shuffling?

Both give a composition-matched control, and the difference is whether the counts are fixed or drawn:

QuestionSamplingShuffling
Residue countsvary around the guideidentical to the input
Lengthanythingthe input length
How manyas many as you ask forone per record
Keeps dinucleotidesnooptionally, yes

For the strict version use shuffle DNA, which reorders the residues you already have. For a sequence with a GC content you type rather than one taken from a guide, use random DNA, orrandom DNA regions when the composition should change along the sequence. To check what came out, use sequence statistics.

How much do samples vary?

The share of a residue in a sample of length L has a standard deviation of √(p(1 − p) ÷ L). For GC at p = 0.66 and L = 100 that is 4.7 percentage points, at L = 1,000 it is 1.5, and at L = 10,000 it is 0.5. Short samples are meant to scatter; if you need every control to carry the exact composition of the original, shuffle instead of sampling.

Frequently asked questions

What does sampling with replacement mean?

Every position of the new sequence is drawn independently from the composition of the guide, and nothing is used up: a base that makes up 40% of the guide has a 40% chance at every position, however often it has already been drawn. That is why the output can be longer than the guide, and why two samples are never the same.

How is this different from shuffling?

A shuffle reorders the residues you have, so the counts come out exactly as they went in and the length cannot change. Sampling draws fresh residues from the same probabilities, so the counts vary around the guide the way a real random draw does and the length is yours to choose. Use a shuffle for a strict matched control, sampling when you need many sequences or a different length.

Why is the GC content of a sample not exactly the guide’s?

Because each position is an independent draw. A 100 nt sample from a 65.8% GC guide has a standard deviation of about 4.7 percentage points, so values between 56% and 75% are ordinary. Longer samples cluster more tightly: the spread falls with the square root of the length.

Does it use every record I paste?

Yes. The composition is counted over all records together, so a whole FASTA file can define the composition to sample from. Ambiguity codes such as N are counted as themselves and appear in the output with their own frequency.

Is the output repeatable?

Yes. The seed drives a deterministic generator, so the same guide, length, count and seed always give the same sequences, and editing an unrelated option does not redraw them. Press New sample for a fresh draw; the seed is shown with the result.