libnano / primer3-py

Simple oligo analysis and primer design
https://libnano.github.io/primer3-py
GNU General Public License v2.0
157 stars 43 forks source link

max_loop has no effect or am I understanding wrong? #107

Closed dodoflyy closed 1 year ago

dodoflyy commented 1 year ago

Hey, I want to limit hairpin loop size, but seems not working?
Here is code:

from primer3 import thermoanalysis

thrmo_analysis = thermoanalysis.ThermoAnalysis()
thrmo_analysis.max_loop = 5
y = thrmo_analysis.calc_hairpin("ATCGATCGAATTCCGCGATCGAT", output_structure=True)
print(y)
for each in y.ascii_structure_lines:
    print(each)

Here is output:

ThermoResult(structure_found=True, tm=66.91, dg=-5285.97, dh=-60100.00, ds=-176.73)
SEQ     -///////-------\\\\\\\-
STR     ATCGATCGAATTCCGCGATCGAT

I think this is a hairpin with loop size of 7, am I understanding right?

benpruitt commented 1 year ago

Yeah it's kind of odd -- I would expect that setting max_loop to 5 would preclude the output from including a 7 nt loop, but that appears to be the behavior with the standalone primer3 binaries as well (note that the thermodynamic outputs are slightly different due to differences in defaults between the bindings and binaries):

$ ./ntthal -s1 ATCGATCGAATTCCGCGATCGAT -a HAIRPIN -maxloop 5
Calculated thermodynamical parameters for dimer:    23  dS = -179.355   dH = -60100 dG = -4473.18   t = 61.9404
SEQ -///////-------\\\\\\\-
STR ATCGATCGAATTCCGCGATCGAT

Probably best to repost this question over at the primer3 project and see what the library authors have to say: https://github.com/primer3-org/primer3