module Data.Fasta.ByteString.Lazy.Utility ( getField
, compl
, revCompl
) where
import Data.Maybe
import Control.Lens
import qualified Data.ByteString.Lazy.Char8 as BL
import Data.Fasta.ByteString.Lazy.Types
import Data.Fasta.Utility
getField :: Int -> Char -> FastaSequence -> BL.ByteString
getField field delim = fromMaybe (error "getField: Field out of bounds in fasta header")
. preview (ix $ field 1)
. BL.split delim
. fastaHeader
compl :: FastaSequence -> FastaSequence
compl fs = fs { fastaSeq = BL.map complRules . fastaSeq $ fs }
revCompl :: FastaSequence -> FastaSequence
revCompl fs = fs { fastaSeq = BL.reverse . BL.map complRules . fastaSeq $ fs }