Biobase-0.3.1.0: Biobase/DataSource/Vienna/Modification/Temperature.hs
-- | Given entropy and enthalpy sets, allow modification of the folding
-- temperature (from the default 37 Celsius)
module Biobase.DataSource.Vienna.Modification.Temperature
( adjustTemperature
) where
import Biobase.DataSource.Vienna
import Biobase.DataSource.Turner.Tables
import Biobase.Constants
-- temperature scaling is a generalized zip: let g and h be a scalar, t the
-- temperature. Then: g_t = h - (h-g)*((t+k_0)/t_m). Where k_0 = 273.15 (Kelvin
-- of 37 Celsius) and t_m = 37+k_0
--
-- TODO abstract over table type?
--
-- TODO this does not take into account that dangles are supposed to _always_
-- be beneficial. We should therefor transform the energies and then apply 'min
-- 0' onto all dangle types.
--
-- TODO use EnergyTables (Int is just for im-/export)
adjustTemperature :: ViennaIntTables -> ViennaIntTables -> Temperature -> ViennaIntTables
adjustTemperature trnrG trnrH cels = dZipWith f trnrG trnrH where
f vG vH =
let g = fromIntegral vG
h = fromIntegral vH
k_0 = kelvinC0
t_m = 37 + k_0
in round $ h - (h-g) * ((cels+k_0)/t_m)