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