biophd 0.0.7 → 0.0.8
raw patch · 6 files changed
+7/−974 lines, 6 filesdep +time-locale-compatdep −old-localedep ~basedep ~time
Dependencies added: time-locale-compat
Dependencies removed: old-locale
Dependency ranges changed: base, time
Files
- README.md +0/−4
- biophd.cabal +2/−2
- src/Bio/Sequence/Phd.hs +5/−6
- src/Bio/Sequence/PhdData.hs +0/−92
- src/Bio/Sequence/PhdTag.hs +0/−22
- testdata/ca-21.s +0/−848
− README.md
@@ -1,4 +0,0 @@-biophd-======--Library for reading phd sequence files
biophd.cabal view
@@ -1,5 +1,5 @@ Name: biophd-Version: 0.0.7+Version: 0.0.8 Synopsis: Library for reading phd sequence files Description: Library for reading phd sequence files Homepage: https://github.com/dfornika/biophd/wiki@@ -13,7 +13,7 @@ Build-Type: Simple Library- Build-depends: base >= 2 && < 5, biocore, bytestring, parsec, text, binary, time, old-locale+ Build-depends: base >= 4.5 && < 5, biocore, bytestring, parsec, text, binary, time >= 1.5, time-locale-compat Exposed-modules: Bio.Sequence.Phd Hs-source-dirs: src
src/Bio/Sequence/Phd.hs view
@@ -19,11 +19,10 @@ import Data.List import Data.Maybe import Data.Text (Text)-import Data.Time-import Data.Time.Format+import Data.Time.Format(TimeLocale, defaultTimeLocale, parseTimeOrError) import Data.Binary (encode) import System.IO-import System.Locale+-- import System.Locale -- | Parse a .phd file, extracting the contents as a PHD readPhd :: FilePath -> IO Phd@@ -68,7 +67,7 @@ , phredVersion = com!!2 , callMethod = com!!3 , qualityLevels = read (com!!4) :: Int- , time = readTime defaultTimeLocale "%a %b %-e %T %Y" $ com!!5+ , time = parseTimeOrError True defaultTimeLocale "%a %b %-e %T %Y" $ com!!5 , traceArrayMinIndex = read (com!!6) :: Int , traceArrayMaxIndex = read (com!!7) :: Int , trim = if length com > 10 then@@ -113,13 +112,13 @@ 9 -> Just PhdTag { tagType = head $ dropLabel (td!!1) , source = head $ dropLabel (td!!2) , unpaddedReadPosition = parseReadPosition (td!!3)- , date = readTime defaultTimeLocale "%y/%d/%m %T" $ intercalate " " $ dropLabel (td!!4)+ , date = parseTimeOrError True defaultTimeLocale "%y/%d/%m %T" $ intercalate " " $ dropLabel (td!!4) , Bio.Sequence.PhdTag.comment = if td!!6 == "BEGIN_TAG" then Nothing else Just (td!!6) } _ -> Just PhdTag { tagType = head $ dropLabel (td!!1) , source = head $ dropLabel (td!!2) , unpaddedReadPosition = parseReadPosition (td!!3)- , date = readTime defaultTimeLocale "%y/%d/%m %T" $ intercalate " " $ dropLabel (td!!4)+ , date = parseTimeOrError True defaultTimeLocale "%y/%d/%m %T" $ intercalate " " $ dropLabel (td!!4) , Bio.Sequence.PhdTag.comment = Nothing }
− src/Bio/Sequence/PhdData.hs
@@ -1,92 +0,0 @@-module Bio.Sequence.PhdData where--import System.Locale-import Data.Time-import Data.Time.Format-import Data.Maybe(fromJust)-import Bio.Core.Sequence-import Bio.Sequence.PhdTag-import qualified Data.ByteString.Lazy as BB-import qualified Data.ByteString.Lazy.Char8 as B--{-- A .phd file consists of a DNA block with base and quality- values, followed by one or more (optional) tag blocks. --}-data Phd = Phd { comment :: Comment- , dnaBlock :: DNABlock- , phdTags :: Maybe [PhdTag]- } deriving (Show)--{-- These types are subject to change if it improves functionality,- but for now it's simplest to just call them String, Int etc.--}-data Comment = Comment- { chromatFile :: FilePath- , abiThumbprint :: String- , phredVersion :: String- , callMethod :: String- , qualityLevels :: Int- , time :: LocalTime- , traceArrayMinIndex :: Int- , traceArrayMaxIndex :: Int- , trim :: Maybe String- , chem :: String- , dye :: String- } deriving (Eq)---instance Show Comment where- show (Comment cf abit pv cm ql ti mintai maxtai tr ch dy) =- ("\n" ++) $ unlines- [ "CHROMAT_FILE: " ++ cf- , "ABI_THUMBPRINT: " ++ abit- , "PHRED_VERSION: " ++ pv- , "CALL_METHOD: " ++ cm- , "QUALITY_LEVELS: " ++ show ql- , "TIME: " ++ show ti- , "TRACE_ARRAY_MIN_INDEX: " ++ show mintai- , "TRACE_ARRAY_MAX_INDEX: " ++ show maxtai- , "TRIM: " ++ if (tr == Nothing) then "" else fromJust tr- , "CHEM: " ++ ch- , "DYE: " ++ dy- ]--data DNABlock = DNABlock- { label :: SeqLabel- , bases :: SeqData- , qualities :: QualData- , traceIndices :: [Int]- } deriving (Eq)---instance Show DNABlock where- show = B.unpack . toFasta---instance BioSeq DNABlock where- seqid db = SeqLabel $ B.takeWhile (/= ' ') $ unSL $ label db- seqheader = label- seqdata = bases- seqlength db = Offset $ B.length $ unSD $ bases db--instance BioSeqQual DNABlock where- seqqual = qualities---- Some default values for the data types, useful for debugging in ghci--defaultComment = Comment { chromatFile = "seq.ab1"- , abiThumbprint = "0"- , phredVersion = "0.980904.e"- , callMethod = "phred"- , qualityLevels = 99- , time = readTime defaultTimeLocale "%a %b %-e %T %Y" "Thu Apr 6 09:53:26 2000"- , traceArrayMinIndex = 0- , traceArrayMaxIndex = 1- , trim = Nothing- , chem = "unknown"- , dye = "unknown" }--defaultDNABlock = DNABlock { label = SeqLabel $ B.pack "some_dna A sample sequence."- , bases = SeqData $ B.pack "aatgcatcta"- , qualities = QualData $ B.pack "0000000000"- , traceIndices = [0,1,2,3,4,5,6,7,8,9,10] }--
− src/Bio/Sequence/PhdTag.hs
@@ -1,22 +0,0 @@-module Bio.Sequence.PhdTag where -import System.Locale-import Data.Time-import Data.Time.Format-import Bio.Core.Sequence (Offset, unOff)--data PhdTag = PhdTag- { tagType :: String- , source :: String- , unpaddedReadPosition :: (Offset, Offset)- , date :: LocalTime- , comment :: Maybe String- } deriving (Eq)--instance Show PhdTag where- show (PhdTag tt so urp da co) = ("\n" ++) $ unlines $ map (" " ++)- [ "TYPE: " ++ show tt- , "SOURCE: " ++ show so- , "UNPADDED_READ_POS: " ++ (show $ unOff $ fst urp) ++ " " ++ (show $ unOff $ snd urp)- , "DATE: " ++ show da- , "COMMENT: " ++ show co ]-
− testdata/ca-21.s
@@ -1,848 +0,0 @@-BEGIN_SEQUENCE ca-21.s--BEGIN_COMMENT--CHROMAT_FILE: ca-21.s-ABI_THUMBPRINT: 056131235240000327232065337334-PHRED_VERSION: 0.990722.g-CALL_METHOD: phred-QUALITY_LEVELS: 99-TIME: Thu Apr 6 09:53:26 2000-TRACE_ARRAY_MIN_INDEX: 0-TRACE_ARRAY_MAX_INDEX: 9244-CHEM: prim-DYE: rhod--END_COMMENT--BEGIN_DNA-t 6 6-g 8 18-c 10 25-g 10 46-c 16 54-g 14 59-t 14 70-g 19 82-t 11 92-a 9 109-t 10 124-a 19 142-t 16 147-g 9 163-a 9 181-t 10 198-g 19 213-t 18 222-a 14 240-a 8 251-t 9 255-g 14 271-t 8 281-c 8 300-t 8 317-c 18 335-t 18 341-t 30 354-t 30 367-c 30 384-t 30 391-a 30 408-c 30 420-t 30 427-g 30 442-a 30 459-g 30 468-c 30 483-t 31 490-a 31 506-a 31 518-g 38 528-a 38 543-g 38 553-a 38 568-g 38 577-c 39 590-c 39 602-g 47 612-t 44 624-a 44 639-c 39 652-t 39 661-g 44 674-g 39 688-g 37 701-g 39 715-a 34 731-g 39 739-a 39 755-g 39 764-a 39 779-g 39 787-g 39 801-a 39 816-c 44 827-a 39 839-t 39 848-g 39 860-a 39 877-g 39 886-g 38 899-a 39 915-g 39 924-g 42 937-t 51 950-t 62 962-a 62 976-c 62 987-a 62 999-c 62 1010-g 62 1020-g 51 1033-t 39 1047-g 39 1059-a 39 1076-g 39 1085-a 42 1101-g 44 1110-a 39 1126-a 39 1137-g 39 1147-t 39 1160-a 39 1174-c 44 1185-a 37 1197-a 32 1210-t 32 1220-a 32 1235-c 37 1246-a 37 1259-a 59 1271-g 59 1281-g 59 1294-c 59 1309-a 59 1321-t 62 1331-g 62 1343-t 62 1357-g 62 1368-g 62 1382-t 62 1396-g 62 1408-t 59 1421-a 51 1436-c 34 1447-a 34 1459-c 20 1469-a 20 1480-a 20 1494-g 34 1505-t 34 1518-g 59 1531-t 59 1543-c 62 1558-t 62 1568-c 62 1582-t 62 1592-c 62 1607-t 62 1617-t 62 1631-c 62 1645-c 62 1657-t 62 1667-c 62 1682-c 62 1694-a 62 1707-c 62 1719-t 62 1730-c 62 1745-a 62 1757-t 59 1768-t 56 1782-a 56 1796-g 56 1806-c 56 1822-t 56 1832-g 20 1844-t 20 1858-g 10 1869-t 10 1884-g 10 1896-g 20 1909-c 20 1924-c 62 1936-t 56 1946-c 56 1961-a 56 1974-g 56 1983-t 56 1997-t 56 2010-t 59 2022-c 62 2037-t 62 2047-t 59 2060-c 59 2075-g 59 2085-t 59 2098-t 59 2111-t 59 2124-c 59 2139-t 59 2149-a 56 2164-a 56 2176-a 56 2189-c 59 2201-a 37 2214-a 33 2226-c 11 2238-t 10 2249-g 10 2263-t 33 2274-t 33 2288-c 59 2302-t 59 2313-t 59 2326-c 62 2340-c 62 2352-t 59 2362-a 59 2377-c 59 2389-c 59 2402-t 59 2412-c 59 2427-a 59 2439-t 62 2450-a 62 2465-g 62 2476-g 62 2488-g 62 2502-g 62 2515-a 62 2530-g 62 2542-a 62 2555-a 33 2568-g 33 2579-t 13 2590-t 13 2603-c 13 2617-a 33 2628-a 29 2640-c 62 2651-t 62 2662-g 62 2675-a 62 2690-g 62 2702-g 62 2715-c 62 2730-g 62 2740-g 62 2753-c 62 2767-t 62 2777-g 62 2790-a 62 2805-a 62 2817-a 62 2830-t 62 2840-g 62 2853-a 62 2868-g 62 2879-g 62 2892-a 62 2906-t 62 2916-a 62 2930-t 62 2940-t 62 2952-t 62 2965-t 62 2978-a 62 2992-c 62 3004-a 62 3017-g 62 3028-c 62 3042-g 62 3052-t 62 3064-t 62 3076-t 62 3089-c 62 3104-a 62 3116-g 62 3127-g 62 3139-c 62 3154-c 62 3166-a 62 3178-t 62 3188-t 59 3201-a 59 3216-t 59 3226-t 59 3239-a 59 3254-t 59 3264-t 59 3277-g 59 3291-c 59 3305-a 59 3318-c 62 3329-a 62 3341-a 62 3354-g 62 3365-a 59 3379-g 59 3390-g 59 3403-a 59 3417-a 59 3429-t 59 3439-t 59 3452-t 62 3465-g 62 3477-t 62 3491-a 62 3505-a 62 3518-c 62 3530-a 62 3542-g 59 3553-g 59 3566-a 59 3581-a 59 3594-g 59 3605-a 59 3620-a 59 3631-g 62 3643-t 62 3655-a 62 3669-g 62 3681-g 62 3694-a 62 3708-g 47 3720-a 47 3732-g 47 3745-t 47 3755-t 47 3767-t 47 3780-g 53 3792-g 53 3806-t 53 3818-g 53 3831-g 47 3844-g 47 3857-c 47 3870-t 47 3880-c 47 3892-a 53 3904-g 47 3915-g 34 3927-c 23 3939-t 38 3947-t 38 3959-t 38 3974-g 53 3987-g 38 4001-a 46 4014-c 38 4026-t 38 4035-t 38 4049-a 38 4064-a 53 4078-a 53 4091-a 53 4104-g 53 4116-c 53 4128-a 47 4141-a 46 4155-g 46 4167-a 46 4181-c 38 4191-c 38 4204-c 38 4217-t 38 4228-g 26 4243-c 26 4258-a 23 4271-g 17 4280-g 17 4293-g 27 4307-a 29 4322-g 29 4335-g 31 4349-t 35 4359-t 35 4372-t 38 4387-g 38 4402-c 38 4415-t 38 4425-c 38 4439-t 34 4450-c 34 4465-a 34 4478-g 34 4489-a 34 4505-g 38 4517-c 38 4528-t 38 4539-t 38 4555-a 37 4571-g 32 4583-g 21 4599-a 27 4613-t 21 4623-g 32 4639-c 19 4652-a 23 4664-c 10 4676-g 10 4690-c 10 4703-a 17 4715-g 19 4725-a 33 4741-g 33 4755-a 29 4767-c 33 4780-c 24 4794-c 26 4804-g 24 4817-c 24 4829-g 25 4842-t 44 4854-c 37 4868-c 32 4882-c 30 4894-t 34 4903-a 34 4918-a 34 4934-a 38 4946-c 46 4960-c 53 4971-c 53 4983-c 44 4996-a 38 5007-c 38 5019-t 38 5029-c 38 5045-c 38 5060-c 38 5072-a 38 5083-g 38 5097-c 35 5109-t 35 5117-t 35 5132-c 37 5150-a 44 5161-a 25 5173-g 27 5185-g 15 5198-c 15 5214-c 13 5225-c 25 5236-c 25 5249-t 47 5260-c 47 5276-a 37 5288-c 34 5300-c 34 5314-t 34 5322-c 34 5342-a 36 5353-g 36 5368-c 38 5380-t 38 5389-g 38 5404-g 38 5420-a 38 5435-c 46 5447-c 38 5459-a 46 5470-c 46 5483-a 38 5492-g 38 5506-c 34 5516-c 25 5529-g 16 5542-c 10 5556-a 8 5564-c 8 5584-t 8 5600-c 8 5604-g 8 5618-t 8 5631-a 8 5650-t 6 5673-a 6 5680-c 6 5689-t 6 5710-g 6 5714-g 6 5737-t 6 5750-c 6 5760-g 6 5766-a 6 5779-a 6 5794-a 9 5808-a 9 5817-a 9 5833-a 9 5843-a 8 5855-a 9 5870-a 7 5879-c 7 5893-a 9 5911-c 6 5919-c 6 5934-c 6 5945-a 6 5949-c 6 5965-t 6 5985-a 6 5995-a 10 6006-c 8 6014-a 8 6034-c 8 6041-a 8 6061-c 6 6068-c 6 6086-a 6 6091-c 6 6107-a 6 6122-a 8 6134-c 8 6141-c 6 6158-c 6 6170-a 6 6185-t 6 6186-a 8 6197-a 9 6215-c 9 6224-t 9 6239-a 9 6252-t 8 6270-t 8 6281-a 8 6291-c 8 6298-c 6 6324-a 6 6330-c 8 6337-a 8 6355-a 8 6368-a 9 6380-a 12 6391-a 9 6404-a 6 6413-t 6 6434-t 6 6444-c 6 6452-a 6 6459-c 6 6470-t 6 6487-a 9 6500-a 9 6513-c 9 6528-a 8 6542-a 11 6552-a 6 6564-c 6 6569-a 6 6585-c 8 6596-a 8 6611-c 8 6620-c 6 6635-a 6 6641-a 8 6654-t 8 6673-a 9 6685-c 6 6694-c 7 6706-a 6 6720-t 6 6727-a 6 6743-t 6 6746-a 8 6763-a 8 6778-c 9 6788-t 9 6797-a 9 6813-a 9 6824-t 9 6839-t 9 6852-a 8 6860-t 8 6868-t 8 6885-c 8 6896-t 9 6907-c 7 6921-t 7 6931-t 7 6950-c 7 6958-a 6 6974-c 7 6982-c 7 6995-a 8 7002-c 7 7017-a 12 7027-a 9 7042-c 12 7050-a 8 7066-t 8 7079-a 8 7082-a 6 7100-a 6 7113-a 7 7127-a 7 7143-c 7 7152-t 9 7160-a 9 7173-t 9 7183-a 6 7191-a 6 7206-a 8 7226-t 6 7234-a 6 7249-a 11 7259-a 9 7274-a 12 7282-a 11 7295-c 11 7303-a 9 7319-c 7 7329-c 7 7338-a 7 7357-a 9 7369-a 9 7382-a 9 7394-c 8 7405-a 6 7417-t 6 7423-a 8 7441-a 8 7451-a 9 7466-c 13 7477-a 9 7491-c 9 7501-a 9 7511-a 14 7527-a 12 7537-t 8 7548-a 8 7560-c 6 7578-a 6 7583-a 8 7600-t 8 7614-a 16 7624-a 17 7636-c 21 7646-a 21 7659-c 21 7676-a 18 7685-a 21 7699-c 13 7709-a 16 7717-a 8 7730-a 6 7747-n 0 7756-t 6 7757-t 6 7776-c 6 7784-a 6 7793-c 8 7802-a 8 7822-t 16 7836-a 16 7844-a 25 7859-a 22 7873-t 29 7889-a 12 7901-a 14 7913-a 9 7929-c 8 7937-a 8 7954-a 6 7967-a 6 7972-a 6 7990-c 6 8000-a 9 8015-a 12 8027-t 9 8038-c 8 8052-a 8 8059-c 9 8068-c 9 8083-a 9 8097-c 9 8110-a 6 8119-t 6 8137-t 6 8148-a 10 8152-a 10 8168-a 6 8181-t 6 8184-a 8 8203-c 6 8215-a 6 8225-c 6 8245-a 6 8249-a 12 8263-t 8 8273-a 8 8279-a 8 8294-a 9 8309-a 6 8313-c 7 8331-a 10 8340-c 9 8351-a 10 8366-c 10 8381-a 9 8391-a 8 8406-t 9 8417-c 6 8425-a 6 8431-a 10 8445-a 6 8460-c 9 8473-c 6 8486-a 8 8495-c 8 8513-a 8 8518-a 6 8532-t 6 8537-a 6 8556-a 6 8559-a 6 8574-a 8 8588-a 10 8602-c 12 8617-a 12 8628-a 13 8640-a 8 8654-a 8 8668-c 6 8681-t 6 8684-a 8 8690-a 8 8705-t 6 8729-a 6 8730-t 6 8733-a 6 8743-a 6 8759-t 7 8770-c 9 8785-a 8 8804-a 8 8815-c 6 8826-a 6 8832-a 8 8849-c 8 8864-a 9 8873-t 9 8881-a 9 8893-a 7 8912-t 7 8926-c 6 8936-a 6 8944-c 6 8956-a 6 8961-t 9 8972-c 6 8989-a 8 8998-a 9 9011-c 9 9019-t 9 9027-a 7 9046-n 0 9057-a 6 9066-a 8 9084-t 8 9089-a 8 9099-a 8 9116-a 6 9130-c 6 9134-a 6 9152-a 6 9156-c 8 9175-a 6 9184-t 6 9211-t 6 9214-a 6 9222-a 6 9234-END_DNA--BEGIN_TAG-TYPE: heterozygoteCT-SOURCE: polyPhred-UNPADDED_READ_POS: 98 98-DATE: 09/22/11 15:17:47-BEGIN_COMMENT-99-END_COMMENT-END_TAG--BEGIN_TAG-TYPE: heterozygoteGT-SOURCE: polyPhred-UNPADDED_READ_POS: 151 151-DATE: 09/22/11 15:17:47-BEGIN_COMMENT-99-END_COMMENT-END_TAG--BEGIN_TAG-TYPE: heterozygoteGT-SOURCE: polyPhred-UNPADDED_READ_POS: 208 208-DATE: 09/22/11 15:17:47-BEGIN_COMMENT-99-END_COMMENT-END_TAG--BEGIN_TAG-TYPE: heterozygoteCG-SOURCE: polyPhred-UNPADDED_READ_POS: 373 373-DATE: 09/22/11 15:17:47-BEGIN_COMMENT-99-END_COMMENT-END_TAG--BEGIN_TAG-TYPE: homozygoteGG-SOURCE: polyPhred-UNPADDED_READ_POS: 383 383-DATE: 09/22/11 15:17:47-END_TAG--BEGIN_TAG-TYPE: dataNeeded-SOURCE: polyPhred-UNPADDED_READ_POS: 1 25-DATE: 09/22/11 15:17:47-END_TAG--BEGIN_TAG-TYPE: dataNeeded-SOURCE: polyPhred-UNPADDED_READ_POS: 440 745-DATE: 09/22/11 15:17:47-END_TAG--BEGIN_TAG-TYPE: polymorphismConfirmed-SOURCE: consed-UNPADDED_READ_POS: 98 98-DATE: 11/10/18 18:53:00-END_TAG--BEGIN_TAG-TYPE: polymorphismConfirmed-SOURCE: consed-UNPADDED_READ_POS: 151 151-DATE: 11/10/18 18:54:01-END_TAG--BEGIN_TAG-TYPE: polymorphismConfirmed-SOURCE: consed-UNPADDED_READ_POS: 208 208-DATE: 11/10/18 18:54:39-END_TAG--END_SEQUENCE