{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
module Bio.Structure
( SecondaryStructure (..)
, Atom (..), Bond (..)
, Residue (..), Chain (..), Model (..)
, StructureModels (..), StructureSerializable (..)
) where
import Data.Array ( Array )
import Data.Text ( Text )
import GHC.Generics ( Generic )
import Control.DeepSeq ( NFData (..) )
import Linear.V3 ( V3 )
data SecondaryStructure = PiHelix
| Bend
| AlphaHelix
| Extended
| ThreeTenHelix
| Bridge
| Turn
| Coil
| Undefined
deriving (Show, Eq, Generic)
instance NFData SecondaryStructure
data Atom = Atom { atomName :: Text
, atomElement :: Text
, atomCoords :: V3 Float
, formalCharge :: Int
, bFactor :: Float
, occupancy :: Float
}
deriving (Show, Eq, Generic)
instance NFData Atom
data Bond = Bond { bondStart :: Int
, bondEnd :: Int
, bondOrder :: Int
}
deriving (Show, Eq, Generic)
instance NFData Bond
data Residue = Residue { resName :: Text
, resAtoms :: Array Int Atom
, resBonds :: Array Int Bond
, resSecondary :: SecondaryStructure
, resChemCompType :: Text
}
deriving (Show, Eq, Generic, NFData)
data Chain = Chain { chainName :: Text
, chainResidues :: Array Int Residue
}
deriving (Show, Eq, Generic, NFData)
newtype Model = Model { modelChains :: Array Int Chain }
deriving (Show, Eq, Generic, NFData)
class StructureModels a where
modelsOf :: a -> Array Int Model
class StructureSerializable a where
serializeModels :: Array Int Model -> a