Repository: biopython/biopython

Issue:
Discrepancies in Tm Values when using  MeltingTemp.Tm_NN(seq=, nn_table = MeltingTemp.R_DNA_NN1)
### Setup

I'm using MeltingTemp.Tm_NN(seq=my_seq, nn_table = MeltingTemp.R_DNA_NN1) to calculate Tm of relatively short RNA/DNA duplexes and for some of them I get negative values. In my case, I don't know the salt and other divalent cations concentration, as well as the initial concentrations of the RNA and DNA probes that that forms the duplex. However they are full complement without gap, mismatches and shifts.

 MeltingTemp.R_DNA_NN1 is based on Sugimoto 95 results. However, when running the same duplexes (ignoring the salt and other divalent cations) that tested by Sugimoto (1995), I get discrepancies. Even though I didn't enter the salt concentration and other cations I wouldn't expect such discrepancies.

```python
from Bio.Seq import Seq
from Bio.SeqUtils import MeltingTemp as mt
Sugimoto95 = [
    ('GGACUUA', 25.9),
    ('UAAGUCC', 29.4),
    ('AGCCG', 30.8),
    ('CGGCU', 26.1),
    ('GGUUGG', 28.0),
    ('ACCGCA', 36.1),
    ('CAAUCG', 16.9),
    ('GGCACG', 41.5)
]
for t in Sugimoto95:
    myseq = Seq(t[0])
    tm = mt.Tm_NN(myseq, nn_table=mt.R_DNA_NN1)  
    tm = round(tm, 1)  # round to one decimal
    print ('BioPython Tm: ' + str(tm) + '  Sugimoto95 Tm: ' + str(t[1]))   
   
```

Output:
BioPython Tm: -8.1  Sugimoto95 Tm: 25.9
BioPython Tm: -8.5  Sugimoto95 Tm: 29.4
BioPython Tm: -9.8  Sugimoto95 Tm: 30.8
BioPython Tm: -10.5  Sugimoto95 Tm: 26.1
BioPython Tm: -14.4  Sugimoto95 Tm: 28.0
BioPython Tm: 5.5  Sugimoto95 Tm: 36.1
BioPython Tm: -16.1  Sugimoto95 Tm: 16.9
BioPython Tm: -0.4  Sugimoto95 Tm: 41.5
### Steps to reproduce

What am I missing?
Thank you!
Nastya



Discussion:
https://github.com/biopython/biopython/blob/biopython-178/Bio/SeqUtils/MeltingTemp.py#L266 suggests using ``R_DNA_NN1`` for RNA/DNA Sugimoto et al. (1995), so that's not the problem.
Without having looked into the details:
Selecting `mt.R_DNA_NN1` as table just selects the table of nearest neighbor values but all the other default values of `Tm_NN` (concentration of nucleic acids, salt concentration, salt adjustment calculation etc) stay the same. You need to adjust your call with the values that were actually used in the Sugimoto et al. 1995 paper, to get the same results.
@peterjc @MarkusPiotrowski  Thank you.
I used Sugimoto et al. 1995 paper just as a reference. I don't expect the values to be the same (when running the command without the other default values), but not with such discrepancies. Almost all values I got are negative.
If so, what is the best way to predict the Tm of RNA/DNA duplex if all the other defaults values of `Tm_NN` are unknown ?

1. The _defaults_ are not unknown, but described in `MeltingTemp`
2. You should have an idea on the experimental conditions, you cannot calculate a melting temperature just with the sequence without knowledge of other parameters
3. `MeltingTemp`s default values are for DNA/DNA hybrids according to the Allawi & SantaLucia (1997) paper.

When adding some information of the paper (e.g. total nucleic acid concentration = 100 µM = 100.000 nM, no salt correction, since measurements were done at standard 1 M salt) then we come closer:
```
>>> tm = mt.Tm_NN("GGACUUA", nn_table=mt.R_DNA_NN1, dnac1=50000, dnac2=50000, saltcorr=0)
>>> tm
27.614910502236512
```
This is still not the 25.9 given in the paper, but now we are near and can think about why we didn't match the 25.9 °C exactly. Could be an error in the table (ours or theirs) or we are still missing something that need to be added.
Just saw that the 25.9 were the measured value but 26.9 is the predicted value. This is the exact value that I get when entering the sequence in reverse/complementary form, so indeed it seems that our table is wrong (values must be exchanged with the reverse/complementary keys).

Thanks you!
Oh, this already has a history: In PR  #1594 I bugfixed the table in the wrong way.

Resolving patch:
diff --git a/Bio/SeqUtils/MeltingTemp.py b/Bio/SeqUtils/MeltingTemp.py
--- a/Bio/SeqUtils/MeltingTemp.py
+++ b/Bio/SeqUtils/MeltingTemp.py
@@ -83,7 +83,7 @@
     >>> print('%0.2f' % mt.Tm_NN(myseq, nn_table=mt.RNA_NN1))  # Freier '86
     73.35
     >>> print('%0.2f' % mt.Tm_NN(myseq, nn_table=mt.R_DNA_NN1))  # Sugimoto '95
-    57.17
+    58.45
 
 Several types of salc correction (for Tm_NN and Tm_GC):
 
@@ -267,12 +267,12 @@
     "init": (1.9, -3.9), "init_A/T": (0, 0), "init_G/C": (0, 0),
     "init_oneG/C": (0, 0), "init_allA/T": (0, 0), "init_5T/A": (0, 0),
     "sym": (0, 0),
-    "AA/TT": (-11.5, -36.4), "AC/TG": (-7.8, -21.6), "AG/TC": (-7.0, -19.7),
-    "AT/TA": (-8.3, -23.9), "CA/GT": (-10.4, -28.4), "CC/GG": (-12.8, -31.9),
-    "CG/GC": (-16.3, -47.1), "CT/GA": (-9.1, -23.5), "GA/CT": (-8.6, -22.9),
-    "GC/CG": (-8.0, -17.1), "GG/CC": (-9.3, -23.2), "GT/CA": (-5.9, -12.3),
-    "TA/AT": (-7.8, -23.2), "TC/AG": (-5.5, -13.5), "TG/AC": (-9.0, -26.1),
-    "TT/AA": (-7.8, -21.9)}
+    "TT/AA": (-11.5, -36.4), "GT/CA": (-7.8, -21.6), "CT/GA": (-7.0, -19.7),
+    "AT/TA": (-8.3, -23.9), "TG/AC": (-10.4, -28.4), "GG/CC": (-12.8, -31.9),
+    "CG/GC": (-16.3, -47.1), "AG/TC": (-9.1, -23.5), "TC/AG": (-8.6, -22.9),
+    "GC/CG": (-8.0, -17.1), "CC/GG": (-9.3, -23.2), "AC/TG": (-5.9, -12.3),
+    "TA/AT": (-7.8, -23.2), "GA/CT": (-5.5, -13.5), "CA/GT": (-9.0, -26.1),
+    "AA/TT": (-7.8, -21.9)}
 
 # Internal mismatch and inosine table (DNA)
 # Allawi & SantaLucia (1997), Biochemistry 36: 10581-10594


Test patch: