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