-- | Import CT type structures module Biobase.DataSource.CT where import qualified Data.Array.IArray as A import Data.List.Split -- | A CT file. Encodes one or more individual RNAs within one complex. The -- 'nucs' array encodes (1,n) as '0' has a special meaning. It is used in -- 'prv', 'nxt' do denote no next or previous nucleotide in the chain. data CT = CT { comments :: [String] , lengthLine :: String , nucs :: A.Array Int Nuc } deriving (Show,Read) -- | A nucleotide. Encodes character, previous and next nucleotide on the chain -- and pairing partner. data Nuc = Nuc { nuc :: Char , prv :: Int , nxt :: Int , partner :: Int } deriving (Show,Read) -- | transforms a 'CT' object into our internal format. fromCT :: CT -> () fromCT ct = res where res = () chns = split (keepDelimsR $ whenElt ((==0) . nxt)) . A.elems $ nucs ct