Exact reproduction of the NEB Tm Calculator for PCR primer analysis with all NEB polymerases
Project description
polymerase-tm
Exact Python reproduction of the NEB Tm Calculator for PCR primer melting temperature (Tm) and annealing temperature (Ta) prediction.
Features
- Exact NEB Tm Calculator reproduction -- algorithm reverse-engineered from the NEB Tm Calculator front-end source; verified against the official tool with 0 degC deviation across all tested sequences.
- 22 NEB polymerase products with their specific buffer salt concentrations and Ta rules (Q5, Phusion, Taq, OneTaq, LongAmp, Vent, Deep Vent, and more).
- Automatic additive recommendation -- suggests Q5 High GC Enhancer or DMSO based on primer GC, hairpins, and amplicon analysis.
- Batch processing -- process hundreds of primer pairs from CSV files with full Tm/Ta/compatibility analysis.
- PCR protocol generator -- generates complete cycling protocols with polymerase-specific temperatures and extension times.
- Smart primer design -- find the optimal binding length for a target Tm.
- DMSO analysis -- analyses primer hairpins, amplicon GC content, GC-rich hotspots, and template secondary structures.
- CLI tool (
polymerase-tm) for quick calculations from the terminal.
Dependencies: Biopython (for GenBank template analysis in DMSO features).
Installation
pip install polymerase-tm
# From conda-forge (when available)
mamba install -c conda-forge polymerase-tm
Quick Start
Python API
from polymerase_tm import tm, ta
# Single primer Tm (Q5, 500 nM)
print(tm("ATGTCCCTGCTCTTCTCTCGATGCAA")) # 72
# Primer pair Ta
result_ta, tm_fwd, tm_rev = ta(
"ATGTCCCTGCTCTTCTCTCGATGCAA",
"GTGCCTCCGAGCCAGCACC",
)
print(f"Ta = {result_ta}, Fwd Tm = {tm_fwd}, Rev Tm = {tm_rev}")
# Ta = 72, Fwd Tm = 72, Rev Tm = 75
# Different polymerase
print(tm("ATGTCCCTGCTCTTCTCTCGATGCAA", polymerase="taq"))
# Ta with 3% DMSO
ta_dmso, _, _ = ta("ATGTCCCTGCTCTTCTCTCGATGCAA", "GTGCCTCCGAGCCAGCACC", dmso_pct=3)
print(f"Ta with 3% DMSO = {ta_dmso}") # 70
# List all available polymerases
from polymerase_tm import list_polymerases
for p in list_polymerases():
print(f"{p['key']:25s} {p['description']}")
Automation & Batch Processing
from polymerase_tm import (
batch_tm, # Bulk Tm for many sequences
optimal_binding_length, # Find shortest binding region for target Tm
check_pair, # Full primer pair compatibility report
pcr_protocol, # Generate complete PCR cycling protocol
reverse_complement, # DNA reverse complement
from_csv, to_csv, # CSV batch I/O
)
# Batch Tm for multiple primers
results = batch_tm(["ATCGATCGATCG", "GCGCGCGCGCGC", "AATTCCGGAATT"])
for r in results:
print(f"{r['sequence']}: Tm={r['tm']} degC, GC={r['gc_pct']}%")
# Find optimal binding length for a target Tm
result = optimal_binding_length("ATGTCCCTGCTCTTCTCTCGATGCAA", target_tm=65)
print(f"{result['binding_seq']} ({result['length']} nt, Tm={result['tm']})")
# CCTGCTCTTCTCTCGATGCAA (21 nt, Tm=67)
# Primer pair compatibility check (includes auto additive recommendation)
pair = check_pair("ATGTCCCTGCTCTTCTCTCGATGCAA", "GTGCCTCCGAGCCAGCACC")
print(f"Ta={pair['ta']}, compatible={pair['compatible']}")
if pair["additive"]["recommended"]:
print(f"Use {pair['additive']['additive']} ({pair['additive']['concentration']})")
# -> "Use Q5 High GC Enhancer (1x)" for Q5 with high-GC primers
# -> "Use DMSO (3%)" for Taq with high-GC primers
# Generate full PCR cycling protocol
protocol = pcr_protocol(
"ATGTCCCTGCTCTTCTCTCGATGCAA",
"GTGCCTCCGAGCCAGCACC",
amplicon_length=2500,
)
for step in protocol["cycling"]:
print(f"{step['step']:25s} {step['temp']} degC {step['time']}")
# Initial Denaturation 98 degC 30 s
# Denaturation 98 degC 10 s
# Annealing 72 degC 30 s
# Extension 72 degC 1 min 15 s
# Final Extension 72 degC 2 min
# Hold 4 degC indefinite
# CSV pipeline: read primers, compute everything, write results
results = from_csv("primers.csv") # expects columns: name, fwd, rev
to_csv(results, "results_with_tm.csv")
DMSO Analysis
from polymerase_tm import dmso_recommendation, print_dmso_report
report = dmso_recommendation(
fwd_bind="ATGTCCCTGCTCTTCTCTCGATGCAA",
rev_bind="GTGCCTCCGAGCCAGCACC",
template_file="template.gbk", # optional GenBank template
)
print_dmso_report(report)
Command Line
# Single primer Tm
polymerase-tm ATGTCCCTGCTCTTCTCTCGATGCAA
# Primer pair Ta (includes auto additive recommendation)
polymerase-tm ATGTCCCTGCTCTTCTCTCGATGCAA GTGCCTCCGAGCCAGCACC
# Different polymerase
polymerase-tm --polymerase taq ATGTCCCTGCTCTTCTCTCGATGCAA GTGCCTCCGAGCCAGCACC
# With DMSO correction
polymerase-tm --dmso 3 ATGTCCCTGCTCTTCTCTCGATGCAA GTGCCTCCGAGCCAGCACC
# List all polymerases
polymerase-tm --list
# DMSO analysis with template
polymerase-tm --dmso-check --template template.gbk FWD_SEQ REV_SEQ
# Version
polymerase-tm --version
API Reference
| Function | Description |
|---|---|
tm(seq, polymerase) |
Melting temperature for one primer |
ta(seq1, seq2, polymerase, dmso_pct) |
Annealing temperature for a primer pair |
batch_tm(sequences, polymerase) |
Batch Tm for multiple sequences |
check_pair(fwd, rev, polymerase) |
Pair compatibility + additive recommendation |
pcr_protocol(fwd, rev, polymerase, amplicon_length) |
Full PCR cycling protocol |
optimal_binding_length(seq, target_tm, polymerase) |
Find shortest binding region for target Tm |
reverse_complement(seq) |
DNA reverse complement |
from_csv(path, polymerase) |
Read primer pairs from CSV, compute Tm/Ta |
to_csv(results, path) |
Write results to CSV |
list_polymerases() |
List all 22 supported polymerases |
dmso_recommendation(fwd, rev, template) |
Full DMSO/additive analysis |
gc_content(seq) |
GC content as fraction |
Algorithm
| Component | Method | Reference |
|---|---|---|
| Nearest-neighbor Tm | SantaLucia (1998) | PNAS 95:1460-5 |
| Salt correction | Owczarzy et al. (2004) | Biochemistry 43:3537-54 |
| Ta rules | Polymerase-specific | NEB Tm Calculator v1.16 |
| DMSO correction | -0.6 degC per 1% | NEB Tm Calculator v1.16 |
Buffer Salt Concentrations
| Buffer | [Monovalent] (mM) | Used by |
|---|---|---|
| Q5 | 150 | Q5, Q5 Hot Start, Q5 Blood Direct |
| Q5U | 170 | Q5U Hot Start |
| Q5 Master Mix | 150 | Q5 2X Master Mix |
| Phusion HF / GC | 222 | Phusion, Phusion Hot Start Flex |
| Standard Taq | 55 | Taq, Hot Start Taq, EpiMark |
| ThermoPol | 40 | Vent, Deep Vent |
| OneTaq Std | 54 | OneTaq (Standard Buffer) |
| OneTaq GC | 80 | OneTaq (GC Buffer) |
| LongAmp | 100 | LongAmp, LongAmp Hot Start |
| Crimson Taq | 55 | Crimson Taq |
| Hemo KlenTaq | 70 | Hemo KlenTaq |
| Multiplex | 90 | Multiplex PCR Master Mix |
Ta Calculation Rules
| Polymerase family | Rule | Cap |
|---|---|---|
| Q5 | min(Tm1, Tm2) + 1 | 72 degC |
| Q5U | min(Tm1, Tm2) + 2 | 72 degC |
| Phusion | 0.93 * min(Tm1, Tm2) + 7.5 | 72 degC |
| Taq / OneTaq | min(Tm1, Tm2) - 5 | 68 degC |
| LongAmp | min(Tm1, Tm2) - 5 | 65 degC |
| Vent / Deep Vent | min(Tm1, Tm2) - 2 | 72 degC |
Disclaimer
This package is not affiliated with New England Biolabs (NEB). The algorithm was reverse-engineered from the publicly available JavaScript source of the NEB Tm Calculator for research and educational purposes. Always verify critical calculations against the official tool.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polymerase_tm-0.4.1.tar.gz.
File metadata
- Download URL: polymerase_tm-0.4.1.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c46c3afbd5848bc2f4ab331fc0c5982b1fc415fcc7a467f4143b85658d9582f6
|
|
| MD5 |
2ad57b0c8e5929f77b55731be579119e
|
|
| BLAKE2b-256 |
7cb40e31af154e045d5d70340c963ef47f1474d1a2bd938371dd87aeede98c59
|
Provenance
The following attestation bundles were made for polymerase_tm-0.4.1.tar.gz:
Publisher:
publish.yml on Dioskurides/polymerase-tm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymerase_tm-0.4.1.tar.gz -
Subject digest:
c46c3afbd5848bc2f4ab331fc0c5982b1fc415fcc7a467f4143b85658d9582f6 - Sigstore transparency entry: 1013017501
- Sigstore integration time:
-
Permalink:
Dioskurides/polymerase-tm@8110eb0469191ca2551b4790ead0f21c1802ba42 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Dioskurides
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8110eb0469191ca2551b4790ead0f21c1802ba42 -
Trigger Event:
release
-
Statement type:
File details
Details for the file polymerase_tm-0.4.1-py3-none-any.whl.
File metadata
- Download URL: polymerase_tm-0.4.1-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5676f5dfc5aa9946aed2cbd7057851efda7e23228d547ea9061f5fa2ddc15a7
|
|
| MD5 |
eaefa8d89d7479718c7f8d76f74f50c6
|
|
| BLAKE2b-256 |
8ebf7b2d4921e1a2a9e22968be0e0c93c55cdb65207fc67de33038ee99632adf
|
Provenance
The following attestation bundles were made for polymerase_tm-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on Dioskurides/polymerase-tm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymerase_tm-0.4.1-py3-none-any.whl -
Subject digest:
b5676f5dfc5aa9946aed2cbd7057851efda7e23228d547ea9061f5fa2ddc15a7 - Sigstore transparency entry: 1013017562
- Sigstore integration time:
-
Permalink:
Dioskurides/polymerase-tm@8110eb0469191ca2551b4790ead0f21c1802ba42 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Dioskurides
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8110eb0469191ca2551b4790ead0f21c1802ba42 -
Trigger Event:
release
-
Statement type: