hPDB-examples 1.1.2 → 1.2.0.1
raw patch · 2 files changed
+48/−2 lines, 2 filesdep +IfElsedep +processdep +timedep ~basedep ~hPDBdep ~iterable
Dependencies added: IfElse, process, time
Dependency ranges changed: base, hPDB, iterable, text
Files
- hPDB-examples.cabal +9/−2
- tests/TestParser.hs +39/−0
hPDB-examples.cabal view
@@ -1,5 +1,5 @@ name: hPDB-examples-version: 1.1.2+version: 1.2.0.1 synopsis: Examples for hPDB library stability: stable homepage: https://github.com/BioHaskell/hPDB-examples@@ -27,7 +27,7 @@ Executable PDB2Fasta main-is: examples/PDB2Fasta.hs ghc-options: -fspec-constr-count=4 -O3 -threaded -rtsopts -with-rtsopts=-N- build-depends: base>=4.0, base <4.9, bytestring, ghc-prim, directory, mtl, template-haskell, vector, AC-Vector, containers, deepseq, QuickCheck >= 2.5.0.0, text>=0.11.1.13, hPDB >= 1.1, iterable >=2.0+ build-depends: base>=4.0, base <4.9, bytestring, ghc-prim, directory, mtl, template-haskell, vector, AC-Vector, containers, deepseq, QuickCheck >= 2.5.0.0, text>=0.11.1.13, hPDB >= 1.2, iterable >=3.0 other-extensions: ScopedTypeVariables OverloadedStrings BangPatterns NoMonomorphismRestriction EmptyDataDecls MagicHash Executable ShiftToCenter@@ -83,5 +83,12 @@ main-is: examples/Viewer.hs ghc-options: -fspec-constr-count=4 -O3 -threaded -rtsopts -with-rtsopts=-N Build-depends: base>=4.0, base <4.9, ghc-prim, directory, mtl, template-haskell, vector, AC-Vector, containers, deepseq,QuickCheck >= 2.5.0.0, text>=0.11.1.13, OpenGL, GLUT, hPDB >= 0.999, bytestring, iterable >=1.0+ other-extensions: ScopedTypeVariables OverloadedStrings BangPatterns NoMonomorphismRestriction EmptyDataDecls MagicHash++test-suite ParserPerformance+ main-is: tests/TestParser.hs+ type: exitcode-stdio-1.0+ ghc-options: -fspec-constr-count=4 -O3 -threaded -rtsopts "-with-rtsopts=-N -t"+ Build-depends: base>=4.0, base <4.9, ghc-prim, directory, mtl, template-haskell, vector, AC-Vector, containers, deepseq, text>=0.11.1.13, hPDB >= 0.999, bytestring, iterable >=1.0, IfElse >= 0.80, process >= 1.0, time >= 1.2 other-extensions: ScopedTypeVariables OverloadedStrings BangPatterns NoMonomorphismRestriction EmptyDataDecls MagicHash
+ tests/TestParser.hs view
@@ -0,0 +1,39 @@+{-# LANGUAGE OverloadedStrings, FlexibleContexts, NoMonomorphismRestriction #-}+module Main(main) where++import Control.Concurrent(getNumCapabilities)+import Data.Time(diffUTCTime, getCurrentTime)+import System.Process+import Control.Exception(throw)+import System.Environment(getProgName, getArgs)+import System.Exit(exitWith, exitSuccess, ExitCode(ExitSuccess), ExitCode(..))+import System.Directory(doesFileExist)+import qualified Bio.PDB as PDB(parse, numResidues)+import Data.Iterable+import Control.Monad.IfElse(whenM)+import Control.Monad(unless)++cmd cmdLine = do exitCode <- system cmdLine+ unless (exitCode == ExitSuccess) $ throw exitCode++inputPath="tests/1htq.ent"+gzPath=inputPath ++ ".gz"++assureInputPath = whenM (not `fmap` doesFileExist inputPath) $ do+ cmd $ "wget --quiet http://rcsb.org/pdb/files/1htq.pdb.gz -O " ++ inputPath ++ ".gz"+ cmd $ "gzip --decompress " ++ gzPath++timeIt io = do+ cpus <- getNumCapabilities+ putStrLn $ "Running with " ++ show cpus ++ " threads."+ t1 <- getCurrentTime+ r <- io+ t2 <- getCurrentTime+ print $ t2 `diffUTCTime` t1+ return r++main = do+ assureInputPath+ timeIt $ do+ Just structure <- PDB.parse inputPath+ print $ PDB.numResidues structure