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.
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.
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.
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.
pip install biopython
terminal command.python3 primer_calculator.py
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.
plasmid = Seq.Seq("DNA")
target_sequence = Seq.Seq("DNA")
. This is the sequence the tool will search forward and reverse primers for.
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.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.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.
plasmid = Seq.Seq("DNA")
as if you wanted to run the primer searchoverlap=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")
[1] Biopyhthon