module Bio.Location.Strand ( Strand(..)
, Stranded(..), stranded
)
where
import qualified Data.ByteString.Lazy.Char8 as LBS
import Data.Ix (Ix)
import Bio.Sequence.SeqData
data Strand = Fwd | RevCompl deriving (Eq, Ord, Show, Read, Bounded, Enum, Ix)
class Stranded s where
revCompl :: s -> s
stranded :: (Stranded s) => Strand -> s -> s
stranded Fwd = id
stranded RevCompl = revCompl
instance Stranded Strand where
revCompl Fwd = RevCompl
revCompl RevCompl = Fwd
instance Stranded Char where
revCompl = compl
instance Stranded LBS.ByteString where
revCompl = LBS.reverse . LBS.map compl