uniprot-kb 0.1.0.1 → 0.1.1.0
raw patch · 5 files changed
+76/−26 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Bio.Uniprot.Type: [$sel:ac:Record] :: Record -> AC
- Bio.Uniprot.Type: [$sel:accessionNumbers:AC] :: AC -> [Text]
- Bio.Uniprot.Type: [$sel:altNames:DE] :: DE -> [AltName]
- Bio.Uniprot.Type: [$sel:cc:Record] :: Record -> [CC]
- Bio.Uniprot.Type: [$sel:code:Organism] :: Organism -> Text
- Bio.Uniprot.Type: [$sel:comment:CC] :: CC -> Text
- Bio.Uniprot.Type: [$sel:commonName:Organism] :: Organism -> Maybe Text
- Bio.Uniprot.Type: [$sel:contains:DE] :: DE -> [DE]
- Bio.Uniprot.Type: [$sel:crc64:SQ] :: SQ -> Text
- Bio.Uniprot.Type: [$sel:databaseQualifier:OX] :: OX -> Text
- Bio.Uniprot.Type: [$sel:dbIntegrationDate:DT] :: DT -> Text
- Bio.Uniprot.Type: [$sel:dbName:DT] :: DT -> Text
- Bio.Uniprot.Type: [$sel:de:Record] :: Record -> DE
- Bio.Uniprot.Type: [$sel:description:FT] :: FT -> [Text]
- Bio.Uniprot.Type: [$sel:dr:Record] :: Record -> [DR]
- Bio.Uniprot.Type: [$sel:dt:Record] :: Record -> DT
- Bio.Uniprot.Type: [$sel:ecNumber:Name] :: Name -> [Text]
- Bio.Uniprot.Type: [$sel:entryName:ID] :: ID -> Text
- Bio.Uniprot.Type: [$sel:entryVersion:DT] :: DT -> Int
- Bio.Uniprot.Type: [$sel:entryVersionDate:DT] :: DT -> Text
- Bio.Uniprot.Type: [$sel:flags:DE] :: DE -> Maybe Flag
- Bio.Uniprot.Type: [$sel:fromEP:FT] :: FT -> Endpoint
- Bio.Uniprot.Type: [$sel:ft:Record] :: Record -> [FT]
- Bio.Uniprot.Type: [$sel:fullName:Name] :: Name -> Text
- Bio.Uniprot.Type: [$sel:geneName:GN] :: GN -> Maybe Text
- Bio.Uniprot.Type: [$sel:gn:Record] :: Record -> [GN]
- Bio.Uniprot.Type: [$sel:hostName:OH] :: OH -> Text
- Bio.Uniprot.Type: [$sel:id:Record] :: Record -> ID
- Bio.Uniprot.Type: [$sel:includes:DE] :: DE -> [DE]
- Bio.Uniprot.Type: [$sel:keyName:FT] :: FT -> Text
- Bio.Uniprot.Type: [$sel:keywords:KW] :: KW -> [Text]
- Bio.Uniprot.Type: [$sel:kingdom:Organism] :: Organism -> Kingdom
- Bio.Uniprot.Type: [$sel:kw:Record] :: Record -> Maybe KW
- Bio.Uniprot.Type: [$sel:molWeight:SQ] :: SQ -> Int
- Bio.Uniprot.Type: [$sel:nodes:OC] :: OC -> [Text]
- Bio.Uniprot.Type: [$sel:oc:Record] :: Record -> OC
- Bio.Uniprot.Type: [$sel:officialName:Organism] :: Organism -> Text
- Bio.Uniprot.Type: [$sel:og:Record] :: Record -> Maybe OG
- Bio.Uniprot.Type: [$sel:oh:Record] :: Record -> [OH]
- Bio.Uniprot.Type: [$sel:optionalInfo:DR] :: DR -> [Text]
- Bio.Uniprot.Type: [$sel:orderedLocusNames:GN] :: GN -> [Text]
- Bio.Uniprot.Type: [$sel:orfNames:GN] :: GN -> [Text]
- Bio.Uniprot.Type: [$sel:os:Record] :: Record -> OS
- Bio.Uniprot.Type: [$sel:ox:Record] :: Record -> OX
- Bio.Uniprot.Type: [$sel:pe:Record] :: Record -> PE
- Bio.Uniprot.Type: [$sel:ra:Reference] :: Reference -> [Text]
- Bio.Uniprot.Type: [$sel:rc:Reference] :: Reference -> [(Token, Text)]
- Bio.Uniprot.Type: [$sel:recName:DE] :: DE -> Maybe Name
- Bio.Uniprot.Type: [$sel:refs:Record] :: Record -> [Reference]
- Bio.Uniprot.Type: [$sel:resourceAbbr:DR] :: DR -> Text
- Bio.Uniprot.Type: [$sel:resourceId:DR] :: DR -> Text
- Bio.Uniprot.Type: [$sel:rg:Reference] :: Reference -> Maybe Text
- Bio.Uniprot.Type: [$sel:rl:Reference] :: Reference -> Text
- Bio.Uniprot.Type: [$sel:rn:Reference] :: Reference -> Int
- Bio.Uniprot.Type: [$sel:rp:Reference] :: Reference -> Text
- Bio.Uniprot.Type: [$sel:rt:Reference] :: Reference -> Maybe Text
- Bio.Uniprot.Type: [$sel:rx:Reference] :: Reference -> [(BibliographicDB, Text)]
- Bio.Uniprot.Type: [$sel:seqLength:ID] :: ID -> Int
- Bio.Uniprot.Type: [$sel:seqLength:SQ] :: SQ -> Int
- Bio.Uniprot.Type: [$sel:seqVersion:DT] :: DT -> Int
- Bio.Uniprot.Type: [$sel:seqVersionDate:DT] :: DT -> Text
- Bio.Uniprot.Type: [$sel:sequence:SQ] :: SQ -> Text
- Bio.Uniprot.Type: [$sel:shortName:Name] :: Name -> [Text]
- Bio.Uniprot.Type: [$sel:specie:OS] :: OS -> Text
- Bio.Uniprot.Type: [$sel:sq:Record] :: Record -> SQ
- Bio.Uniprot.Type: [$sel:status:ID] :: ID -> Status
- Bio.Uniprot.Type: [$sel:subNames:DE] :: DE -> [Name]
- Bio.Uniprot.Type: [$sel:synonym:Organism] :: Organism -> Maybe Text
- Bio.Uniprot.Type: [$sel:synonyms:GN] :: GN -> [Text]
- Bio.Uniprot.Type: [$sel:taxId:OH] :: OH -> Text
- Bio.Uniprot.Type: [$sel:taxonomicCode:OX] :: OX -> Text
- Bio.Uniprot.Type: [$sel:toEP:FT] :: FT -> Endpoint
- Bio.Uniprot.Type: [$sel:topic:CC] :: CC -> Topic
+ Bio.Uniprot.Type: [ac] :: Record -> AC
+ Bio.Uniprot.Type: [accessionNumbers] :: AC -> [Text]
+ Bio.Uniprot.Type: [altNames] :: DE -> [AltName]
+ Bio.Uniprot.Type: [cc] :: Record -> [CC]
+ Bio.Uniprot.Type: [code] :: Organism -> Text
+ Bio.Uniprot.Type: [comment] :: CC -> Text
+ Bio.Uniprot.Type: [commonName] :: Organism -> Maybe Text
+ Bio.Uniprot.Type: [contains] :: DE -> [DE]
+ Bio.Uniprot.Type: [crc64] :: SQ -> Text
+ Bio.Uniprot.Type: [databaseQualifier] :: OX -> Text
+ Bio.Uniprot.Type: [dbIntegrationDate] :: DT -> Text
+ Bio.Uniprot.Type: [dbName] :: DT -> Text
+ Bio.Uniprot.Type: [de] :: Record -> DE
+ Bio.Uniprot.Type: [description] :: FT -> [Text]
+ Bio.Uniprot.Type: [dr] :: Record -> [DR]
+ Bio.Uniprot.Type: [dt] :: Record -> DT
+ Bio.Uniprot.Type: [ecNumber] :: Name -> [Text]
+ Bio.Uniprot.Type: [entryName] :: ID -> Text
+ Bio.Uniprot.Type: [entryVersionDate] :: DT -> Text
+ Bio.Uniprot.Type: [entryVersion] :: DT -> Int
+ Bio.Uniprot.Type: [flags] :: DE -> Maybe Flag
+ Bio.Uniprot.Type: [fromEP] :: FT -> Endpoint
+ Bio.Uniprot.Type: [ft] :: Record -> [FT]
+ Bio.Uniprot.Type: [fullName] :: Name -> Text
+ Bio.Uniprot.Type: [geneName] :: GN -> Maybe Text
+ Bio.Uniprot.Type: [gn] :: Record -> [GN]
+ Bio.Uniprot.Type: [hostName] :: OH -> Text
+ Bio.Uniprot.Type: [id] :: Record -> ID
+ Bio.Uniprot.Type: [includes] :: DE -> [DE]
+ Bio.Uniprot.Type: [keyName] :: FT -> Text
+ Bio.Uniprot.Type: [keywords] :: KW -> [Text]
+ Bio.Uniprot.Type: [kingdom] :: Organism -> Kingdom
+ Bio.Uniprot.Type: [kw] :: Record -> Maybe KW
+ Bio.Uniprot.Type: [length] :: SQ -> Int
+ Bio.Uniprot.Type: [molWeight] :: SQ -> Int
+ Bio.Uniprot.Type: [nodes] :: OC -> [Text]
+ Bio.Uniprot.Type: [oc] :: Record -> OC
+ Bio.Uniprot.Type: [officialName] :: Organism -> Text
+ Bio.Uniprot.Type: [og] :: Record -> Maybe OG
+ Bio.Uniprot.Type: [oh] :: Record -> [OH]
+ Bio.Uniprot.Type: [optionalInfo] :: DR -> [Text]
+ Bio.Uniprot.Type: [orderedLocusNames] :: GN -> [Text]
+ Bio.Uniprot.Type: [orfNames] :: GN -> [Text]
+ Bio.Uniprot.Type: [os] :: Record -> OS
+ Bio.Uniprot.Type: [ox] :: Record -> OX
+ Bio.Uniprot.Type: [pe] :: Record -> PE
+ Bio.Uniprot.Type: [ra] :: Reference -> [Text]
+ Bio.Uniprot.Type: [rc] :: Reference -> [(Token, Text)]
+ Bio.Uniprot.Type: [recName] :: DE -> Maybe Name
+ Bio.Uniprot.Type: [refs] :: Record -> [Reference]
+ Bio.Uniprot.Type: [resourceAbbr] :: DR -> Text
+ Bio.Uniprot.Type: [resourceId] :: DR -> Text
+ Bio.Uniprot.Type: [rg] :: Reference -> Maybe Text
+ Bio.Uniprot.Type: [rl] :: Reference -> Text
+ Bio.Uniprot.Type: [rn] :: Reference -> Int
+ Bio.Uniprot.Type: [rp] :: Reference -> Text
+ Bio.Uniprot.Type: [rt] :: Reference -> Maybe Text
+ Bio.Uniprot.Type: [rx] :: Reference -> [(BibliographicDB, Text)]
+ Bio.Uniprot.Type: [seqLength] :: ID -> Int
+ Bio.Uniprot.Type: [seqVersionDate] :: DT -> Text
+ Bio.Uniprot.Type: [seqVersion] :: DT -> Int
+ Bio.Uniprot.Type: [sequence] :: SQ -> Text
+ Bio.Uniprot.Type: [shortName] :: Name -> [Text]
+ Bio.Uniprot.Type: [specie] :: OS -> Text
+ Bio.Uniprot.Type: [sq] :: Record -> SQ
+ Bio.Uniprot.Type: [status] :: ID -> Status
+ Bio.Uniprot.Type: [subNames] :: DE -> [Name]
+ Bio.Uniprot.Type: [synonym] :: Organism -> Maybe Text
+ Bio.Uniprot.Type: [synonyms] :: GN -> [Text]
+ Bio.Uniprot.Type: [taxId] :: OH -> Text
+ Bio.Uniprot.Type: [taxonomicCode] :: OX -> Text
+ Bio.Uniprot.Type: [toEP] :: FT -> Endpoint
+ Bio.Uniprot.Type: [topic] :: CC -> Topic
Files
- ChangeLog.md +5/−0
- src/Bio/Uniprot/Parser.hs +31/−21
- src/Bio/Uniprot/Type.hs +1/−2
- test/Spec.hs +37/−1
- uniprot-kb.cabal +2/−2
ChangeLog.md view
@@ -7,6 +7,11 @@ ## [Unreleased] +## 0.1.1.0+* Back compability lost for SQ section+* No more DuplicateRecordFields, so it can be built by 7.x+* Includes and Contains sections of DE tested+ ## 0.1.0.1 * Small fixes in description fields read * Documentation fixes
src/Bio/Uniprot/Parser.hs view
@@ -75,39 +75,40 @@ -- |Parses DE lines of UniProt-KB text file. parseDE :: Parser DE parseDE = do- recName <- optional $ parseNameDE RecName- altNames <- many' (endOfLine *> parseAltDE)- subNames <- many' (endOfLine *> parseNameDE SubName)- includes <- pure []- contains <- pure []+ recName <- optional $ parseNameDE 0 RecName+ altNames <- many' (endOfLine *> parseAltDE 0)+ subNames <- many' (endOfLine *> parseNameDE 0 SubName)+ includes <- many' (endOfLine *> parseInternal "Includes")+ contains <- many' (endOfLine *> parseInternal "Contains") flags <- optional (endOfLine *> parseFlagsDE) pure DE{..} where -- |Parses name section like RecName, AltName or SubName.- parseNameDE :: NameType -> Parser Name- parseNameDE nameType = do- fullName <- parseDELine nameType "Full"- shortName <- many' $ endOfLine *> parseDELine None "Short"- ecNumber <- many' $ endOfLine *> parseDELine None "EC"+ parseNameDE :: Int -> NameType -> Parser Name+ parseNameDE indent nameType = do+ fullName <- parseDELine indent nameType "Full"+ shortName <- many' $ endOfLine *> parseDELine indent None "Short"+ ecNumber <- many' $ endOfLine *> parseDELine indent None "EC" pure Name{..} -- |Parses flag line of DE section parseFlagsDE :: Parser Flag- parseFlagsDE = read . unpack <$> parseDELine Flags ""+ parseFlagsDE = read . unpack <$> parseDELine 0 Flags "" -- |Parses AltName lines of DE section- parseAltDE :: Parser AltName- parseAltDE =- (Simple <$> parseNameDE AltName) <|>- (Allergen <$> parseDELine AltName "Allergen") <|>- (Biotech <$> parseDELine AltName "Biotech") <|>- (CDAntigen <$> parseDELine AltName "CD_antigen") <|>- (INN <$> parseDELine AltName "INN")+ parseAltDE :: Int -> Parser AltName+ parseAltDE indent =+ (Simple <$> parseNameDE indent AltName) <|>+ (Allergen <$> parseDELine indent AltName "Allergen") <|>+ (Biotech <$> parseDELine indent AltName "Biotech") <|>+ (CDAntigen <$> parseDELine indent AltName "CD_antigen") <|>+ (INN <$> parseDELine indent AltName "INN") -- |Parses any DE line- parseDELine :: NameType -> Text -> Parser Text- parseDELine nameType tpe = do+ parseDELine :: Int -> NameType -> Text -> Parser Text+ parseDELine indent nameType tpe = do string "DE "+ count indent (char ' ') case nameType of None -> string " " a -> string $ append (pack $ show a) ": "@@ -119,6 +120,15 @@ char ';' pure res + -- |Parses internal DE entities+ parseInternal :: Text -> Parser DE+ parseInternal name = do+ string "DE " >> string name >> char ':'+ endOfLine+ recName <- optional $ parseNameDE 2 RecName+ altNames <- many' (endOfLine *> parseAltDE 2)+ pure $ DE recName altNames [] [] [] Nothing+ -- |Parses DE lines of UniProt-KB text file. parseGN :: Parser [GN] parseGN = do@@ -334,7 +344,7 @@ parseSQ = do string "SQ SEQUENCE" many1 space- seqLength <- decimal+ length <- decimal space >> string "AA;" many1 space molWeight <- decimal
src/Bio/Uniprot/Type.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE DuplicateRecordFields #-} module Bio.Uniprot.Type where import Data.Text (Text)@@ -230,7 +229,7 @@ -- |SeQuence header - sequence data and a quick summary of its content. data SQ = SQ- { seqLength :: Int -- ^Length of the sequence in amino acids.+ { length :: Int -- ^Length of the sequence in amino acids. , molWeight :: Int -- ^Molecular weight rounded to the nearest mass unit (Dalton). , crc64 :: Text -- ^Sequence 64-bit CRC (Cyclic Redundancy Check) value. , sequence :: Text -- ^Sequence of the protein
test/Spec.hs view
@@ -33,6 +33,25 @@ DE AltName: CD_antigen=CD279; DE Flags: Precursor;|] +de2Str :: Text+de2Str = [text|+DE RecName: Full=Arginine biosynthesis bifunctional protein argJ;+DE Includes:+DE RecName: Full=Glutamate N-acetyltransferase;+DE EC=2.3.1.35;+DE AltName: Full=Ornithine acetyltransferase;+DE Short=OATase;+DE AltName: Full=Ornithine transacetylase;+DE Includes:+DE RecName: Full=Amino-acid acetyltransferase;+DE EC=2.3.1.1;+DE AltName: Full=N-acetylglutamate synthase;+DE Short=AGS;+DE Contains:+DE RecName: Full=Arginine biosynthesis bifunctional protein argJ alpha chain;+DE Contains:+DE RecName: Full=Arginine biosynthesis bifunctional protein argJ beta chain;|]+ gnStr :: Text gnStr = "GN Name=PDCD1; Synonyms=PD1;" @@ -690,6 +709,22 @@ deAns = DE (Just (Name "Programmed cell death protein 1" ["Protein PD-1", "hPD-1"] [])) [CDAntigen "CD279"] [] [] [] (Just Precursor) +de2Ans :: DE+de2Ans = DE (Just (Name "Arginine biosynthesis bifunctional protein argJ" [] [])) [] []+ [DE (Just (Name "Glutamate N-acetyltransferase" [] ["2.3.1.35"]))+ [Simple (Name "Ornithine acetyltransferase" ["OATase"] []),+ Simple (Name "Ornithine transacetylase" [] [])]+ [] [] [] Nothing,+ DE (Just (Name "Amino-acid acetyltransferase" [] ["2.3.1.1"]))+ [Simple (Name "N-acetylglutamate synthase" ["AGS"] [])]+ [] [] [] Nothing+ ]+ [DE (Just (Name "Arginine biosynthesis bifunctional protein argJ alpha chain" [] []))+ [] [] [] [] Nothing,+ DE (Just (Name "Arginine biosynthesis bifunctional protein argJ beta chain" [] []))+ [] [] [] [] Nothing]+ Nothing+ gnAns :: [GN] gnAns = [GN (Just "PDCD1") ["PD1"] [] []] @@ -903,8 +938,9 @@ parseOnly parseAC acStr `shouldBe` Right acAns it "parses DT lines" $ parseOnly parseDT dtStr `shouldBe` Right dtAns- it "parses DE lines" $+ it "parses DE lines" $ do parseOnly parseDE deStr `shouldBe` Right deAns+ parseOnly parseDE de2Str `shouldBe` Right de2Ans it "parses GN lines" $ parseOnly parseGN gnStr `shouldBe` Right gnAns it "parses OS lines" $
uniprot-kb.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 46801dc834178bde36de5bfcd64e4b397b76da7ac4dbe6f22b7275f5a1661110+-- hash: 3517fcac83f428dec7f91394fc57d66a124e38ba92fb52f33441827f60aa1c9e name: uniprot-kb-version: 0.1.0.1+version: 0.1.1.0 synopsis: UniProt-KB format parser description: Specification implementation of https://web.expasy.org/docs/userman.html category: Bio