packages feed

BiobaseXNA 0.9.1.1 → 0.9.2.0

raw patch · 7 files changed

+139/−95 lines, 7 filesdep +deepseqdep ~PrimitiveArraydep ~aesondep ~bimapsPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: deepseq

Dependency ranges changed: PrimitiveArray, aeson, bimaps, lens, text

API changes (from Hackage documentation)

- Biobase.Primary.AA: instance MkPrimary ByteString AA
- Biobase.Primary.AA: instance MkPrimary Text AA
- Biobase.Primary.AA: instance MkPrimary [Char] AA
- Biobase.Primary.AA: instance MkPrimary [Letter AA] AA
- Biobase.Primary.Letter: unLetter :: Letter t -> Int
+ Biobase.Primary.Letter: getLetter :: Letter t -> Int
+ Biobase.Primary.Letter: instance NFData (Letter t)
+ Biobase.Primary.Unknown: data Unknown
+ Biobase.Primary.Unknown: instance Enum (Letter Unknown)
+ Biobase.Primary.Unknown: instance MkPrimary (Vector Int) Unknown
+ Biobase.Primary.Unknown: instance Read (Letter Unknown)
+ Biobase.Primary.Unknown: instance Show (Letter Unknown)
+ Biobase.Primary.Unknown: unk :: Int -> Letter Unknown

Files

Biobase/Primary.hs view
@@ -10,6 +10,7 @@   , module Biobase.Primary.Letter   , module Biobase.Primary.Nuc   , module Biobase.Primary.Trans+  , module Biobase.Primary.Unknown   ) where  import Biobase.Primary.AA hiding (Stop,A,B,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,X,Y,Z,Undef)@@ -18,4 +19,5 @@ import Biobase.Primary.Letter import Biobase.Primary.Nuc import Biobase.Primary.Trans+import Biobase.Primary.Unknown 
Biobase/Primary/AA.hs view
@@ -128,25 +128,10 @@     succ (Letter x) = Letter $ x+1     pred Stop       = error "pred/Stop:AA"     pred (Letter x) = Letter $ x-1-    toEnum k | k>=0 && k<=(unLetter Undef) = Letter k+    toEnum k | k>=0 && k<=(getLetter Undef) = Letter k     toEnum k                               = error $ "toEnum/Letter RNA " ++ show k     fromEnum (Letter k) = k -instance MkPrimary [Char] AA  where-  primary = VU.fromList . map charAA--instance MkPrimary [Letter AA] AA where-  primary = VU.fromList- instance MkPrimary (VU.Vector Char) AA where   primary = VU.map charAA--instance MkPrimary BS.ByteString AA where-  primary = VU.fromList . map charAA . BS.unpack--instance MkPrimary BSL.ByteString AA where-  primary = VU.fromList . map charAA . BSL.unpack--instance MkPrimary T.Text AA where-  primary = VU.fromList . map charAA . T.unpack 
Biobase/Primary/Letter.hs view
@@ -5,6 +5,7 @@  module Biobase.Primary.Letter where +import           Control.DeepSeq (NFData) import           Data.Aeson import           Data.Binary import           Data.Hashable (Hashable)@@ -29,7 +30,7 @@  -- | A 'Letter' together with its phantom type @t@ encodes bio-sequences. -newtype Letter t = Letter { unLetter :: Int }+newtype Letter t = Letter { getLetter :: Int }                    deriving (Eq,Ord,Generic,Ix)  instance Binary    (Letter t)@@ -37,6 +38,8 @@ instance FromJSON  (Letter t) instance ToJSON    (Letter t) +instance NFData (Letter t)+ type Primary t = VU.Vector (Letter t)  -- | Conversion from a large number of sequence-like inputs to primary@@ -68,7 +71,7 @@ -- *** Instances for 'Letter'.  derivingUnbox "Letter"-  [t| forall a . Letter a -> Int |] [| unLetter |] [| Letter |]+  [t| forall a . Letter a -> Int |] [| getLetter |] [| Letter |]  instance Hashable (Letter t) @@ -109,50 +112,4 @@   {-# Inline streamUp #-}   streamDown l h = map (\(Z:.k) -> k) $ streamDown (Z:.l) (Z:.h)   {-# Inline streamDown #-}--{--instance (Index sh, Show sh) => Shape (sh :. Letter z) where-  rank (sh:._) = rank sh + 1-  zeroDim = zeroDim:.Letter 0-  unitDim = unitDim:.Letter 1 -- TODO does this one make sense?-  intersectDim (sh1:.n1) (sh2:.n2) = intersectDim sh1 sh2 :. min n1 n2-  addDim (sh1:.Letter n1) (sh2:.Letter n2) = addDim sh1 sh2 :. Letter (n1+n2) -- TODO will not necessarily yield a valid Letter-  size (sh1:.Letter n) = size sh1 * n-  sizeIsValid (sh1:.Letter n) = sizeIsValid (sh1:.n)-  toIndex (sh1:.Letter sh2) (sh1':.Letter sh2') = toIndex (sh1:.sh2) (sh1':.sh2')-  fromIndex (ds:.Letter d) n = fromIndex ds (n `quotInt` d) :. Letter r where-                              r | rank ds == 0 = n-                                | otherwise    = n `remInt` d-  inShapeRange (sh1:.n1) (sh2:.n2) (idx:.i) = i>=n1 && i<n2 && inShapeRange sh1 sh2 idx-  listOfShape (sh:.Letter n) = n : listOfShape sh-  shapeOfList xx = case xx of-    []   -> error "empty list in shapeOfList/Primary"-    x:xs -> shapeOfList xs :. Letter x-  deepSeq (sh:.n) x = deepSeq sh (n `seq` x)-  {-# INLINE rank #-}-  {-# INLINE zeroDim #-}-  {-# INLINE unitDim #-}-  {-# INLINE intersectDim #-}-  {-# INLINE addDim #-}-  {-# INLINE size #-}-  {-# INLINE sizeIsValid #-}-  {-# INLINE toIndex #-}-  {-# INLINE fromIndex #-}-  {-# INLINE inShapeRange #-}-  {-# INLINE listOfShape #-}-  {-# INLINE shapeOfList #-}-  {-# INLINE deepSeq #-}--instance (Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. Letter z) where-  subDim (sh1:.Letter n1) (sh2:.Letter n2) = subDim sh1 sh2 :. Letter (n1-n2)-  rangeList (sh1:.Letter n1) (sh2:.Letter n2) = [ sh:.Letter n | sh <- rangeList sh1 sh2, n <- [n1 .. (n1+n2)]]-  rangeStream (fs:.Letter f) (ts:.Letter t) = VM.flatten mk step Unknown $ rangeStream fs ts where-    mk sh = return (sh :. f)-    step (sh :. k)-      | k>t       = return $ VM.Done-      | otherwise = return $ VM.Yield (sh :. Letter k) (sh :. k +1)-    {-# INLINE [1] mk #-}-    {-# INLINE [1] step #-}-  {-# INLINE rangeStream #-}--} 
+ Biobase/Primary/Unknown.hs view
@@ -0,0 +1,72 @@++-- | A 'Letter' with unknown annotation. We sometimes want to encode that+-- we are dealing with @Letter@s in an alphabet, but we do not want to+-- commit to a certain alphabet (just yet).+--+-- This module allows us to make explicit that we do not know the specific+-- alphabet type yet.++module Biobase.Primary.Unknown where++import           Control.Applicative ((<$>))+import           Control.Arrow ((***),first)+import           Data.Hashable+import           Data.Ix (Ix(..))+import           Data.Map.Strict (Map)+import           Data.Primitive.Types+import           Data.Tuple (swap)+import           Data.Vector.Unboxed.Deriving+import           Debug.Trace+import           GHC.Base (remInt,quotInt)+import           GHC.Generics (Generic)+import           GHC.Read+import qualified Data.Bijection.Map as B+import qualified Data.ByteString.Char8 as BS+import qualified Data.ByteString.Lazy.Char8 as BSL+import qualified Data.Map.Strict as M+import qualified Data.Text as T+import qualified Data.Vector.Generic as VG+import qualified Data.Vector.Generic.Mutable as VGM+import qualified Data.Vector.Unboxed as VU+import qualified Text.ParserCombinators.ReadPrec as RP+import qualified Text.Read.Lex as Lex++import           Biobase.Primary.Letter++++-- | @Unknown@ phantom type.++data Unknown++++-- | Creating an unknown letter.++unk :: Int -> Letter Unknown+unk = Letter++++-- *** instances++instance Show (Letter Unknown) where+  show (Letter i) = "U " ++ show i++instance Read (Letter Unknown) where+  readPrec = parens $ do+    Lex.Ident u <- lexP+    case u of+      "U" -> unk <$> readPrec+      _   -> RP.pfail++instance Enum (Letter Unknown) where+    succ (Letter x) = Letter $ x+1+    pred (Letter x) = Letter $ x-1+    toEnum = Letter+    fromEnum = getLetter++instance MkPrimary (VU.Vector Int) Unknown where+  primary = VU.map Letter+  {-# Inline primary #-}+
BiobaseXNA.cabal view
@@ -1,8 +1,9 @@ name:           BiobaseXNA-version:        0.9.1.1+version:        0.9.2.0 author:         Christian Hoener zu Siederdissen maintainer:     choener@bioinf.uni-leipzig.de-homepage:       http://www.bioinf.uni-leipzig.de/~choener/+homepage:       https://github.com/choener/BiobaseXNA+bug-reports:    https://github.com/choener/BiobaseXNA/issues copyright:      Christian Hoener zu Siederdissen, 2011 - 2015 category:       Bioinformatics synopsis:       Efficient RNA/DNA representations@@ -10,6 +11,7 @@ license-file:   LICENSE build-type:     Simple stability:      experimental+tested-with:    GHC == 7.8.4, GHC == 7.10.1 cabal-version:  >= 1.10.0 description:                 This is a base library for bioinformatics with emphasis on RNA@@ -37,30 +39,33 @@   sources/iupac-nucleotides   sources/codontable   changelog.md+  README.md -library-  build-depends: base                    >= 4.7       && < 4.9-               , aeson                   == 0.8.*-               , bimaps                  == 0.0.0.*-               , binary                  == 0.7.*-               , bytes                   == 0.15.*-               , bytestring              == 0.10.*-               , cereal                  == 0.4.*-               , cereal-vector           == 0.2.*-               , containers              == 0.5.*-               , csv                     == 0.1.*-               , file-embed              == 0.0.8.*-               , hashable                == 1.2.*-               , lens                    == 4.*-               , primitive               >= 0.5       && < 0.7-               , PrimitiveArray          == 0.6.*-               , split                   == 0.2.*-               , text                    == 1.*-               , tuple                   == 0.3.*-               , vector                  == 0.10.*-               , vector-binary-instances == 0.2.*-               , vector-th-unbox         == 0.2.* ++library+  build-depends: base                     >= 4.7      && < 4.9+               , aeson                    >= 0.8      && < 0.10+               , bimaps                   >= 0.0.0.2  && < 0.0.1.0+               , binary                   >= 0.7      && < 0.8+               , bytes                    >= 0.15     && < 0.16+               , bytestring               >= 0.10     && < 0.11+               , cereal                   >= 0.4      && < 0.5+               , cereal-vector            >= 0.2      && < 0.3+               , containers               >= 0.5      && < 0.6+               , csv                      >= 0.1      && < 0.2+               , deepseq                  >= 1.3      && < 1.5+               , file-embed               >= 0.0.8    && < 0.0.9+               , hashable                 >= 1.2      && < 1.3+               , lens                     >= 4.0      && < 4.13+               , primitive                >= 0.5      && < 0.7+               , PrimitiveArray           >= 0.6.0    && < 0.6.2+               , split                    >= 0.2      && < 0.3+               , text                     >= 1.0      && < 1.3+               , tuple                    >= 0.3      && < 0.4+               , vector                   >= 0.10     && < 0.11+               , vector-binary-instances  >= 0.2      && < 0.3+               , vector-th-unbox          >= 0.2      && < 0.3   exposed-modules:     Biobase.Primary     Biobase.Primary.AA@@ -74,6 +79,7 @@     Biobase.Primary.Nuc.RNA     Biobase.Primary.Nuc.XNA     Biobase.Primary.Trans+    Biobase.Primary.Unknown     Biobase.Secondary     Biobase.Secondary.Basepair     Biobase.Secondary.Constraint@@ -82,7 +88,6 @@     Biobase.Secondary.Pseudoknots     Biobase.Secondary.Structure     Biobase.Secondary.Vienna-   default-extensions: BangPatterns                     , DeriveGeneric                     , EmptyDataDecls@@ -98,16 +103,17 @@                     , TypeOperators                     , UndecidableInstances                     , ViewPatterns--  default-language: Haskell2010-+  default-language:+    Haskell2010   ghc-options:     -O2 -funbox-strict-fields ++ executable SubOptDistance-  build-depends:  base-               ,  cmdargs == 0.10.*-               ,  BiobaseXNA+  build-depends: base+               , BiobaseXNA+               , cmdargs      >= 0.10   && < 0.11   main-is:     SubOptDistance.hs   hs-source-dirs:@@ -120,6 +126,8 @@                     , ScopedTypeVariables   ghc-options:     -O2++  source-repository head   type: git
+ README.md view
@@ -0,0 +1,15 @@+[![Build Status](https://travis-ci.org/choener/BiobaseXNA.svg?branch=master)](https://travis-ci.org/choener/BiobaseXNA)++# BiobaseXNA++Efficient encoding of biological sequences.++++#### Contact++Christian Hoener zu Siederdissen  +Leipzig University, Leipzig, Germany  +choener@bioinf.uni-leipzig.de  +http://www.bioinf.uni-leipzig.de/~choener/  +
changelog.md view
@@ -1,3 +1,8 @@+0.9.2.0+-------++- fixed overlapping instances in AA+ 0.9.1.0 -------