hyraxAbif 0.2.4.4 → 0.2.4.5
raw patch · 4 files changed
+35/−32 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hyraxAbif.cabal +14/−14
- test/AbifTests.hs +9/−7
- test/Generators.hs +8/−8
- test/Tests.hs +4/−3
hyraxAbif.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hyraxAbif-version: 0.2.4.4+version: 0.2.4.5 synopsis: Modules for parsing, generating and manipulating AB1 files. homepage: https://github.com/hyraxbio/hyraxAbif/#readme license: BSD-3-Clause OR Apache-2.0@@ -17,7 +17,7 @@ <<data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABuCAMAAAC6LQUkAAAALVBMVEXA5+7/////53c9q1oVFhbCPzifzLVrv4RGguPX39ZFTluGhX6Ks/DSg1zdvnNa6pLqAAADlklEQVRo3u3XjZKjIAwAYD3+BIH3f9wjBCSJtnUd2725qeO6rtWvMSToTn9uXKYvdhXLSmXxSTLG8GPlQD2e8NN+eNVah0QwpZT7I68044LOb6SpJIShcUkMU+zCDGGltD+WTdu2qIuz5hz0iMwp5/h9JhFVizbVu0/j44wx0ZwplTMPDQJIeYcZAHG7JUwMQIXULrTtChpuX9vJATDI29oxB9nfDcF+ODOElVpwNDKKqbbsc5T3Q4xp61jLWdiwrFQdAXqfuVyUd1iqSqYJCFUbmMMbZPeZDuoMGQxw+5ZeZx1rIfHxTPv8b7XK62bt1ncKuoI9WuYLyxf7Yl/si/0+Bk9NiS1lkafDefIYPE/+ScwD5s9gInUenv1eYoFjFt4OLMemJR5g7ggLZ7B4BrO3Y/YCZu/FbFn5sVWvZX2BRcDiBczBSe6t2DS9FcPz+LGgrb2IeX+IhU9iy2nMe4ZBl4tOL1gpteU1pk9is8Rg/pFzUMX0bRj+/D+YP8A8Yn7D7AE2ITaJ6ayOqJhoa3kQzNVa41ipsfhhzCJmfxeziFkxA8HmORYPMds2O2zdMPcYixcw28J7GwbvEBxz92K+DSmbG9uQfgpbFnhSn8F8a4OGYVsKLAAWlquYEti6ao6pA0wjpi9gY0uns779GAbPw5swfOq8wnzHfMNaUfDm7NgkZiAxB7VxDE8xqFn4wleY7Zj9Tay1OOv01uL4a5vO9lidjmk/ncQsCbBhAbFwE1bnKYq5jjkxafTUPcKWQ8yTcXgL5ke50dKnLbD0SW8Rk4bAdMf0M6xPLYvsJt5P7f3nVmx+heE5HDPGmFswyFXDvJg0Wu7oKJIWwAaoLTARzJuUjHcUC2RUH2HhEMsml5VgdmD2GdbaJEzkHaiEVYIj70E/xSJpTcRIc/b/53CHGqQF4mgTipXsz8b8GBuVzbA0z+kK1oc8jtbMiOXRT/1ffUzeA2w5xIozz0V8gqlDbBulhWLQYhzzpOBY4Y+9cIApBfmHERj9pAemn2BbYgPB0h6je+cxr1bEklmVF62JMbJMbUMRaWKnjtX8Y9KsaAAcClb3rruR5iL2/BuDtWeMsqLMcJdhW5ALDX8ZGO4VzInKwCD5LNb3j7CeMkyazH/d58+kVnIx0PAxaR6rrCfNi5TVKDnWbjlqPZFvjNiZZmAtaSRl9Q/+htHkQGaxudWvM/0u4T6NEynDcTfnF70tD074C7p1S5o4ju7XAAAAAElFTkSuQmCC>> . Any AB1 file conforming to the standard at <http://www6.appliedbiosystems.com/support/software_community/ABIF_File_Format.pdf> should be supported.- . + . This library also support generating a minimal ABIF file from a FASTA input sequence. . A basic terminal application that can dump and generate AB1s is included. See <https://github.com/hyraxbio/hyraxAbif/blob/master/app/Main.hs>@@ -44,13 +44,13 @@ , Examples.ReadAb1 build-depends: base >= 4.9.1.0 && < 5 , verset >= 0.0.1.8 && < 0.0.2.0- , binary >= 0.8.9 && < 0.9- , bytestring >= 0.11.3 && < 0.12+ , binary >= 0.8.9 && < 0.10+ , bytestring >= 0.11.3 && < 0.13 , directory >= 1.3.6 && < 1.4- , filepath >= 1.4.2 && < 1.5- , hscolour >= 1.24.4 && < 1.25+ , filepath >= 1.4.2 && < 1.6+ , hscolour >= 1.24.4 && < 1.26 , pretty-show >= 1.10 && < 1.11- , text >= 1.2.5 && < 2.1+ , text >= 1.2.5 && < 2.2 default-language: Haskell2010 @@ -61,10 +61,10 @@ build-depends: base >= 4.9.1.0 && < 5 , hyraxAbif , verset >= 0.0.1.8 && < 0.0.2.0- , text >= 1.2.5 && < 2.1- , bytestring >= 0.11.3 && < 0.12+ , text >= 1.2.5 && < 2.2+ , bytestring >= 0.11.3 && < 0.13 , pretty-show >= 1.10 && < 1.11- , hscolour >= 1.24.4 && < 1.25+ , hscolour >= 1.24.4 && < 1.26 default-language: Haskell2010 test-suite hyraxAbif-test@@ -74,10 +74,10 @@ build-depends: base >= 4.9.1.0 && < 5 , hyraxAbif , verset >= 0.0.1.8 && < 0.0.2.0- , text >= 1.2.5 && < 2.1- , bytestring >= 0.11.3 && < 0.12- , binary >= 0.8.9 && < 0.9- , hedgehog+ , text >= 1.2.5 && < 2.2+ , bytestring >= 0.11.3 && < 0.13+ , binary >= 0.8.9 && < 0.10+ , hedgehog >= 1.2 && < 1.5 other-modules: AbifTests , FastaTests , Generators
test/AbifTests.hs view
@@ -32,10 +32,10 @@ nucs === n2 - + -- | Test that an ab1 (write, read, write, read) results in the original data prop_roundtrip :: Property-prop_roundtrip = property $ do +prop_roundtrip = property $ do fdata <- forAll $ genFastaData 2 let fasta = TxtE.encodeUtf8 $ toFastaTxt False fdata @@ -47,8 +47,8 @@ ab1Read2 <- evalEither $ H.getAbif ab1Written2 ab1Read1 === ab1Read2- - ++ -- | Generate an ab1 from a fasta and then confirm that the generated peaks of the -- chromatogram match the original fasta. -- Note that we are only testing the simple/single fasta case (i.e. no mixes)@@ -93,15 +93,17 @@ case reverse $ Lst.sortOn snd [('A', a), ('C', c), ('G', g), ('T', t)] of ((n,_) : _) -> n _ -> '?'- + readDataPeaks :: H.Abif -> Int -> [Int] -> Either Text [Int] readDataPeaks ab1 dirNum peaks = case readShorts <$> getDirEntry ab1 "DATA" dirNum of Left e -> Left e Right vs -> let valsAtPeaks = atMay vs <$> peaks in- maybeToRight "peaks" $ sequenceA valsAtPeaks- + case sequenceA valsAtPeaks of+ Nothing -> Left "Could not read peaks"+ Just vs' -> Right vs'+ getDirEntry :: H.Abif -> Text -> Int -> Either Text BSL.ByteString getDirEntry ab1 dirName dirNum =
test/Generators.hs view
@@ -13,21 +13,21 @@ -- | Generate random set of nucleotides, including ambiguous ones nucsGen :: GenT Identity Text-nucsGen = - Gen.text (Range.linear 1 1000) (Gen.element "ACGTMRWSYKVHDBNX")+nucsGen =+ Gen.text (Range.linear 1 1000) (Gen.element ("ACGTMRWSYKVHDBNX" :: [Char])) -- | Generate random set of nucleotides, no ambiguous ones nucsNoIupacGen :: (Monad m) => PropertyT m Text-nucsNoIupacGen = - forAll $ Gen.text (Range.linear 1 1000) (Gen.element "ACGT")+nucsNoIupacGen =+ forAll $ Gen.text (Range.linear 1 1000) (Gen.element ("ACGT" :: [Char])) - + -- | Generate data to construct a fasta "file" -- List of tuples of (name, lines of reads) -- maxReads controls the max number in the list genFastaData :: Int -> Gen [(Int, [Text])]-genFastaData maxReads = +genFastaData maxReads = Gen.list (Range.linear 1 maxReads) $ (,) <$> Gen.int (Range.linear 1 9999) <*> Gen.list (Range.linear 1 15) nucsGen @@ -36,7 +36,7 @@ toFastaTxt :: Bool -> [(Int, [Text])] -> Text toFastaTxt addSpaces is = Txt.intercalate "\n" $ toRead <$> is- + where toRead (weight, ls) = let sp = if addSpaces then " " else "" in@@ -47,7 +47,7 @@ toFasta :: [(Int, [Text])] -> [F.Fasta] toFasta is = toRead <$> is- + where toRead (weight, ls) = F.Fasta (show weight) $ Txt.concat ls
test/Tests.hs view
@@ -2,6 +2,7 @@ import Verset import qualified System.IO as IO+import System.Exit (exitFailure) import qualified AbifTests import qualified FastaTests@@ -11,9 +12,9 @@ IO.hSetBuffering IO.stdout IO.LineBuffering IO.hSetBuffering IO.stderr IO.LineBuffering - results <- sequence [ AbifTests.tests- , FastaTests.tests- ]+ results <- sequenceA [ AbifTests.tests+ , FastaTests.tests+ ] if and results then pass