BjornFJohansson / pydna

Clone with Python! Data structures for double stranded DNA & simulation of homologous recombination, Gibson assembly, cut & paste cloning.
Other
160 stars 39 forks source link

Expanding the oligo melting temperature calculations #237

Open BjornFJohansson opened 1 week ago

BjornFJohansson commented 1 week ago

As per the 4th Pydna meeting, it was generally agreed that Pydna and tools that depend on it would benefit from being able to simulate modern commercial Tm calculators offline.

I have compiled data around this here

The NEB.ipynb notebook contain attempts to replicate the NEB Tm calculator simply by selecting parameters in the biopython Tm module. This was successful for the standard Taq polymerase with the buffer composition stated by NEB.

I was not able to guess the result for the Q5 polymerase. A contributing factor is the secrecy of the buffer composition.

The NEB logics seems contained in the file NEB/NEB_website/NEB Tm Calculator_files/main-3d92a74abb.js

I formatted the code with an online js formatter in the file main-3d92a74abb_formatted.js.

The variables below seem important, but I was not able to follow the logics.

r.TmCalc.prototype.nnBr r.TmCalc.prototype.nnSa r.TmCalc.prototype.nnde r.TmCalc.prototype.nndhds r.TmCalc.prototype.nnloop r.TmCalc.prototype.nnbulge r.TmCalc.prototype.nntmm r.TmCalc.prototype.R=1.987, r.TmCalc.prototype.dSBr r.TmCalc.prototype.dSSa r.TmCalc.prototype.dHBr r.TmCalc.prototype.dHSa r.TmCalc.prototype.init r.TmCalc.prototype.saltCorrect r.TmCalc.prototype.setCt r.TmCalc.prototype.setMonosalt r.TmCalc.prototype.setDisalt r.TmCalc.prototype.setDMSO r.TmCalc.prototype.buildPairMap

Some other people have worked on similar issues here and here

I think this is worth spending some time, since interestingly, the Thermofisher Tm calculator here gives similar, but not identical results and claims to use similar but not identical thermodynamic data.

manulera commented 1 week ago

@BjornFJohansson @hiyama341 , it would be great if you could provide:

BjornFJohansson commented 1 week ago

Nearest Neighbor Method explained: https://youtu.be/0iRg2P7KzHo

BjornFJohansson commented 1 week ago

Minimal example extracted from teemi. The results are identical to the web interface.

import json
import requests

# NEB example primers:
primers = """\
AGCGGATAACAATTTCACACAGGA
GTAAAACGACGGCCAGT
AGCGGATAACAATTTCAC
AGCGGATAAGGGCAATTTCAC
GTAAAACGACGGCCA""".splitlines()

conc=0.5
prodcode="q5-0"
url = "https://tmapi.neb.com/tm/batch"

for primer in primers:
    seqpairs = [[primers]]
    input_ = {"seqpairs": seqpairs, "conc": conc, "prodcode": prodcode}
    headers = {"content-type": "application/json"}
    res = requests.post(url, data=json.dumps(input_), headers=headers)
    r = json.loads(res.content)

    if r["success"]:
        for row in r["data"]:
            print(row["tm1"])
    else:
        print("request failed")
        print(r["error"][0])

# Result  
# 66
# 62
# 57
# 65
# 59
MarkusPiotrowski commented 6 days ago

I had settings for Biopython's MeltingTemp to simulate Q5 and Phusion Tm calculations on the NEB website some time ago (at that time, calculations for Q5 and Phusion gave different results), but obviously they changed some settings in their calculator.

BjornFJohansson commented 6 days ago

Yes, I get wildly different results right now. I would like to mimic the behaviour of the NEB calculator, the source code is not easy to follow though.