libnano / primer3-py

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

calc_heterodimer fails on longer sequences #121

Closed martinfthomsen closed 1 year ago

martinfthomsen commented 1 year ago

Hi,

I upgraded to the new version 2.0, but now I experience an issue with the hetero dimer calc, where rather than an expected high Tm, it give an extreme low temperature (sub absolute zero temperatures).

Here is an example where i slowly remove the right side of the sequence, until the temperature calculation becomes positive:

>>> ThermoAnalysis().calc_heterodimer('AGGTCAAGAAATCAATGTTGACATC', reverse_complement('AGGTCAAGAAATCAATGTTGACATC'))
ThermoResult(structure_found=True, tm=-397.98, dg=2387.48, dh=4600.00, ds=8.10)
>>> ThermoAnalysis().calc_heterodimer('AGGTCAAGAAATCAATGTTGACAT', reverse_complement('AGGTCAAGAAATCAATGTTGACAT'))
ThermoResult(structure_found=True, tm=-397.98, dg=2387.48, dh=4600.00, ds=8.10)
>>> ThermoAnalysis().calc_heterodimer('AGGTCAAGAAATCAATGTTGACA', reverse_complement('AGGTCAAGAAATCAATGTTGACA'))
ThermoResult(structure_found=True, tm=-397.98, dg=2387.48, dh=4600.00, ds=8.10)
>>> ThermoAnalysis().calc_heterodimer('AGGTCAAGAAATCAATGTTGAC', reverse_complement('AGGTCAAGAAATCAATGTTGAC'))
ThermoResult(structure_found=True, tm=57.33, dg=-41265.86, dh=-167100.00, ds=-460.68)

here is an example where i slowly add bases to the right side of the sequence, until the temperature calculation suddenly changes to negative:

>>> ThermoAnalysis().calc_heterodimer('GGCGTTGACGTGCAGATC', reverse_complement('GGCGTTGACGTGCAGATC'))
ThermoResult(structure_found=True, tm=60.21, dg=-38792.30, dh=-146800.00, ds=-395.42)
>>> ThermoAnalysis().calc_heterodimer('GGCGTTGACGTGCAGATCC', reverse_complement('GGCGTTGACGTGCAGATCC'))
ThermoResult(structure_found=True, tm=63.13, dg=-41338.69, dh=-154800.00, ds=-415.38)
>>> ThermoAnalysis().calc_heterodimer('GGCGTTGACGTGCAGATCCC', reverse_complement('GGCGTTGACGTGCAGATCCC'))
ThermoResult(structure_found=True, tm=-277.10, dg=1756.95, dh=200.00, ds=-5.70)

I hope you can help.

Kind regards, Martin

benpruitt commented 1 year ago

Hi Martin -- I'm having trouble reproducing this behavior (primer3-py v2.0.0 on python=3.11.5) here's the script I ran:

from primer3.p3helpers import reverse_complement
from primer3.thermoanalysis import ThermoAnalysis

print(ThermoAnalysis().calc_heterodimer('GGCGTTGACGTGCAGATC',  reverse_complement('GGCGTTGACGTGCAGATC')))
print(ThermoAnalysis().calc_heterodimer('GGCGTTGACGTGCAGATCC', reverse_complement('GGCGTTGACGTGCAGATCC')))
print(ThermoAnalysis().calc_heterodimer('GGCGTTGACGTGCAGATCCC', reverse_complement('GGCGTTGACGTGCAGATCCC')))

and here's the printed output:

ThermoResult(structure_found=True, tm=59.14, dg=-20998.14, dh=-146800.00, ds=-405.62)
ThermoResult(structure_found=True, tm=61.67, dg=-22619.70, dh=-154800.00, ds=-426.18)
ThermoResult(structure_found=True, tm=63.97, dg=-24241.26, dh=-162800.00, ds=-446.75)

Could you please provide the following information:

  1. What platform and python version are you running?
  2. How did you build and/or install primer3-py?
  3. What implementation of reverse_complement are you using?
martinfthomsen commented 1 year ago

Arh, thanks, I found the culprit, it was in my arguments to ThermoAnalysis.

From the source code, I see you removed the thal_type argument and added some new ones, that I should look into: 🙂 dmso_conc: float = DEFAULT_P3_ARGS.dmso_conc, dmso_fact: float = DEFAULT_P3_ARGS.dmso_fact, formamide_conc: float = DEFAULT_P3_ARGS.formamide_conc, annealing_temp_c: float = DEFAULT_P3_ARGS.annealing_temp_c,

Removing the thal_type argument I had, fixed my issue...