{-| Flx is a simple tool to trim 454 "Titanium" reads down to "FLX" size, 
    i.e. from 800 flows to 400 flows.  This is sometimes useful to investigate
    the relatvie benefit of Titanium's longer read lengths, and will also
    serve as a (rather crude) way to improve average sequence quality.

    We're using 'trimFromTo', which clips a 'ReadBlock' down to specific
    base positions, and we use 'flowToBasePos' to find the base corresponding
    to flow number 400.
-}
  
module Main where

import Bio.Sequence.SFF
import System.Environment (getArgs)
import Data.ByteString as B (take)

-- usage: flx input.sff output.sff
main = do 
  [inp,out] <- getArgs
  SFF h rs <- readSFF inp
  writeSFF out (SFF (h { flow_length = 400, flow = B.take 400 (flow h)}) [trimFlows 400 r | r <- rs])