bio 0.4.6 → 0.4.7
raw patch · 4 files changed
+18/−126 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Bio.Util.TestBase: E :: (Sequence Nuc) -> EST
- Bio.Util.TestBase: EL :: (Sequence Nuc) -> EST_long
- Bio.Util.TestBase: ES :: (Sequence Nuc) -> EST_short
- Bio.Util.TestBase: ESet :: [Sequence Nuc] -> EST_set
- Bio.Util.TestBase: Eq :: (Sequence Nuc) -> ESTq
- Bio.Util.TestBase: N :: Char -> Nucleotide
- Bio.Util.TestBase: P :: (Sequence Amino) -> Protein
- Bio.Util.TestBase: Q :: Word8 -> Quality
- Bio.Util.TestBase: T :: String -> t -> Test
- Bio.Util.TestBase: data Test
- Bio.Util.TestBase: fromN :: Nucleotide -> Char
- Bio.Util.TestBase: fromQ :: Quality -> Word8
- Bio.Util.TestBase: genNonNegOffset :: Gen Offset
- Bio.Util.TestBase: genOffset :: Gen Offset
- Bio.Util.TestBase: genPositiveOffset :: Gen Offset
- Bio.Util.TestBase: instance Arbitrary EST
- Bio.Util.TestBase: instance Arbitrary EST_long
- Bio.Util.TestBase: instance Arbitrary EST_set
- Bio.Util.TestBase: instance Arbitrary EST_short
- Bio.Util.TestBase: instance Arbitrary ESTq
- Bio.Util.TestBase: instance Arbitrary Nucleotide
- Bio.Util.TestBase: instance Arbitrary Quality
- Bio.Util.TestBase: instance Arbitrary Word8
- Bio.Util.TestBase: instance Random Word8
- Bio.Util.TestBase: instance Show EST
- Bio.Util.TestBase: instance Show EST_long
- Bio.Util.TestBase: instance Show EST_set
- Bio.Util.TestBase: instance Show EST_short
- Bio.Util.TestBase: instance Show ESTq
- Bio.Util.TestBase: instance Show Nucleotide
- Bio.Util.TestBase: instance Show Protein
- Bio.Util.TestBase: instance Show Quality
- Bio.Util.TestBase: integralRandomR :: (Integral a, RandomGen g) => (a, a) -> g -> (a, g)
- Bio.Util.TestBase: newtype EST
- Bio.Util.TestBase: newtype EST_long
- Bio.Util.TestBase: newtype EST_set
- Bio.Util.TestBase: newtype EST_short
- Bio.Util.TestBase: newtype ESTq
- Bio.Util.TestBase: newtype Nucleotide
- Bio.Util.TestBase: newtype Protein
- Bio.Util.TestBase: newtype Quality
- Bio.Util.TestBase: showT :: (Integral a) => a -> String
- Bio.Util.TestBase: time :: String -> IO () -> IO ()
+ Bio.Sequence: readNuc :: FilePath -> IO [Sequence Nuc]
+ Bio.Sequence: readProt :: FilePath -> IO [Sequence Amino]
Files
- Bio/Alignment/AlignData.hs +2/−0
- Bio/Sequence.hs +14/−1
- Bio/Util/TestBase.hs +0/−123
- bio.cabal +2/−2
Bio/Alignment/AlignData.hs view
@@ -41,6 +41,8 @@ -- | Gaps are coded as '*'s, this function removes them, and returns -- the sequence along with the list of gap positions.+-- note that gaps are positioned relative to the *gapped* sequence +-- (contrast to stmassembler/Cluster.hs) extractGaps :: SeqData -> (SeqData,Gaps) extractGaps str = (BC.filter (/='*') str,BC.elemIndices '*' str)
Bio/Sequence.hs view
@@ -21,7 +21,10 @@ -- ** Other utility functions , defragSeq, seqmap - -- * File formats+ -- * File IO+ -- ** Generic sequence reading+ , readNuc, readProt+ -- ** The Fasta file format ("Bio.Sequence.Fasta") , readFasta, hReadFasta , writeFasta, hWriteFasta@@ -67,3 +70,13 @@ -- sequence-oriented stuff import Bio.Sequence.Entropy import Bio.Sequence.HashWord++-- | Read nucleotide sequences in any format - Fasta, SFF, FastQ, 2bit, PHD...+readNuc :: FilePath -> IO [Sequence Nuc]+readNuc = undefined+ -- check file contents+ -- magic number++-- | Read protein sequences in any supported format (i.e. Fasta)+readProt :: FilePath -> IO [Sequence Amino]+readProt xs = map castSeq `fmap` readFasta xs
− Bio/Util/TestBase.hs
@@ -1,123 +0,0 @@-{-# OPTIONS -fglasgow-exts #-}--module Bio.Util.TestBase where--import Control.Monad (liftM)-import System.CPUTime-import System.Time-import Test.QuickCheck-import System.Random--- import Data.Char (ord)-import Data.Word-import Data.ByteString.Lazy (pack)--import Bio.Sequence.SeqData--data Test = forall t . Testable t => T String t--newtype Nucleotide = N Char deriving Show-newtype Quality = Q Word8 deriving Show--fromN :: Nucleotide -> Char-fromN (N c) = c--fromQ :: Quality -> Word8-fromQ (Q c) = c---- | For testing, variable lengths-newtype EST = E (Sequence Nuc) deriving Show-newtype ESTq = Eq (Sequence Nuc) deriving Show-newtype Protein = P (Sequence Amino) deriving Show---- | For benchmarking, fixed lengths-newtype EST_short = ES (Sequence Nuc) deriving Show-newtype EST_long = EL (Sequence Nuc) deriving Show-newtype EST_set = ESet [Sequence Nuc] deriving Show---- | Take time (CPU and wall clock) and report it-time :: String -> IO () -> IO ()-time msg action = do- d1 <- getClockTime- t1 <- getCPUTime- action- t2 <- getCPUTime- d2 <- getClockTime- putStrLn $ "\n"++msg++", CPU time: " ++ showT (t2-t1) ++ ", wall clock: "- ++ timeDiffToString (diffClockTimes d2 d1)---- | Print a CPUTime difference-showT :: Integral a => a -> String-showT t = show (fromIntegral t/1e12::Double)++"s"---- | Shamelessly stolen from FPS-integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)-integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,- fromIntegral b :: Integer) g of- (x,g') -> (fromIntegral x, g')---- | Constrained position generators--genOffset :: Gen Offset-genOffset = do isneg <- arbitrary- nnoff <- genNonNegOffset- return $ (if isneg then negate else id) nnoff--genNonNegOffset :: Gen Offset-genNonNegOffset = liftM (subtract 1) genPositiveOffset--genPositiveOffset :: Gen Offset-genPositiveOffset = do scale <- chooseInteger (1, 13)- liftM fromIntegral $ chooseInteger (1, 2^scale)- where chooseInteger :: (Integer, Integer) -> Gen Integer- chooseInteger = choose---instance Random Word8 where- randomR = integralRandomR- random = randomR (minBound,maxBound)--instance Arbitrary Word8 where- arbitrary = choose (0,255)--instance Arbitrary Nucleotide where- arbitrary = elements (map N "aaacccgggtttn")--instance Arbitrary Quality where- arbitrary = do c <- choose (0,60)- return (Q c)--instance Arbitrary ESTq where- arbitrary = do n <- choose (1,100)- s <- vector n- q <- vector n- return $ Eq $ Seq (fromStr "qctest")- (fromStr $ map fromN s) (Just $ pack $ map fromQ q)--instance Arbitrary EST where- arbitrary = do n <- choose (1,100)- s <- vector n- return $ E $ Seq (fromStr "qctest")- (fromStr $ map fromN s) Nothing---- instance Arbitrary Char where--- arbitrary = elements (['A'..'Z']++['a'..'z']++" \t\n\r")--instance Arbitrary EST_short where- arbitrary = do let n = 200- s <- vector n- q <- vector n- return $ ES $ Seq (fromStr "qctest")- (fromStr $ map fromN s) (Just $ pack $ map fromQ q)--instance Arbitrary EST_long where- arbitrary = do let n = 1000- s <- vector n- q <- vector n- return $ EL $ Seq (fromStr "qctest")- (fromStr $ map fromN s) (Just $ pack $ map fromQ q)---- 1000 ESTs of length 1000-instance Arbitrary EST_set where- arbitrary = do let n = 1000- s <- vector n- return (ESet $ map (\(EL x) -> x) s)
bio.cabal view
@@ -1,5 +1,5 @@ Name: bio-Version: 0.4.6+Version: 0.4.7 License: LGPL License-file: LICENSE Author: Ketil Malde@@ -50,7 +50,7 @@ Bio.Alignment.Soap, Bio.Alignment.BED, Bio.Alignment.PSL Bio.Clustering,- Bio.Util, Bio.Util.Parsex, Bio.Util.TestBase+ Bio.Util, Bio.Util.Parsex Bio.Location.Strand, Bio.Location.Position, Bio.Location.ContigLocation, Bio.Location.Location, Bio.Location.LocMap, Bio.Location.OnSeq, Bio.Location.SeqLocation, Bio.Location.SeqLocMap,