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