Dear Bioinformatics Community,

I hope you're all doing well. I am currently working on a project that requires designing some 10 nucleotide single-stranded DNAs, (preferably), with specific criteria.

The criteria for the DNA sequences are as follows:

  • An equal mix of nucleotides (A, C, G, and T)
  • Thermodynamically stable sequences
  • Sequences that do not self-hybridize or hybridize with each other

I have been exploring the NUPACK software suite to achieve these goals, but I am finding it challenging to use the tools effectively for this specific task. I understand that NUPACK is primarily designed for generating sequences based on target secondary structures, which may not directly align with my requirements.

I would greatly appreciate any advice, suggestions, or alternative methods you can provide to help me design these DNA sequences. Are there any other tools or resources that might be better suited for this purpose?

Thank you in advance for your insights and expertise. Your guidance will be invaluable as I work to complete this project.

Best regards,

  • 2
    $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Commented Apr 26, 2023 at 11:42
  • 1
    $\begingroup$ Welcome @Hashem and thank you for your question. It would useful to understand the downstream application, i.e. why do you need the synthetic oligonucleotides and some understanding of the organism, possibly in general terms, e.g. just kingdom level and possible diversity. This appears to be primer design, for which there are a lot packages, within that you appear to be wanting nucleotide degeneracy. The question is not hard to answer - but is not very clear. $\endgroup$
    – M__
    Commented Apr 27, 2023 at 16:29
  • 1
    $\begingroup$ I edited your question to make it clearer and to add relevant tags, please update if you do not consider my edits to be accurate. $\endgroup$ Commented Feb 2 at 20:45

1 Answer 1


It is not difficult to simulate every 10mer DNA oligo, here is some Python code that will do that:

(there is probably a more elegant way to do this)

from itertools import product

nts = ["A", "T", "C", "G"]
# create a tuple with 10 copies of nts for the cartesian product
ten_tup = (nts,)*10

decamers = []
# create and iterate over a stringified cartesian product,
# which consists of all 10mers.
for a,b,c,d,e,f,g,h,i,j in product(*ten_tup):

At this point, you have some choices to make:

  • how many 10mers do you want?
  • what exactly is your criterion for GC content?
  • what exactly is your criterion for thermodynamic interactions?

I'd suggest either primer3 or viennarna for evaluating thermodynamics. You can run each from the command line or from a web server, but they do have Python APIs, which I use below. ViennaRNA is definitely more trustworthy for sequences as short as 10, so I'll use it here. It will be a lot slower though as it's not cheating by using the nearest-neighbor approximations.

I have made up some numbers for the thresholds below, replace with your own.

from random import shuffle
GC_MIN = 4
GC_MAX = 6
DDG = -5

def test_gc(seq, gc_min=GC_MIN, gc_max=GC_MAX):
  gc_count = seq.count("G") + seq.count("C")
  if gc_count >= gc_min and gc_count <= gc_max:
    return True
    return False

def test_thermo(seq, other_seqs, ddg=DDG):
  intra = RNA.fold_compound(seq).mfe()[1]
  if other_seqs:
    # find the most favorable interaction with any other sequence
    inter = min(
      [RNA.fold_compound(seq+"&"+other_seq).mfe_dimer()[1] for other_seq in other_seqs]
    inter = 0
  homo = RNA.fold_compound(seq+"&"+seq).mfe_dimer()[1]
  if intra > ddg and inter > ddg and homo > ddg:
    return True
    print("thermo reject!!")
    return False

chosen_seqs = []
# shuffle the decamers to ensure that you get dissimilar sequences
i = 0
for seq in decamers:
  if test_gc(seq) and test_thermo(seq, chosen_seqs):
  if len(chosen_seqs) >= NUM_WANTED:

# chosen_seqs has your decamers that pass the threshold

In principle, you could even combine these 2 steps but I think it's cleaner to keep them apart unless storing 4^10 ~= 1 million decamers in memory is an issue, which it shouldn't be with modern computers.

Caveat emptor, this code may contain bugs and I haven't tested it other than making sure it runs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.