Software

Primer Calculator

Primer Calculator

Designing Primers is a critical task in synthetic biology. While several computational tools exist, they are often lacking configuration options or use private algorithms. Moreover, various industry-standard primer calculation tools we tested gave wildly different results. To alleviate this and understand the specifics of such a program, we coded a simple primer calculator ourselves.


Our Goals

Build a working Primer calculator using Biopython1 from scratch. Its inputs are the plasmid and our target sequence. It should be able to calculate both forward and reverse primers, detect hairpin structures and target a specific CG-ratio.


How we calculate Primers

First, we verify the configuration parameters to make sure they are in the appropriate ranges. After that, we check for the shortest overlap we can create for our target that is unique in the plasmid. During this step, we also discard any sequences that can form hairpins according to our hairpin stem and loop length parameters. Once we found a suitable overlap sequence, we count the CG nucleotides and calculate how many AT and CG nucleotides are further needed to reach both our target length and CG ratio. With this information in mind, we create a randomized sequence of DNA and prepend or append our overlap to create a forward or reverse primer. The resulting primer is visualized as formatted text output that allows to see the overlap.


Verification

Apart from calculating our own primers, we wanted to verify primers that we found by hand or by using an industry-standard tool. Therefore, our primer calculator has a “verify primer” method to check for the uniqueness of the overlap in the plasmid, hairpin structures and a favourable cg ratio as described above and warns the user if any problems are found.

How to use it

Setup

  1. Install the latest Python version on your PC.
  2. Clone the GitLab repository to your PC.
  3. Install Biopython, e.g. by using the pip install biopython terminal command.
  4. Test if everything is set up correctly by running the primer_calculator.py file in the terminal using python3 primer_calculator.py
  5. You should see the result of the primer calculation. If no errors appears, you have set this tool up correctly.

Usage

To use the primer calculator, you need to adjust the DNA data and configuration parameters in the main method of the primer_calculator.py file.

  1. Replace the preexisting DNA string with your plasmid DNA in plasmid = Seq.Seq("DNA")
  2. Replace the preexisting DNA string with your target sequence in target_sequence = Seq.Seq("DNA"). This is the sequence the tool will search forward and reverse primers for.

Customization Options

  1. Change the number 20 in primer_length=20 to adjust your target primer length. The tool will strive to achieve this length. Note: If the primer_length is too small, the tool might not find an unique primer sequence or might not be able to achieve the target CG ratio. If this is the case, the tool will give you a warning.
  2. Change the ratio 0.55 in cg_ratio=0.55 to adjust your target CG ratio. This number must be between 0 and 1 and is often desired to be between 0.4 and 0.6.
  3. Both min_stem_length=2 and min_loop_length=3 are the parameters of the hairpin search. Hairpins consist of a stem and a loop. The loop refers to the nucleotides that do not bind and loop backwards while the stem are the binding nucleotides. These parameters adjust what the program classifies as a potential hairpin structure. The default setting is very aggressive and might discard lots of primers. If the overlap is very large to achive uniqueness in the plasmid, you might need to increase these values to find primers.

Verification

  1. Uncomment the related method, depending on whether you want to verify a forward or reverse primer.
  2. Insert your plasmid in the plasmid = Seq.Seq("DNA") as if you wanted to run the primer search
  3. Identify the overlap of your primer with the target sequence, then split the primer there. Paste the overlap into overlap=Seq.Seq("PASTE THE OVERLAP WITH THE TARGET SEQUENCE HERE") and the rest of the primer into rest_of_sequence=Seq.Seq("PASTE THE REST OF THE SEQUENCE HERE")
  4. Comment out the main primer search method (seen in the Customization Options).
  5. Run the script




References

[1] Biopyhthon

[2] Link to GitLab Repository