package fold

import "github.com/bebop/poly/transform"

var dnaComplement = transform.ComplementBase

var dnaMultibranch = multibranchEnergies{helicesCount: 2.6, unpairedCount: 0.2, coaxialStackCount: 0.2, terminalMismatchCount: 2.0}

// The Thermodynamics of DNA Structural Motifs
// SantaLucia and Hicks, 2004
var dnaNearestNeighbors = matchingBasepairEnergy{"AA/TT": energy{enthalpyH: -7.6, entropyS: -21.3},
	"AC/TG":    {enthalpyH: -8.4, entropyS: -22.4},
	"AG/TC":    {enthalpyH: -7.8, entropyS: -21},
	"AT/TA":    {enthalpyH: -7.2, entropyS: -20.4},
	"C/G_tini": {enthalpyH: 0, entropyS: 0},
	"CA/GT":    {enthalpyH: -8.5, entropyS: -22.7},
	"CC/GG":    {enthalpyH: -8, entropyS: -19.9},
	"CG/GC":    {enthalpyH: -10.6, entropyS: -27.2},
	"CT/GA":    {enthalpyH: -7.8, entropyS: -21},
	"GA/CT":    {enthalpyH: -8.2, entropyS: -22.2},
	"GC/CG":    {enthalpyH: -9.8, entropyS: -24.4},
	"GG/CC":    {enthalpyH: -8, entropyS: -19.9},
	"GT/CA":    {enthalpyH: -8.4, entropyS: -22.4},
	"T/A_tini": {enthalpyH: 2.2, entropyS: 6.9},
	"TA/AT":    {enthalpyH: -7.2, entropyS: -21.3},
	"TC/AG":    {enthalpyH: -8.2, entropyS: -22.2},
	"TG/AC":    {enthalpyH: -8.5, entropyS: -22.7},
	"TT/AA":    {enthalpyH: -7.6, entropyS: -21.3},
	"init":     {enthalpyH: 0.2, entropyS: -5.7},
	"init_A/T": {enthalpyH: 2.2, entropyS: 6.9},
	"init_G/C": {enthalpyH: 0, entropyS: 0},
	"mys":      {enthalpyH: 0, entropyS: -1.4},
	"sym":      {enthalpyH: 0, entropyS: -1.4},
	"tini":     {enthalpyH: 0.2, entropyS: -5.7}}

// DNAInternalMismatches is an Internal mismatch table (DNA)
// Allawi & SantaLucia (1997), Biochemistry 36: 10581-10594
// Allawi & SantaLucia (1998), Biochemistry 37: 9435-9444
// Allawi & SantaLucia (1998), Biochemistry 37: 2170-2179 *
// Allawi & SantaLucia (1998), Nucl Acids Res 26: 2694-2701 *
// Peyret et al. (1999), Biochemistry 38: 3468-3477 *
var dnaInternalMismatches = matchingBasepairEnergy{"AA/AT": energy{enthalpyH: 4.7, entropyS: 12.9},
	"AA/CT": {enthalpyH: 7.6, entropyS: 20.2},
	"AA/GT": {enthalpyH: 3, entropyS: 7.4},
	"AA/TA": {enthalpyH: 1.2, entropyS: 1.7},
	"AA/TC": {enthalpyH: 2.3, entropyS: 4.6},
	"AA/TG": {enthalpyH: -0.6, entropyS: -2.3},
	"AC/AG": {enthalpyH: -2.9, entropyS: -9.8},
	"AC/CG": {enthalpyH: -0.7, entropyS: -3.8},
	"AC/GG": {enthalpyH: 0.5, entropyS: 3.2},
	"AC/TA": {enthalpyH: 5.3, entropyS: 14.6},
	"AC/TC": {enthalpyH: 0, entropyS: -4.4},
	"AC/TT": {enthalpyH: 0.7, entropyS: 0.2},
	"AG/AC": {enthalpyH: -0.9, entropyS: -4.2},
	"AG/CC": {enthalpyH: 0.6, entropyS: -0.6},
	"AG/GC": {enthalpyH: -4, entropyS: -13.2},
	"AG/TA": {enthalpyH: -0.7, entropyS: -2.3},
	"AG/TG": {enthalpyH: -3.1, entropyS: -9.5},
	"AG/TT": {enthalpyH: 1, entropyS: 0.9},
	"AT/AA": {enthalpyH: 1.2, entropyS: 1.7},
	"AT/CA": {enthalpyH: 5.3, entropyS: 14.6},
	"AT/GA": {enthalpyH: -0.7, entropyS: -2.3},
	"AT/TC": {enthalpyH: -1.2, entropyS: -6.2},
	"AT/TG": {enthalpyH: -2.5, entropyS: -8.3},
	"AT/TT": {enthalpyH: -2.7, entropyS: -10.8},
	"CA/AT": {enthalpyH: 3.4, entropyS: 8},
	"CA/CT": {enthalpyH: 6.1, entropyS: 16.4},
	"CA/GA": {enthalpyH: -0.9, entropyS: -4.2},
	"CA/GC": {enthalpyH: 1.9, entropyS: 3.7},
	"CA/GG": {enthalpyH: -0.7, entropyS: -2.3},
	"CA/TT": {enthalpyH: 1, entropyS: 0.7},
	"CC/AG": {enthalpyH: 5.2, entropyS: 14.2},
	"CC/CG": {enthalpyH: 3.6, entropyS: 8.9},
	"CC/GA": {enthalpyH: 0.6, entropyS: -0.6},
	"CC/GC": {enthalpyH: -1.5, entropyS: -7.2},
	"CC/GT": {enthalpyH: -0.8, entropyS: -4.5},
	"CC/TG": {enthalpyH: 5.2, entropyS: 13.5},
	"CG/AC": {enthalpyH: 1.9, entropyS: 3.7},
	"CG/CC": {enthalpyH: -1.5, entropyS: -7.2},
	"CG/GA": {enthalpyH: -4, entropyS: -13.2},
	"CG/GG": {enthalpyH: -4.9, entropyS: -15.3},
	"CG/GT": {enthalpyH: -4.1, entropyS: -11.7},
	"CG/TC": {enthalpyH: -1.5, entropyS: -6.1},
	"CT/AA": {enthalpyH: 2.3, entropyS: 4.6},
	"CT/CA": {enthalpyH: 0, entropyS: -4.4},
	"CT/GC": {enthalpyH: -1.5, entropyS: -6.1},
	"CT/GG": {enthalpyH: -2.8, entropyS: -8},
	"CT/GT": {enthalpyH: -5, entropyS: -15.8},
	"CT/TA": {enthalpyH: -1.2, entropyS: -6.2},
	"GA/AT": {enthalpyH: 0.7, entropyS: 0.7},
	"GA/CA": {enthalpyH: -2.9, entropyS: -9.8},
	"GA/CC": {enthalpyH: 5.2, entropyS: 14.2},
	"GA/CG": {enthalpyH: -0.6, entropyS: -1},
	"GA/GT": {enthalpyH: 1.6, entropyS: 3.6},
	"GA/TT": {enthalpyH: -1.3, entropyS: -5.3},
	"GC/AG": {enthalpyH: -0.6, entropyS: -1},
	"GC/CA": {enthalpyH: -0.7, entropyS: -3.8},
	"GC/CC": {enthalpyH: 3.6, entropyS: 8.9},
	"GC/CT": {enthalpyH: 2.3, entropyS: 5.4},
	"GC/GG": {enthalpyH: -6, entropyS: -15.8},
	"GC/TG": {enthalpyH: -4.4, entropyS: -12.3},
	"GG/AC": {enthalpyH: -0.7, entropyS: -2.3},
	"GG/CA": {enthalpyH: 0.5, entropyS: 3.2},
	"GG/CG": {enthalpyH: -6, entropyS: -15.8},
	"GG/CT": {enthalpyH: 3.3, entropyS: 10.4},
	"GG/GC": {enthalpyH: -4.9, entropyS: -15.3},
	"GG/TC": {enthalpyH: -2.8, entropyS: -8},
	"GG/TT": {enthalpyH: 5.8, entropyS: 16.3},
	"GT/AA": {enthalpyH: -0.6, entropyS: -2.3},
	"GT/CC": {enthalpyH: 5.2, entropyS: 13.5},
	"GT/CG": {enthalpyH: -4.4, entropyS: -12.3},
	"GT/CT": {enthalpyH: -2.2, entropyS: -8.4},
	"GT/GA": {enthalpyH: -3.1, entropyS: -9.5},
	"GT/TA": {enthalpyH: -2.5, entropyS: -8.3},
	"GT/TG": {enthalpyH: 4.1, entropyS: 9.5},
	"TA/AA": {enthalpyH: 4.7, entropyS: 12.9},
	"TA/AC": {enthalpyH: 3.4, entropyS: 8},
	"TA/AG": {enthalpyH: 0.7, entropyS: 0.7},
	"TA/CT": {enthalpyH: 1.2, entropyS: 0.7},
	"TA/GT": {enthalpyH: -0.1, entropyS: -1.7},
	"TA/TT": {enthalpyH: 0.2, entropyS: -1.5},
	"TC/AA": {enthalpyH: 7.6, entropyS: 20.2},
	"TC/AC": {enthalpyH: 6.1, entropyS: 16.4},
	"TC/AT": {enthalpyH: 1.2, entropyS: 0.7},
	"TC/CG": {enthalpyH: 2.3, entropyS: 5.4},
	"TC/GG": {enthalpyH: 3.3, entropyS: 10.4},
	"TC/TG": {enthalpyH: -2.2, entropyS: -8.4},
	"TG/AA": {enthalpyH: 3, entropyS: 7.4},
	"TG/AG": {enthalpyH: 1.6, entropyS: 3.6},
	"TG/AT": {enthalpyH: -0.1, entropyS: -1.7},
	"TG/CC": {enthalpyH: -0.8, entropyS: -4.5},
	"TG/GC": {enthalpyH: -4.1, entropyS: -11.7},
	"TG/GT": {enthalpyH: -1.4, entropyS: -6.2},
	"TG/TC": {enthalpyH: -5, entropyS: -15.8},
	"TT/AC": {enthalpyH: 1, entropyS: 0.7},
	"TT/AG": {enthalpyH: -1.3, entropyS: -5.3},
	"TT/AT": {enthalpyH: 0.2, entropyS: -1.5},
	"TT/CA": {enthalpyH: 0.7, entropyS: 0.2},
	"TT/GA": {enthalpyH: 1, entropyS: 0.9},
	"TT/GG": {enthalpyH: 5.8, entropyS: 16.3},
	"TT/TA": {enthalpyH: -2.7, entropyS: -10.8},
}

// DNATerminalMismatches is a terminal mismatch table for DNA found at terminating ends of a structure
// SantaLucia & Peyret (2001) Patent Application WO 01/94611
var dnaTerminalMismatches = matchingBasepairEnergy{
	"AA/AT": energy{enthalpyH: -2.5, entropyS: -6.3},
	"AA/CT": {enthalpyH: -2.7, entropyS: -7},
	"AA/GT": {enthalpyH: -2.4, entropyS: -5.8},
	"AA/TA": {enthalpyH: -3.1, entropyS: -7.8},
	"AA/TC": {enthalpyH: -1.6, entropyS: -4},
	"AA/TG": {enthalpyH: -1.9, entropyS: -4.4},
	"AC/AG": {enthalpyH: -8, entropyS: -22.5},
	"AC/CG": {enthalpyH: -3.2, entropyS: -7.1},
	"AC/GG": {enthalpyH: -4.6, entropyS: -11.4},
	"AC/TA": {enthalpyH: -1.8, entropyS: -3.8},
	"AC/TC": {enthalpyH: -0.1, entropyS: 0.5},
	"AC/TT": {enthalpyH: -0.9, entropyS: -1.7},
	"AG/AC": {enthalpyH: -4.3, entropyS: -10.7},
	"AG/CC": {enthalpyH: -2.7, entropyS: -6},
	"AG/GC": {enthalpyH: -6, entropyS: -15.5},
	"AG/TA": {enthalpyH: -2.5, entropyS: -5.9},
	"AG/TG": {enthalpyH: -1.1, entropyS: -2.1},
	"AG/TT": {enthalpyH: -3.2, entropyS: -8.7},
	"AT/AA": {enthalpyH: -3.1, entropyS: -7.8},
	"AT/CA": {enthalpyH: -1.8, entropyS: -3.8},
	"AT/GA": {enthalpyH: -2.5, entropyS: -5.9},
	"AT/TC": {enthalpyH: -2.3, entropyS: -6.3},
	"AT/TG": {enthalpyH: -3.5, entropyS: -9.4},
	"AT/TT": {enthalpyH: -2.4, entropyS: -6.5},
	"CA/AT": {enthalpyH: -2.3, entropyS: -5.9},
	"CA/CT": {enthalpyH: -0.7, entropyS: -1.3},
	"CA/GA": {enthalpyH: -4.3, entropyS: -10.7},
	"CA/GC": {enthalpyH: -2.6, entropyS: -5.9},
	"CA/GG": {enthalpyH: -3.9, entropyS: -9.6},
	"CA/TT": {enthalpyH: -0.7, entropyS: -1.2},
	"CC/AG": {enthalpyH: -5, entropyS: -13.8},
	"CC/CG": {enthalpyH: -3.9, entropyS: -10.6},
	"CC/GA": {enthalpyH: -2.7, entropyS: -6},
	"CC/GC": {enthalpyH: -2.1, entropyS: -5.1},
	"CC/GT": {enthalpyH: -3.2, entropyS: -8},
	"CC/TG": {enthalpyH: -3, entropyS: -7.8},
	"CG/AC": {enthalpyH: -2.6, entropyS: -5.9},
	"CG/CC": {enthalpyH: -2.1, entropyS: -5.1},
	"CG/GA": {enthalpyH: -6, entropyS: -15.5},
	"CG/GG": {enthalpyH: -3.8, entropyS: -9.5},
	"CG/GT": {enthalpyH: -3.8, entropyS: -9},
	"CG/TC": {enthalpyH: -3.9, entropyS: -10.6},
	"CT/AA": {enthalpyH: -1.6, entropyS: -4},
	"CT/CA": {enthalpyH: -0.1, entropyS: 0.5},
	"CT/GC": {enthalpyH: -3.9, entropyS: -10.6},
	"CT/GG": {enthalpyH: -6.6, entropyS: -18.7},
	"CT/GT": {enthalpyH: -6.1, entropyS: -16.9},
	"CT/TA": {enthalpyH: -2.3, entropyS: -6.3},
	"GA/AT": {enthalpyH: -2, entropyS: -4.7},
	"GA/CA": {enthalpyH: -8, entropyS: -22.5},
	"GA/CC": {enthalpyH: -5, entropyS: -13.8},
	"GA/CG": {enthalpyH: -4.3, entropyS: -11.1},
	"GA/GT": {enthalpyH: -1.1, entropyS: -2.7},
	"GA/TT": {enthalpyH: -3.6, entropyS: -9.8},
	"GC/AG": {enthalpyH: -4.3, entropyS: -11.1},
	"GC/CA": {enthalpyH: -3.2, entropyS: -7.1},
	"GC/CC": {enthalpyH: -3.9, entropyS: -10.6},
	"GC/CT": {enthalpyH: -4.9, entropyS: -13.5},
	"GC/GG": {enthalpyH: -0.7, entropyS: -19.2},
	"GC/TG": {enthalpyH: -5.9, entropyS: -16.1},
	"GG/AC": {enthalpyH: -3.9, entropyS: -9.6},
	"GG/CA": {enthalpyH: -4.6, entropyS: -11.4},
	"GG/CG": {enthalpyH: -0.7, entropyS: -19.2},
	"GG/CT": {enthalpyH: -5.7, entropyS: -15.9},
	"GG/GC": {enthalpyH: -3.8, entropyS: -9.5},
	"GG/TC": {enthalpyH: -6.6, entropyS: -18.7},
	"GT/AA": {enthalpyH: -1.9, entropyS: -4.4},
	"GT/CC": {enthalpyH: -3, entropyS: -7.8},
	"GT/CG": {enthalpyH: -5.9, entropyS: -16.1},
	"GT/CT": {enthalpyH: -7.4, entropyS: -21.2},
	"GT/GA": {enthalpyH: -1.1, entropyS: -2.1},
	"GT/TA": {enthalpyH: -3.5, entropyS: -9.4},
	"TA/AA": {enthalpyH: -2.5, entropyS: -6.3},
	"TA/AC": {enthalpyH: -2.3, entropyS: -5.9},
	"TA/AG": {enthalpyH: -2, entropyS: -4.7},
	"TA/CT": {enthalpyH: -2.5, entropyS: -6.3},
	"TA/GT": {enthalpyH: -3.9, entropyS: -10.5},
	"TA/TT": {enthalpyH: -3.2, entropyS: -8.9},
	"TC/AA": {enthalpyH: -2.7, entropyS: -7},
	"TC/AC": {enthalpyH: -0.7, entropyS: -1.3},
	"TC/AT": {enthalpyH: -2.5, entropyS: -6.3},
	"TC/CG": {enthalpyH: -4.9, entropyS: -13.5},
	"TC/GG": {enthalpyH: -5.7, entropyS: -15.9},
	"TC/TG": {enthalpyH: -7.4, entropyS: -21.2},
	"TG/AA": {enthalpyH: -2.4, entropyS: -5.8},
	"TG/AG": {enthalpyH: -1.1, entropyS: -2.7},
	"TG/AT": {enthalpyH: -3.9, entropyS: -10.5},
	"TG/CC": {enthalpyH: -3.2, entropyS: -8},
	"TG/GC": {enthalpyH: -3.8, entropyS: -9},
	"TG/TC": {enthalpyH: -6.1, entropyS: -16.9},
	"TT/AC": {enthalpyH: -0.7, entropyS: -1.2},
	"TT/AG": {enthalpyH: -3.6, entropyS: -9.8},
	"TT/AT": {enthalpyH: -3.2, entropyS: -8.9},
	"TT/CA": {enthalpyH: -0.9, entropyS: -1.7},
	"TT/GA": {enthalpyH: -3.2, entropyS: -8.7},
	"TT/TA": {enthalpyH: -2.4, entropyS: -6.5},
}

// DNA dangling ends
//
// Bommarito et al. (2000), Nucl Acids Res 28: 1929-1934
var dnaDanglingEnds = matchingBasepairEnergy{
	"AA/.T": {enthalpyH: 0.2, entropyS: 2.3},
	"AA/T.": {enthalpyH: -0.5, entropyS: -1.1},
	".A/AT": {enthalpyH: -0.7, entropyS: -0.8},
	"AC/.G": {enthalpyH: -6.3, entropyS: -17.1},
	".A/CT": {enthalpyH: 4.4, entropyS: 14.9},
	"AC/T.": {enthalpyH: 4.7, entropyS: 14.2},
	"AG/.C": {enthalpyH: -3.7, entropyS: -10},
	".A/GT": {enthalpyH: -1.6, entropyS: -3.6},
	"AG/T.": {enthalpyH: -4.1, entropyS: -13.1},
	"A./TA": {enthalpyH: -2.9, entropyS: -7.6},
	"AT/.A": {enthalpyH: -2.9, entropyS: -7.6},
	"A./TC": {enthalpyH: -4.1, entropyS: -13},
	"A./TG": {enthalpyH: -4.2, entropyS: -15},
	"A./TT": {enthalpyH: -0.2, entropyS: -0.5},
	".A/TT": {enthalpyH: 2.9, entropyS: 10.4},
	"AT/T.": {enthalpyH: -3.8, entropyS: -12.6},
	".C/AG": {enthalpyH: -2.1, entropyS: -3.9},
	"CA/G.": {enthalpyH: -5.9, entropyS: -16.5},
	"CA/.T": {enthalpyH: 0.6, entropyS: 3.3},
	".C/CG": {enthalpyH: -0.2, entropyS: -0.1},
	"CC/G.": {enthalpyH: -2.6, entropyS: -7.4},
	"CC/.G": {enthalpyH: -4.4, entropyS: -12.6},
	"C./GA": {enthalpyH: -3.7, entropyS: -10},
	"C./GC": {enthalpyH: -4, entropyS: -11.9},
	"CG/.C": {enthalpyH: -4, entropyS: -11.9},
	"CG/G.": {enthalpyH: -3.2, entropyS: -10.4},
	"C./GG": {enthalpyH: -3.9, entropyS: -10.9},
	".C/GG": {enthalpyH: -3.9, entropyS: -11.2},
	"C./GT": {enthalpyH: -4.9, entropyS: -13.8},
	"CT/.A": {enthalpyH: -4.1, entropyS: -13},
	".C/TG": {enthalpyH: -4.4, entropyS: -13.1},
	"CT/G.": {enthalpyH: -5.2, entropyS: -15},
	"GA/C.": {enthalpyH: -2.1, entropyS: -3.9},
	".G/AC": {enthalpyH: -5.9, entropyS: -16.5},
	"GA/.T": {enthalpyH: -1.1, entropyS: -1.6},
	"G./CA": {enthalpyH: -6.3, entropyS: -17.1},
	"GC/C.": {enthalpyH: -0.2, entropyS: -0.1},
	".G/CC": {enthalpyH: -2.6, entropyS: -7.4},
	"G./CC": {enthalpyH: -4.4, entropyS: -12.6},
	"G./CG": {enthalpyH: -5.1, entropyS: -14},
	"GC/.G": {enthalpyH: -5.1, entropyS: -14},
	"G./CT": {enthalpyH: -4, entropyS: -10.9},
	".G/GC": {enthalpyH: -3.2, entropyS: -10.4},
	"GG/.C": {enthalpyH: -3.9, entropyS: -10.9},
	"GG/C.": {enthalpyH: -3.9, entropyS: -11.2},
	"GT/.A": {enthalpyH: -4.2, entropyS: -15},
	"GT/C.": {enthalpyH: -4.4, entropyS: -13.1},
	".G/TC": {enthalpyH: -5.2, entropyS: -15},
	"T./AA": {enthalpyH: 0.2, entropyS: 2.3},
	".T/AA": {enthalpyH: -0.5, entropyS: -1.1},
	"TA/A.": {enthalpyH: -0.7, entropyS: -0.8},
	"T./AC": {enthalpyH: 0.6, entropyS: 3.3},
	"T./AG": {enthalpyH: -1.1, entropyS: -1.6},
	"T./AT": {enthalpyH: -6.9, entropyS: -20},
	"TA/.T": {enthalpyH: -6.9, entropyS: -20},
	"TC/A.": {enthalpyH: 4.4, entropyS: 14.9},
	".T/CA": {enthalpyH: 4.7, entropyS: 14.2},
	"TC/.G": {enthalpyH: -4, entropyS: -10.9},
	"TG/A.": {enthalpyH: -1.6, entropyS: -3.6},
	".T/GA": {enthalpyH: -4.1, entropyS: -13.1},
	"TG/.C": {enthalpyH: -4.9, entropyS: -13.8},
	"TT/.A": {enthalpyH: -0.2, entropyS: -0.5},
	"TT/A.": {enthalpyH: 2.9, entropyS: 10.4},
	".T/TA": {enthalpyH: -3.8, entropyS: -12.6},
}

// Experimental delta EnthalpyH and delta EntropyS for tri/tetra loops
//
// Supplemental Material: Annu.Rev.Biophs.Biomol.Struct.33:415-40
// doi: 10.1146/annurev.biophys.32.110601.141800
// The Thermodynamics of DNA Structural Motifs
// SantaLucia and Hicks, 2004
//
// delta EntropyS was computed using delta G and delta EnthalpyH and is in cal / (K x mol)
// (versus delta EnthalpyH in kcal / mol)
var dnaTriTetraLoops = matchingBasepairEnergy{
	"AGAAT":  {-1.5, 0.0},
	"AGCAT":  {-1.5, 0.0},
	"AGGAT":  {-1.5, 0.0},
	"AGTAT":  {-1.5, 0.0},
	"CGAAG":  {-2.0, 0.0},
	"CGCAG":  {-2.0, 0.0},
	"CGGAG":  {-2.0, 0.0},
	"CGTAG":  {-2.0, 0.0},
	"GGAAC":  {-2.0, 0.0},
	"GGCAC":  {-2.0, 0.0},
	"GGGAC":  {-2.0, 0.0},
	"GGTAC":  {-2.0, 0.0},
	"TGAAA":  {-1.5, 0.0},
	"TGCAA":  {-1.5, 0.0},
	"TGGAA":  {-1.5, 0.0},
	"TGTAA":  {-1.5, 0.0},
	"AAAAAT": {0.5, 0.6},
	"AAAACT": {0.7, -1.6},
	"AAACAT": {1.0, -1.6},
	"ACTTGT": {0.0, -4.2},
	"AGAAAT": {-1.1, -1.6},
	"AGAGAT": {-1.1, -1.6},
	"AGATAT": {-1.5, -1.6},
	"AGCAAT": {-1.6, -1.6},
	"AGCGAT": {-1.1, -1.6},
	"AGCTTT": {0.2, -1.6},
	"AGGAAT": {-1.1, -1.6},
	"AGGGAT": {-1.1, -1.6},
	"AGGGGT": {0.5, -0.6},
	"AGTAAT": {-1.6, -1.6},
	"AGTGAT": {-1.1, -1.6},
	"AGTTCT": {0.8, -1.6},
	"ATTCGT": {-0.2, -1.6},
	"ATTTGT": {0.0, -1.6},
	"ATTTTT": {-0.5, -1.6},
	"CAAAAG": {0.5, 1.3},
	"CAAACG": {0.7, 0.0},
	"CAACAG": {1.0, 0.0},
	"CAACCG": {0.0, 0.0},
	"CCTTGG": {0.0, -2.6},
	"CGAAAG": {-1.1, 0.0},
	"CGAGAG": {-1.1, 0.0},
	"CGATAG": {-1.5, 0.0},
	"CGCAAG": {-1.6, 0.0},
	"CGCGAG": {-1.1, 0.0},
	"CGCTTG": {0.2, 0.0},
	"CGGAAG": {-1.1, 0.0},
	"CGGGAG": {-1.0, 0.0},
	"CGGGGG": {0.5, 1.0},
	"CGTAAG": {-1.6, 0.0},
	"CGTGAG": {-1.1, 0.0},
	"CGTTCG": {0.8, 0.0},
	"CTTCGG": {-0.2, 0.0},
	"CTTTGG": {0.0, 0.0},
	"CTTTTG": {-0.5, 0.0},
	"GAAAAC": {0.5, 3.2},
	"GAAACC": {0.7, 0.0},
	"GAACAC": {1.0, 0.0},
	"GCTTGC": {0.0, -2.6},
	"GGAAAC": {-1.1, 0.0},
	"GGAGAC": {-1.1, 0.0},
	"GGATAC": {-1.6, 0.0},
	"GGCAAC": {-1.6, 0.0},
	"GGCGAC": {-1.1, 0.0},
	"GGCTTC": {0.2, 0.0},
	"GGGAAC": {-1.1, 0.0},
	"GGGGAC": {-1.1, 0.0},
	"GGGGGC": {0.5, 1.0},
	"GGTAAC": {-1.6, 0.0},
	"GGTGAC": {-1.1, 0.0},
	"GGTTCC": {0.8, 0.0},
	"GTTCGC": {-0.2, 0.0},
	"GTTTGC": {0.0, 0.0},
	"GTTTTC": {-0.5, 0.0},
	"GAAAAT": {0.5, 3.2},
	"GAAACT": {1.0, 0.0},
	"GAACAT": {1.0, 0.0},
	"GCTTGT": {0.0, -1.6},
	"GGAAAT": {-1.1, 0.0},
	"GGAGAT": {-1.1, 0.0},
	"GGATAT": {-1.6, 0.0},
	"GGCAAT": {-1.6, 0.0},
	"GGCGAT": {-1.1, 0.0},
	"GGCTTT": {-0.1, 0.0},
	"GGGAAT": {-1.1, 0.0},
	"GGGGAT": {-1.1, 0.0},
	"GGGGGT": {0.5, 1.0},
	"GGTAAT": {-1.6, 0.0},
	"GGTGAT": {-1.1, 0.0},
	"GTATAT": {-0.5, 0.0},
	"GTTCGT": {-0.4, 0.0},
	"GTTTGT": {-0.4, 0.0},
	"GTTTTT": {-0.5, 0.0},
	"TAAAAA": {0.5, -0.3},
	"TAAACA": {0.7, -1.6},
	"TAACAA": {1.0, -1.6},
	"TCTTGA": {0.0, -4.2},
	"TGAAAA": {-1.1, -1.6},
	"TGAGAA": {-1.1, -1.6},
	"TGATAA": {-1.6, -1.6},
	"TGCAAA": {-1.6, -1.6},
	"TGCGAA": {-1.1, -1.6},
	"TGCTTA": {0.2, -1.6},
	"TGGAAA": {-1.1, -1.6},
	"TGGGAA": {-1.1, -1.6},
	"TGGGGA": {0.5, -0.6},
	"TGTAAA": {-1.6, -1.6},
	"TGTGAA": {-1.1, -1.6},
	"TGTTCA": {0.8, -1.6},
	"TTTCGA": {-0.2, -1.6},
	"TTTTGA": {0.0, -1.6},
	"TTTTTA": {-0.5, -1.6},
	"TAAAAG": {0.5, 1.6},
	"TAAACG": {1.0, -1.6},
	"TAACAG": {1.0, -1.6},
	"TCTTGG": {0.0, -3.2},
	"TGAAAG": {-1.0, -1.6},
	"TGAGAG": {-1.0, -1.6},
	"TGATAG": {-1.5, -1.6},
	"TGCAAG": {-1.5, -1.6},
	"TGCGAG": {-1.0, -1.6},
	"TGCTTG": {-0.1, -1.6},
	"TGGAAG": {-1.0, -1.6},
	"TGGGAG": {-1.0, -1.6},
	"TGGGGG": {0.5, -0.6},
	"TGTAAG": {-1.5, -1.6},
	"TGTGAG": {-1.0, -1.6},
	"TTTCGG": {-0.4, -1.6},
	"TTTTAG": {-1.0, -1.6},
	"TTTTGG": {-0.4, -1.6},
	"TTTTTG": {-0.5, -1.6},
}

// Enthalpy and entropy increments for length dependence of internal loops
//
// Were calculated from delta G Table 4 of SantaLucia, 2004:
//
// Annu.Rev.Biophs.Biomol.Struct.33:415-40
// doi: 10.1146/annurev.biophys.32.110601.141800
// The Thermodynamics of DNA Structural Motifs
// SantaLucia and Hicks, 2004
//
// Additional loop sizes are accounted for with the Jacobson-Stockmayer
// entry extrapolation formula in paper:
// delta G (loop-n) = delta G (loop-x) + 2.44 x R x 310.15 x ln(n / x)
//
// Additional correction is applied for asymmetric loops in paper:
// delta G (asymmetry) = |length A - length B| x 0.3 (kcal / mol)
// where A and B are lengths of both sides of loop
var dnaInternalLoops = loopEnergy{
	30: {0, -21.3},
	29: {0, -21.0},
	28: {0, -21.0},
	27: {0, -20.6},
	26: {0, -20.3},
	25: {0, -20.3},
	24: {0, -20.0},
	23: {0, -19.7},
	22: {0, -19.3},
	21: {0, -19.0},
	20: {0, -19.0},
	19: {0, -18.7},
	18: {0, -18.7},
	17: {0, -18.4},
	16: {0, -18.1},
	15: {0, -17.7},
	14: {0, -17.4},
	13: {0, -16.4},
	12: {0, -16.8},
	11: {0, -16.1},
	10: {0, -15.8},
	9:  {0, -15.8},
	8:  {0, -15.5},
	7:  {0, -14.8},
	6:  {0, -14.2},
	5:  {0, -12.9},
	4:  {0, -11.6},
	3:  {0, -10.3},
	2:  {0, 0},
	1:  {0, 0},
}

// Enthalpy and entropy increments for length depedence of bulge loops
//
// Were calculated from delta G Table 4 of SantaLucia, 2004:
//
// Annu.Rev.Biophs.Biomol.Struct.33:415-40
// doi: 10.1146/annurev.biophys.32.110601.141800
// The Thermodynamics of DNA Structural Motifs
// SantaLucia and Hicks, 2004
//
// For bulge loops of size 1, the intervening nearestNeighbors energy is used.
// Closing AT penalty is applied on both sides
var dnaBulgeLoops = loopEnergy{
	1:  {0, -12.9},
	2:  {0, -9.4},
	3:  {0, -10.0},
	4:  {0, -10.3},
	5:  {0, -10.6},
	6:  {0, -11.3},
	7:  {0, -11.9},
	8:  {0, -12.6},
	9:  {0, -13.2},
	10: {0, -13.9},
	11: {0, -14.2},
	12: {0, -14.5},
	13: {0, -14.8},
	14: {0, -15.5},
	15: {0, -15.8},
	16: {0, -16.1},
	17: {0, -16.4},
	18: {0, -16.8},
	19: {0, -16.8},
	20: {0, -17.1},
	21: {0, -17.4},
	22: {0, -17.4},
	23: {0, -17.7},
	24: {0, -17.7},
	25: {0, -18.1},
	26: {0, -18.1},
	27: {0, -18.4},
	28: {0, -18.7},
	29: {0, -18.7},
	30: {0, -19.0},
}

// Enthalpy and entropy increments for length depedence of hairpin loops
//
// Were calculated from delta G Table 4 of SantaLucia, 2004:
//
// Annu.Rev.Biophs.Biomol.Struct.33:415-40
// doi: 10.1146/annurev.biophys.32.110601.141800
// The Thermodynamics of DNA Structural Motifs
// SantaLucia and Hicks, 2004
//
// For hairpins of length 3 and 4, the entropy values are looked up
// in the DNATriTetraLoops Dict
//
// From formula 8-9 of the paper:
// An additional 1.6 delta entropy penalty if the hairpin is closed by AT
var dnaHairpinLoops = loopEnergy{
	1:  {0, 0.0},
	2:  {0, 0.0},
	3:  {0, -11.3},
	4:  {0, -11.3},
	5:  {0, -10.6},
	6:  {0, -12.9},
	7:  {0, -13.5},
	8:  {0, -13.9},
	9:  {0, -14.5},
	10: {0, -14.8},
	11: {0, -15.5},
	12: {0, -16.1},
	13: {0, -16.1},
	14: {0, -16.4},
	15: {0, -16.8},
	16: {0, -17.1},
	17: {0, -17.4},
	18: {0, -17.7},
	19: {0, -18.1},
	20: {0, -18.4},
	21: {0, -18.7},
	22: {0, -18.7},
	23: {0, -19.0},
	24: {0, -19.3},
	25: {0, -19.7},
	26: {0, -19.7},
	27: {0, -19.7},
	28: {0, -20.0},
	29: {0, -20.0},
	30: {0, -20.3},
}

var dnaEnergies = energies{
	bulgeLoops:         dnaBulgeLoops,
	complement:         dnaComplement,
	danglingEnds:       dnaDanglingEnds,
	hairpinLoops:       dnaHairpinLoops,
	multibranch:        dnaMultibranch,
	internalLoops:      dnaInternalLoops,
	internalMismatches: dnaInternalMismatches,
	nearestNeighbors:   dnaNearestNeighbors,
	terminalMismatches: dnaTerminalMismatches,
	triTetraLoops:      dnaTriTetraLoops,
}
