bioinformatics-toolkit 0.9.2 → 0.9.3
raw patch · 2 files changed
+15/−6 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Bio.RealWorld.GENCODE: [transType] :: Transcript -> TranscriptType
+ Bio.RealWorld.GENCODE: instance GHC.Classes.Eq Bio.RealWorld.GENCODE.TranscriptType
+ Bio.RealWorld.GENCODE: instance GHC.Classes.Ord Bio.RealWorld.GENCODE.TranscriptType
+ Bio.RealWorld.GENCODE: instance GHC.Show.Show Bio.RealWorld.GENCODE.TranscriptType
- Bio.Data.Bed: _bed :: forall bed_aAAi a_aAAj bed_aALt. Lens (BEDExt bed_aAAi a_aAAj) (BEDExt bed_aALt a_aAAj) bed_aAAi bed_aALt
+ Bio.Data.Bed: _bed :: forall bed_aAFF a_aAFG bed_aAQQ. Lens (BEDExt bed_aAFF a_aAFG) (BEDExt bed_aAQQ a_aAFG) bed_aAFF bed_aAQQ
- Bio.Data.Bed: _data :: forall bed_aAAi a_aAAj a_aALu. Lens (BEDExt bed_aAAi a_aAAj) (BEDExt bed_aAAi a_aALu) a_aAAj a_aALu
+ Bio.Data.Bed: _data :: forall bed_aAFF a_aAFG a_aAQR. Lens (BEDExt bed_aAFF a_aAFG) (BEDExt bed_aAFF a_aAQR) a_aAFG a_aAQR
- Bio.Data.Bed.Types: _bed :: forall bed_aAAi a_aAAj bed_aALt. Lens (BEDExt bed_aAAi a_aAAj) (BEDExt bed_aALt a_aAAj) bed_aAAi bed_aALt
+ Bio.Data.Bed.Types: _bed :: forall bed_aAFF a_aAFG bed_aAQQ. Lens (BEDExt bed_aAFF a_aAFG) (BEDExt bed_aAQQ a_aAFG) bed_aAFF bed_aAQQ
- Bio.Data.Bed.Types: _data :: forall bed_aAAi a_aAAj a_aALu. Lens (BEDExt bed_aAAi a_aAAj) (BEDExt bed_aAAi a_aALu) a_aAAj a_aALu
+ Bio.Data.Bed.Types: _data :: forall bed_aAFF a_aAFG a_aAQR. Lens (BEDExt bed_aAFF a_aAFG) (BEDExt bed_aAFF a_aAQR) a_aAFG a_aAQR
- Bio.RealWorld.GENCODE: Transcript :: !ByteString -> !Int -> !Int -> !Bool -> ![(Int, Int)] -> ![(Int, Int)] -> Transcript
+ Bio.RealWorld.GENCODE: Transcript :: !ByteString -> !Int -> !Int -> !Bool -> ![(Int, Int)] -> ![(Int, Int)] -> TranscriptType -> Transcript
Files
bioinformatics-toolkit.cabal view
@@ -1,5 +1,5 @@ name: bioinformatics-toolkit-version: 0.9.2+version: 0.9.3 synopsis: A collection of bioinformatics tools description: A collection of bioinformatics tools license: MIT
src/Bio/RealWorld/GENCODE.hs view
@@ -19,6 +19,10 @@ import Bio.Utils.Misc (readInt) +data TranscriptType = Coding+ | NonCoding+ deriving (Show, Eq, Ord)+ -- | GTF's position is 1-based, but here we convert it to 0-based indexing. data Gene = Gene { geneName :: !(CI B.ByteString)@@ -37,6 +41,7 @@ , transStrand :: !Bool , transExon :: ![(Int, Int)] , transUTR :: ![(Int, Int)]+ , transType :: TranscriptType } deriving (Show, Eq, Ord) -- | Read gene information from Gencode GTF file@@ -72,17 +77,21 @@ | featType == "utr" = _4 %~ ((tid, utr):) $ acc | otherwise = acc where- gene = Gene (mk $ getField "gene_name") gid chr lPos rPos (f7=="+") []- transcript = Transcript tid lPos rPos (f7=="+") [] []+ gene = Gene (mk $ fromJust $ getField "gene_name") gid chr lPos rPos (f7=="+") []+ transcript = Transcript tid lPos rPos (f7=="+") [] [] tTy exon = (lPos, rPos) utr = (lPos, rPos) [chr,_,f3,f4,f5,_,f7,_,f9] = B.split '\t' l- gid = getField "gene_id"- tid = getField "transcript_id"+ gid = fromJust $ getField "gene_id"+ tid = fromJust $ getField "transcript_id"+ tTy = case getField "transcript_type" of+ Just "protein_coding" -> Coding+ Nothing -> Coding+ _ -> NonCoding lPos = readInt f4 - 1 rPos = readInt f5 - 1 featType = B.map toLower f3- getField x = B.init $ B.drop 2 $ fromJust $ lookup x $+ getField x = fmap (B.init . B.drop 2) $ lookup x $ map (B.break isSpace . strip) $ B.split ';' f9 strip = fst . B.spanEnd isSpace . B.dropWhile isSpace isSpace = (== ' ')