Package: primers
primersThis is a small, straightforward tool for creating PCR primers. Its target use-case is DNA assembly.Reasons to chooseprimersinstead ofPrimer3include its:features: It is uniquely focused on DNA assembly flows like Gibson Assembly and Golden Gate cloning. You can design primers while adding sequence to the 5' ends of primers.simplicity: It is a small and simple Python CLI/library with a single dependency (seqfold). It is easier to install and use.interface: The Python library accepts and create primers forBiopythonSeqclasses. It outputs JSON for easy integration with other applications.license: It has a permissive, business-friendly license (MIT) instead of a copyleft GPL v2 license.InstallationpipinstallprimersUsageprimerschooses pairs while optimizing for length, tm, GC ratio, secondary structure, and off-target binding. In the simplest case, you just pass the sequence you want to amplify:$primerscreateCTACTAATAGCACACACGGGGACTAGCATCTATCTCAGCTACGATCAGCATCdirtmttmgcdgpseqFWD63.663.60.502.6CTACTAATAGCACACACGGGREV63.263.20.5-0.161.52GATGCTGATCGTAGCTGAGATAAdditional sequence is added to the 5' end of primers via theadd_fwd/add_revargs (-f/-rwith CLI). By default, it will prepend the entire additional sequence. If you want it to choose the best subsequence to add to the 5' end (factoring in the features dicussedbelow), allow it to choose from a range of indicies via theadd_fwd_len/add_rev_len(-fl/-rlwith CLI). Each primer has two tms: "tm", the melting temperature for the portion of the primer that binds to the template sequence and "tm_total", the melting temperature for the entire primer including the additional sequence added to primers' 5' end.Pythonfromprimersimportcreate# add enzyme recognition sequences to FWD and REV primers: BsaI, BpiIfwd,rev=create("AATGAGACAATAGCACACACAGCTAGGTCAGCATACGAAA",add_fwd="GGTCTC",add_rev="GAAGAC")print(fwd.fwd)# Trueprint(fwd.seq)# GGTCTCAATGAGACAATAGCACACACA; 5' to 3'print(fwd.tm)# 62.4; melting tempprint(fwd.tm_total)# 68.6; melting temp with added seq (GGTCTC)print(fwd.dg)# -1.86; minimum free energy of the secondary structure# add from a range of sequence to the FWD primer: [5, 12] bpfwd,rev=create("AATGAGACAATAGCACACACAGCTAGGTCAGCATACGAAA",add_fwd="GGATCGAGCTTGA",add_fwd_len=(5,12))print(fwd.seq)# AGCTTGAAATGAGACAATAGCACACACAGC (AGCTTGA added from add_fwd)print(fwd.tm)# 62.2print(fwd.tm_total)# 70.0CLI$ primers create --help
usage: primers create [-h] [-f SEQ] [-fl INT INT] [-r SEQ] [-rl INT INT] [-t SEQ] [-j | --json | --no-json] SEQ

positional arguments:
  SEQ                   create primers to amplify this sequence

options:
  -h, --help            show this help message and exit
  -f SEQ                additional sequence to add to FWD primer (5' to 3')
  -fl INT INT           space separated min-max range for the length to add from '-f' (5' to 3')
  -r SEQ                additional sequence to add to REV primer (5' to 3')
  -rl INT INT           space separated min-max range for the length to add from '-r' (5' to 3')
  -t SEQ                sequence to check for off-target binding sites
  -j, --json, --no-json
                        write the primers to a JSON arrayTable Output FormatBy default, the primers are logged in table format in rows ofdir, tm, ttm, gc, dg, p, seqwhere:dir: FWD or REVtm: the melting temperature of the annealing portion of the primer (Celsius)ttm: the total melting temperature of the primer with added seq (Celsius)gc: the GC ratio of the primerdg: the minimum free energy of the primer (kcal/mol)p: the primer's penalty score. Lower is betterseq: the sequence of the primer in the 5' to the 3' direction$ primers create -f GGTCTC -r GAAGAC AATGAGACAATAGCACACACAGCTAGGTCAGCATACGAAA
  dir    tm   ttm  gc     dg     p  seq
  FWD  60.8  67.0 0.5  -1.86  5.93  GGTCTCAATGAGACAATAGCACACAC
  REV  60.8  65.8 0.5      0   3.2  GAAGACTTTCGTATGCTGACCTAGJSON Output FormatThe--jsonflag prints primers in JSON format with more details on scoring. The example below is truncated for clarity:$ primers create CTACTAATAGCACACACGGGGACTAGCATCTATCTCAGCTACGATCAGCATC --json| jq
[
  {
    "seq": "CTACTAATAGCACACACGGG",
    "len": 20,
    "tm": 63.6,
    "tm_total": 63.6,
    "gc": 0.5,
    "dg": 0,
    "fwd": true,
    "off_target_count": 0,
    "scoring": {
      "penalty": 2.6,
      "penalty_tm": 1.6,
      "penalty_tm_diff": 0,
      "penalty_gc": 0,
      "penalty_len": 1,
      "penalty_dg": 0,
      "penalty_off_target": 0
    }
  },
...AlgorithmChoosing PCR primers requires optimizing for a few different characteristics. Ideally, pairs of primers for PCR amplification would have similar tms, GC ratios close to 0.5, high minimum free energies (dg), and a lack off-target binding sites. Inprimers, like Primer3, choosing amongst those (sometimes competing) goals is accomplished with a linear function that penalizes undesirable characteristics. The primer pair with the lowest combined penalty is chosen.ScoringThe penalty for each possible primer,p, is calculated as:PENALTY(p) =
    abs(p.tm - optimal_tm) * penalty_tm +     // penalize each deg of suboptimal melting temperature
    abs(p.gc - optimal_gc) * penalty_gc +     // penalize each percentage point of suboptimal GC ratio
    abs(len(p) - optimal_len) * penalty_len + // penalize each bp of suboptimal length
    abs(p.tm - p.pair.tm) * penalty_tm_diff + // penalize each deg of melting temperature diff between primers
    abs(p.dg) * penalty_dg +                  // penalize each kcal/mol of free energy in secondary structure
    p.offtarget_count * penalty_offtarget     // penalize each off-target binding siteEach of the optimal (optimal_*) and penalty (penalty_*) parameters is adjustable in theprimers.create()function. The defaults are below:optimal_tm:float=62.0optimal_gc:float=0.5optimal_len:int=22penalty_tm:float=1.0penalty_gc:float=0.2penalty_len:float=0.5penalty_tm_diff:float=1.0penalty_dg:float=2.0penalty_offtarget:float=20.0Scoring Existing PrimersIf you already have primers, and you want to see their features and penalty score, use theprimers scorecommand. The command below scores a FWD and REV primer against the sequence-sthat they were created to amplify:$ primers score GGTCTCAATGAGACAATA TTTCGTATGCTGACCTAG -s AATGAGACAATAGCACACACAGCTAGGTCAGCATACGAAATTT --json | jq
[
  {
    "seq": "GGTCTCAATGAGACAATA",
    "len": 18,
    "tm": 39.4,
    "tm_total": 55,
    "gc": 0.4,
    "dg": -1.86,
    "fwd": true,
    "off_target_count": 0,
    "scoring": {
      "penalty": 49.9,
      "penalty_tm": 22.6,
      "penalty_tm_diff": 19.6,
      "penalty_gc": 2,
      "penalty_len": 2,
      "penalty_dg": 3.7,
      "penalty_off_target": 0
    }
  },
  {
    "seq": "TTTCGTATGCTGACCTAG",
    "len": 18,
    "tm": 59,
    "tm_total": 59,
    "gc": 0.5,
    "dg": 0,
    "fwd": false,
    "off_target_count": 0,
    "scoring": {
      "penalty": 24.6,
      "penalty_tm": 3,
      "penalty_tm_diff": 19.6,
      "penalty_gc": 0,
      "penalty_len": 2,
      "penalty_dg": 0,
      "penalty_off_target": 0
    }
  }
]Off-target Binding SitesUsually, off-target binding sites should be avoided. Inprimers, off-target binding sites are those with<= 1mismatch in the last 10 bair pairs of the primer's 3' end. This definition experimentally supported by:Wu, J. H., Hong, P. Y., & Liu, W. T. (2009). Quantitative effects of position and type of single mismatch on single base primer extension. Journal of microbiological methods, 77(3), 267-275By default, primers are checked for off-targets within theseqparameter passed tocreate(seq). But the primers can be checked against another sequence if it is passed to the optionalofftarget_checkargument (-tfor CLI). This is useful when PCR'ing a subsequence of a larger DNA sequence like a plasmid.fromprimersimportcreateseq="AATGAGACAATAGCACACACAGCTAGGTCAGCATACGAAA"seq_parent="ggaattacgtAATGAGACAATAGCACACACAGCTAGGTCAGCATACGAAAggaccagttacagga"# primers are checked for offtargets in `seq_parent`fwd,rev=create(seq,offtarget_check=seq_parent)