-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBlastHTTPTest.hs
30 lines (27 loc) · 943 Bytes
/
BlastHTTPTest.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- | BlastHTTP test script
--runghc -package-db --ghc-arg=.cabal-sandbox/x86_64-linux-ghc-8.0.1-packages.conf.d/ BlastTabularHTTPTest.hs aeromonas.fa
module Main where
import System.Environment (getArgs)
import System.Process
import Text.ParserCombinators.Parsec
import System.IO
import System.Environment
import Data.List
import System.Directory
import System.Process
import Control.Monad
import Data.Either.Unwrap
import Bio.BlastHTTP
import Biobase.Fasta.Streaming
import Biobase.Fasta.Types
import qualified Data.ByteString.Lazy.Char8 as L8
main = do
args <- getArgs
let input_file = (head args)
putStrLn "Test:"
inputFasta <- parseFastaFile input_file
let blastQuery = BlastHTTPQuery (Just "ncbi") (Just "blastn") (Just "nt") inputFasta Nothing (Just (7200000000 ::Int))
blastOutput <- blastHTTP blastQuery
if isRight blastOutput
then print (fromRight blastOutput)
else print (fromLeft blastOutput)