{-# LANGUAGE NoMonomorphismRestriction #-}

-- | Turner energy data as used in the ViennaRNA package.

module Biobase.Vienna where

import Data.Map (Map,empty)

import Data.Ix.Tuple
import Data.PrimitiveArray.Ix
import Data.PrimitiveArray

import Biobase.RNA
import Biobase.Turner.Tables
import Biobase.Constants



-- Type for Vienna Tables

type ViennaEnergySet = (Temperature, ViennaTables, ViennaTables)
type ViennaTables = Turner2004 ViennaPair Nucleotide Int
type Temperature = Double



-- | An empty Turner2004 set, with Vienna-style keys for tables. Unused fields
-- are commented out. Activate them in BiobaseTurner before doing the same
-- here!

emptyTables :: ViennaTables
emptyTables = Turner2004
  --stack
  { stack = emptyIV
  --dangle
  , dangle3 = emptyIV
  , dangle5 = emptyIV
  --hairpin
  , hairpinL = emptyV
  , hairpinMM = emptyIV
  , hairpinLookup = empty
  --eInf
  --eInf
  --eInf
  --eInf
  --bulge
  , bulgeL = emptyV
  --eInf
  --internal
  , iloop1x1 = emptyIV
  , iloop1x2 = emptyIV
  , iloop2x2 = emptyIV
  , iloopMM = emptyIV
  , iloop2x3MM = emptyIV
  , iloop1xnMM = emptyIV
  , iloopL = emptyV
  --multibranch
  , multiMM = emptyIV
  , ninio = eInf
  , maxNinio = eInf
  , multiOffset = eInf
  , multiNuc = eInf
  , multiHelix = eInf
  --eInf
  --eInf
  --exterior
  , extMM = emptyIV
  --coaxial stacking
  --emptyIV
  --emptyIV
  --emptyIV
  --scalar values
  , largeLoop = fInf -- large loop is always double
  , termAU = eInf
  , intermolecularInit = eInf
  }

emptyIV = fromAssocs minBound maxBound eInf []

-- TODO should be an empty a
emptyV = fromAssocs 0 30 eInf []