Skip to content
Snippets Groups Projects
Commit 486af6fa authored by Blaise Li's avatar Blaise Li
Browse files

Can now process files given as command-line args.

parent 73c70285
No related branches found
No related tags found
No related merge requests found
......@@ -42,4 +42,10 @@ fastq file provided in the `test` directory:
fastq-sort -s test/example.fq | remove-duplicates-from-sorted-fastq > test/dedup.fq
The resulting `test/dedup.fq` should be identical to `test/dedup_expected.fq`.
This can also be achieved in two steps:
fastq-sort -s test/example.fq > test/sorted.fq
remove-duplicates-from-sorted-fastq test/sorted.fq > test/dedup.fq
In both cases, the resulting `test/dedup.fq` should be identical to
`test/dedup_expected.fq`.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import System.Environment (getArgs)
-- For more efficient text manipulation
import qualified Data.ByteString.Lazy.Char8 as C
......@@ -66,5 +67,23 @@ text-formatted fastq records into a single text.
C.interact deals with the IO interaction, i.e. taking
text from the outside world and returning text to it.
-}
processStdin :: IO ()
processStdin = C.interact (C.concat . processLines . C.lines)
processPath :: String -> IO ()
processPath path = do
fileContent <- (C.readFile path)
C.putStr ((C.concat . processLines . C.lines) fileContent)
selectAction :: [String] -> IO ()
selectAction [] = processStdin
selectAction (path : []) = do
processPath path
selectAction (path : nextArgs) = do
processPath path
selectAction nextArgs
main :: IO ()
main = C.interact (C.concat . processLines . C.lines)
main = do
args <- getArgs
selectAction args
......@@ -16,7 +16,7 @@ name: remove-duplicates-from-sorted-fastq
-- PVP summary: +-+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
version: 0.1.0.0
version: 0.1.1.0
-- A short (one-line) description of the package.
-- synopsis:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment