bio 0.3.3.1 → 0.3.3.2
raw patch · 6 files changed
+19/−10 lines, 6 filesdep −interlude
Dependencies removed: interlude
Files
- Bio/Alignment/ACE.hs +1/−2
- Bio/Alignment/BlastXML.hs +7/−3
- Bio/Sequence.hs +3/−0
- Bio/Sequence/Entropy.hs +1/−1
- Bio/Sequence/Fasta.hs +4/−1
- bio.cabal +3/−3
Bio/Alignment/ACE.hs view
@@ -28,8 +28,7 @@ module Bio.Alignment.ACE (readACE, writeACE, Assembly(..), ptest, reads ) where -#include <interlude.h>-import Interlude hiding (lines,words,readFile,unwords -- ByteString clashes+import Prelude hiding (lines,words,readFile,unwords -- ByteString clashes ,reads,pred -- Assembly clash )
Bio/Alignment/BlastXML.hs view
@@ -1,6 +1,6 @@ -- Parse blast XML output using tagsoup -module Bio.Alignment.BlastXML where+module Bio.Alignment.BlastXML (readXML) where import Bio.Alignment.BlastData @@ -23,6 +23,7 @@ in rest `par` first : if null rest then [] else breaks p rest breaks _ [] = [] +getFrom :: [Tag] -> String -> String getFrom list tag = let xs = sections (isTagOpenName tag) list in if null xs || null (head xs) || (null . drop 1 . head) xs then error ("Couldn't find tag '"++show tag++"' in\n"++showSome list)@@ -31,6 +32,7 @@ x -> error ("Unexpeced tag: "++ show x) -- Use pattern match since 'length' is strict, defeating the purpose.+showSome :: [Tag] -> String showSome a@(_:_:_:_:_:_:_) = (init . show . take 5 $ a)++" ... ]" showSome a = show a @@ -64,6 +66,7 @@ } where get = getFrom hs + hsp2match :: [Tag] -> BlastMatch hsp2match ms = BlastMatch { bits = read $ get "Hsp_bit-score"@@ -78,13 +81,14 @@ [] -> mkFrame $ get "Hsp_query-frame" [(_o:TagText hf:_c)] -> case sections (isTagOpenName "Hsp_query-frame") ms of [] -> mkFrame hf- [(_o:TagText qf:_c)] -> mkStrands hf qf+ [(__o:TagText qf:__c)] -> mkStrands hf qf+ e -> error ("hsp2match: should be tagopen/text/close:\n"++show e) e -> error ("hsp2match: failed to determine frame:\n"++show e) } where get = getFrom ms mkFrame f = Frame (strand' $ signum $ read f) (abs $ read f) mkStrands h q = Strands (strand' $ read h) (strand' $ read q) strand' s = case s of 1 -> Plus; -1 -> Minus- _ -> error ("Strand must be +1 or -1, but was"++show s)+ _ -> error ("Strand must be +1 or -1, but was: "++show s)
Bio/Sequence.hs view
@@ -42,6 +42,9 @@ -- | Packing words from sequences into integral data types , HashF (..) , contigous, rcontig, rcpacked++ -- * Entropy calculations+ , KWords(..), entropy ) where -- basic sequence data structures
Bio/Sequence/Entropy.hs view
@@ -1,4 +1,4 @@-module Bio.Sequence.Entropy where+module Bio.Sequence.Entropy (KWords(..), entropy) where import Data.List
Bio/Sequence/Fasta.hs view
@@ -97,6 +97,7 @@ | B.length y /= B.length z = error ("mismatching sequence and quality lengths:" ++ show (seqlabel s1,B.length y,B.length z)) | otherwise = Seq x y (Just z)+ mkseq _ _ = error "readFastaQual: could not combine Fasta and Qual information" return $ zipWith mkseq ss qs -- | Write sequence and quality data simulatnously@@ -144,7 +145,7 @@ wHead h l let qls = splitsAt 20 q qs = B.pack . unwords . map show . BB.unpack- mapM_ ((\l -> B.hPut h l >> B.hPut h (B.pack "\n")) . qs) qls+ mapM_ ((\l' -> B.hPut h l' >> B.hPut h (B.pack "\n")) . qs) qls wQual _ (Seq _ _ Nothing) = return () -- ByteString operations@@ -179,6 +180,7 @@ mkSeqs :: [ByteString] -> [Sequence] mkSeqs = map mkSeq . blocks +mkSeq :: [ByteString] -> Sequence mkSeq (l:ls) = Seq (B.drop 1 l) (B.concat $ takeWhile isSeq ls) Nothing where isSeq s = (not . B.null) s && ((flip elem) (['A'..'Z']++['a'..'z']) . B.head) s mkSeq [] = error "empty input to mkSeq"@@ -187,6 +189,7 @@ mkQual = map f . blocks where f (l:ls) = Seq (B.drop 1 l) B.empty (Just $ BB.pack (map int (B.words $ B.unlines ls)))+ f [] = error "mkQual: empty quality data" int = fromIntegral . fst . fromJust' . B.readInt fromJust' = maybe (error "Error in qual format") id
bio.cabal view
@@ -1,5 +1,5 @@ Name: bio-Version: 0.3.3.1+Version: 0.3.3.2 License: LGPL License-file: LICENSE Author: Ketil Malde@@ -19,13 +19,13 @@ output parsing. Partly implemented single linkage clustering, and multiple alignment. .- The Darcs repository is at: <http://malde.org/~ketil/bio>.+ The Darcs repository is at: <http://malde.org/~ketil/biohaskell/biolib>. Homepage: http://malde.org/~ketil/ Tested-With: GHC==6.8.2 Build-Type: Simple Build-Depends: base>3, QuickCheck<2, binary, tagsoup>=0.4, bytestring,- containers, array, interlude, parallel, parsec+ containers, array, parallel, parsec -- add fps for ghc 6.4.2; change imports in Bio/Sequence/TwoBit.hs if you want QC 2 -- We omit the debian/ and Test/ files because those are for development, not installation.