Melting Temperature Calculation
SeqFold.jl provides functions for calculating DNA melting temperatures using nearest-neighbor thermodynamics.
Showcase
julia> seq = "GGGAGGTCAGCAAACCTGAACCTGTTGAGATGTTGACGTCAGGAAACCCT";
julia> tm(seq) # melting at PCR conditions, same as tm(seq, conditions=:pcr)
80.4
julia> MeltingConditions(:pcr) # here they are as a preset inherited from seqfold library
MeltingConditions (PCR preset)
• NEB PCR buffer conditions for Taq DNA Polymerase
• seq1 concentration: 250.0 nM (typical primer concentration)
• seq2 concentration: 0.0 nM (asymmetric PCR)
• Mg²⁺: 1.5 mM (optimal for Taq DNA Polymerase per NEB guidelines)
• K⁺: 50.0 mM
• Tris: 2.0 mM
• dNTPs: 0.2 mM
julia> tm(seq, Mg=5) # altering default conditions
81.4
julia> MeltingConditions(:std) # second preset, inherited from seqfold library
MeltingConditions (standard preset)
• Standard hybridization buffer
• seq1 concentration: 25.0 nM
• seq2 concentration: 25.0 nM
• Na⁺: 50.0 mM
julia> tm(seq, conditions=:std, Na=150) # altering chosen preset
79.8
julia> custom_conds = MeltingConditions( # Specifying custom conditions
seq1_conc=30,seq2_conc=20,Na=5,K=5,Tris=15,Mg=0,dNTPs=0)
MeltingConditions (custom)
• seq1 concentration: 30.0 nM
• seq2 concentration: 20.0 nM
• Na⁺: 5.0 mM
• K⁺: 5.0 mM
• Tris: 15.0 mM
julia> tm(seq, conditions=custom_conds, Tris=50) # flexible adjustments
68.4Exported names
SeqFold.tm — Functiontm(seq1, seq2; conditions=:pcr, kwargs...) -> Float64
tm(seq; conditions=:pcr, kwargs...) -> Float64Calculate melting temperature (Tm °C) for DNA duplex formation using nearest-neighbor thermodynamics.
Arguments
seq1::AbstractString: DNA sequence;seq2::AbstractString: Another DNA sequence, must be the same length asseq1;seq::AbstractString: Single DNA sequence to be matched with its exact complement;conditions: Buffer conditions specification (see below);kwargs...: Additional parameters to override preset conditions in place.
Conditions Specification
The conditions parameter can be:
:pcr(default) or:std: Use preset conditions;MeltingConditionsobject: Custom conditions (for more info see:MeltingConditions);NTuple{7, Float64}:(seq1_conc, seq2_conc, Na, K, Tris, Mg, dNTPs);NamedTuplewith condition fields.
Examples
julia> tm("GGGGGG")
15.5
julia> tm("GGGGGG", conditions=:pcr)
15.5
julia> tm("GGGGGG", Mg=10)
23.0
julia> tm("GGGGGG", conditions=:std)
2.6
julia> tm("GGGGGG", conditions=:std, Na=100)
5.1
julia> tm("GGGGGG", conditions=MeltingConditions(150, 150, 20, 0, 0, 10, 0))
16.8
julia> tm("ACCCCC", "GGGGGG")
6.2Implementation
The calculation uses nearest-neighbor thermodynamic parameters from related literature (follow links below to see sources), accounting for initialization terms, nearest-neighbor pairs, and terminal mismatches when present.
See also
SeqFold.MeltingConditions — TypeMeltingConditions(seq1_conc, seq2_conc, Na, K, Tris, Mg, dNTPs)Represents buffer conditions for melting temperature calculation.
Fields and Units
seq1_conc,seq2_conc: Sequence concentrations in nM (nanomolar)Na,K,Tris,Mg,dNTPs: Buffer component concentrations in mM (millimolar)
Examples
julia> MeltingConditions(:pcr)
MeltingConditions (PCR preset)
• NEB PCR buffer conditions for Taq DNA Polymerase
• seq1 concentration: 250.0 nM (typical primer concentration)
• seq2 concentration: 0.0 nM (asymmetric PCR)
• Mg²⁺: 1.5 mM (optimal for Taq DNA Polymerase per NEB guidelines)
• K⁺: 50.0 mM
• Tris: 2.0 mM
• dNTPs: 0.2 mM
julia> MeltingConditions(:std)
MeltingConditions (standard preset)
• Standard hybridization buffer
• seq1 concentration: 25.0 nM
• seq2 concentration: 25.0 nM
• Na⁺: 50.0 mM
julia> MeltingConditions(seq1_conc=10,seq2_conc=0,Na=0,K=0,Tris=10,Mg=0,dNTPs=0)
MeltingConditions (custom)
• seq1 concentration: 10.0 nM
• seq2 concentration: 0.0 nM
• Tris: 10.0 mM
julia> MeltingConditions(10,0,0,0,0,5,0)
MeltingConditions (custom)
• seq1 concentration: 10.0 nM
• seq2 concentration: 0.0 nM
• Mg²⁺: 5.0 mM (higher than NEB's recommended 1.5-2.0 mM range)
julia> MeltingConditions(seq1_conc=0,seq2_conc=0,Na=5,K=0,Tris=0,Mg=0,dNTPs=0)
ERROR: ArgumentError: DNA concentration is too low!
[...]
julia> MeltingConditions(seq1_conc=10,seq2_conc=10,Na=0,K=0,Tris=0,Mg=0,dNTPs=0)
ERROR: ArgumentError: No cations for salt correction (Mg=0, Na=0, K=0, Tris=0)
[...]See also
Public names
SeqFold.tm_cache — FunctionSeqFold.tm_cache(seq1, seq2; conditions=:pcr, kwargs...) -> Matrix{Float64}
SeqFold.tm_cache(seq; conditions=:pcr, kwargs...) -> Matrix{Float64}Compute a matrix of melting temperatures for all possible subsequences of a DNA sequence pair.
Arguments
seq1::AbstractString: DNA sequence;seq2::AbstractString: Another DNA sequence, must be the same length asseq1;seq::AbstractString: Single DNA sequence to be matched with its exact complement;conditions: Buffer conditions specification (seetmdocstrings);kwargs...: Additional parameters to override preset conditions in place.
Returns
A Matrix{Float64} where element [i, j] contains the melting temperature (in °C) of the subsequence from position i to position j, inclusive. Elements where j < i contain NaN as they represent invalid ranges, and single-nucleotide subsequences also have NaN as they don't have meaningful Tm values.
Examples
julia> SeqFold.tm_cache("ATCC")
4×4 Matrix{Float64}:
NaN -212.6 -95.3 -48.6
NaN NaN -161.6 -82.7
NaN NaN NaN -135.5
NaN NaN NaN NaN
julia> SeqFold.tm_cache("AAGC", "TTCG")
4×4 Matrix{Float64}:
NaN -204.8 -94.6 -40.3
NaN NaN -166.7 -72.9
NaN NaN NaN -116.7
NaN NaN NaN NaN
julia> SeqFold.tm_cache("AAGC", "TTCG"; conditions=:std)
4×4 Matrix{Float64}:
NaN -213.1 -109.3 -55.6
NaN NaN -177.9 -88.1
NaN NaN NaN -129.8
NaN NaN NaN NaNImplementation
The function uses dynamic programming to build a cache of Tm values for all subsequences. The algorithm has O(n²) time and space complexity, where n is the sequence length. This approach avoids redundant calculations when multiple Tm values for different subsequences are needed.
See also