packages feed

BiobaseXNA 0.6.0.0 → 0.6.2.0

raw patch · 7 files changed

+70/−18 lines, 7 filesdep −repadep ~PrimitiveArrayPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: repa

Dependency ranges changed: PrimitiveArray

API changes (from Hackage documentation)

+ Biobase.Primary: acgt :: [Nuc]
+ Biobase.Primary: acgu :: [Nuc]
+ Biobase.Primary: charNucList :: [(Char, Nuc)]
+ Biobase.Primary: instance [overlap ok] (Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. Nuc)
+ Biobase.Primary: instance [overlap ok] Eq Primary
+ Biobase.Primary: instance [overlap ok] Ord Primary
+ Biobase.Primary: nN :: Nuc
+ Biobase.Primary: nU :: Nuc
+ Biobase.Primary: nacgt :: [Nuc]
+ Biobase.Primary: nacgu :: [Nuc]
+ Biobase.Primary: nucCharList :: [(Nuc, Char)]
+ Biobase.Secondary: antiCT :: a
+ Biobase.Secondary: cHH :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cHS :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cHW :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cSH :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cSS :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cSW :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cWH :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cWS :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: cWW :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: charCTList :: [(Char, CTisomerism)]
+ Biobase.Secondary: charEdgeList :: [(Char, Edge)]
+ Biobase.Secondary: cis :: CTisomerism
+ Biobase.Secondary: ctCharList :: [(CTisomerism, Char)]
+ Biobase.Secondary: edgeCharList :: [(Edge, Char)]
+ Biobase.Secondary: paraCT :: a
+ Biobase.Secondary: tHH :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tHS :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tHW :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tSH :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tSS :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tSW :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tWH :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tWS :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: tWW :: (CTisomerism, Edge, Edge)
+ Biobase.Secondary: wc :: Edge
+ Biobase.Secondary.Constraint: bonusCC :: Vector Char
+ Biobase.Secondary.Constraint: nobonusCC :: Vector Char
+ Biobase.Secondary.Diagrams: d2Compare :: (Ord t2, Ord t3) => ((t2, t3), t) -> ((t2, t3), t1) -> Ordering
+ Biobase.Secondary.Diagrams: d2Grouping :: (Ord a1, Ord a) => ((a, a1), t) -> ((a, a1), t1) -> Bool
+ Biobase.Secondary.Diagrams: test' :: [((Int, Int), (CTisomerism, Edge, Edge))]
+ Biobase.Secondary.Isostericity: defaultIsostericityMap :: Map ExtPair [String]
+ Biobase.Secondary.Isostericity: mkIsostericityMap :: [[[String]]] -> Map ExtPair [String]
+ Biobase.Secondary.Isostericity: parsedCSV :: [[[[Char]]]]
+ Biobase.Secondary.Vienna: cgnsP :: [ViennaPair]
+ Biobase.Secondary.Vienna: cguaP :: [ViennaPair]
+ Biobase.Secondary.Vienna: instance (Eq sh, Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. ViennaPair)
+ Biobase.Secondary.Vienna: pairToString :: [(ViennaPair, [Char])]
+ Biobase.Secondary.Vienna: viennaPairTable :: Arr0 ((Z :. Nuc) :. Nuc) ViennaPair
+ Biobase.Secondary.Vienna: vpNP :: ViennaPair
- Biobase.Primary: type Primary = Vector Nuc
+ Biobase.Primary: type Primary = Arr0 DIM1 Nuc
- Biobase.Secondary.Constraint: bonusTable :: Double -> Double -> Constraint -> PrimArray DIM2 Double
+ Biobase.Secondary.Constraint: bonusTable :: Double -> Double -> Constraint -> Arr0 DIM2 Double

Files

Biobase/Primary.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE PackageImports #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE OverlappingInstances #-}@@ -19,9 +20,10 @@  module Biobase.Primary where -import Data.Array.Repa.Index-import Data.Array.Repa.Shape+import "PrimitiveArray" Data.Array.Repa.Index+import "PrimitiveArray" Data.Array.Repa.Shape import Data.Char (toUpper)+import Data.ExtShape import Data.Ix (Ix(..)) import Data.Primitive.Types import Data.Tuple (swap)@@ -33,6 +35,9 @@ import qualified Data.Vector.Generic.Mutable as VGM import qualified Data.Vector.Unboxed as VU +import Data.PrimitiveArray+import Data.PrimitiveArray.Unboxed.Zero+ import Biobase.Primary.Bounds  @@ -46,10 +51,24 @@ class MkPrimary a where   mkPrimary :: a -> Primary -type Primary = VU.Vector Nuc+type Primary = Arr0 DIM1 Nuc +instance Eq Primary where+  xs == ys+    | bx==by = sliceEq xs zeroDim ys zeroDim bx+    | otherwise = False+    where (_,bx) = bounds xs+          (_,by) = bounds ys +instance Ord Primary where+  xs <= ys+    | bx==by    = toList xs <= toList ys+    | otherwise = bx<=by+    where (_,Z:.bx) = bounds xs+          (_,Z:.by) = bounds ys ++ -- * Efficient nucleotide encoding  -- A 'Nuc'leotide is simply an Int wrapped up. 'nIMI' provides for@@ -157,6 +176,10 @@   {-# INLINE shapeOfList #-}   {-# INLINE deepSeq #-} +instance (Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. Nuc) where+  subDim (sh1:.Nuc n1) (sh2:.Nuc n2) = subDim sh1 sh2 :. Nuc (n1-n2)+  rangeList (sh1:.Nuc n1) (sh2:.Nuc n2) = [ sh:.Nuc n | sh <- rangeList sh1 sh2, n <- [n1 .. (n1+n2)]]+ -- | The bounded instance from GHC proper. Captures all defined symbols.  instance Bounded Nuc where@@ -180,7 +203,7 @@ -- ** Instances for 'MkPrimary'  instance MkPrimary String where-  mkPrimary = VU.fromList . map mkNuc+  mkPrimary xs = fromList (Z:.0) (Z:.length xs -1) $ map mkNuc xs  instance MkPrimary BS.ByteString where   mkPrimary = mkPrimary . BS.unpack@@ -192,5 +215,5 @@   mkPrimary = mkPrimary . T.unpack  instance MkPrimary [Nuc] where-  mkPrimary = VU.fromList+  mkPrimary xs = fromList (Z:.0) (Z:.length xs -1) xs 
Biobase/Primary/Hashed.hs view
@@ -14,6 +14,8 @@ import qualified Data.Vector.Generic.Mutable as VGM import qualified Data.Vector.Unboxed as VU +import Data.PrimitiveArray+ import Biobase.Primary  @@ -35,10 +37,14 @@ -- with each other. All indices start at 0. -- -- The empty input produces an index of 0.+--+-- TODO currently goes the very inefficient way of creating a temporary vector+-- for 'ps'. We could in O(1) create a vector from a Primary ...  mkHashedPrimary :: (Nuc,Nuc) -> Primary -> HashedPrimary-mkHashedPrimary (l,u) ps = assert (VU.all (\p -> l<=p && p<=u) ps) $ HashedPrimary idx where+mkHashedPrimary (l,u) ps' = assert (VU.all (\p -> l<=p && p<=u) ps) $ HashedPrimary idx where   idx   = VU.sum $ VU.zipWith f ps (VU.enumFromStepN (VU.length ps -1) (-1) (VU.length ps))   f p c = (unNuc p - unNuc l) * (cnst^c)   cnst = unNuc u - unNuc l + 1+  ps = VU.fromList $ toList ps' {-# INLINE mkHashedPrimary #-}
Biobase/Secondary.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE PackageImports #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE PatternGuards #-}@@ -16,8 +17,8 @@  module Biobase.Secondary where -import Data.Array.Repa.Index-import Data.Array.Repa.Shape+import "PrimitiveArray" Data.Array.Repa.Index+import "PrimitiveArray" Data.Array.Repa.Shape import Data.Char (toLower, toUpper) import Data.Ix (Ix(..)) import Data.List as L
Biobase/Secondary/Constraint.hs view
@@ -15,7 +15,7 @@ import qualified Data.Vector.Unboxed as VU  import Data.PrimitiveArray-import Data.PrimitiveArray.Unboxed+import Data.PrimitiveArray.Unboxed.Zero  import Biobase.Secondary.Diagrams @@ -50,7 +50,7 @@ -- TODO and again, we should parametrize over "Energy", "Score", etc (that is, -- Prim a) -bonusTable :: Double -> Double -> Constraint -> PrimArray DIM2 Double+bonusTable :: Double -> Double -> Constraint -> Arr0 DIM2 Double bonusTable bonus malus (Constraint constraint) = arr where   arr = fromAssocs zeroDim (Z:.n:.n) 0 $ bonusBr ++ bonusAn ++ bonusBa ++ malusBr ++ malusAn ++ malusX   n = VU.length constraint -1
Biobase/Secondary/Isostericity.hs view
@@ -87,7 +87,7 @@             ) $ map entry xs where     bpt = head $ head g     xs = tail g-    entry x = (x!!0, takeWhile ((=='I') . head) $ drop 2 x)+    entry x = (x!!0, map (filter (\z -> not $ z `elem` "()")) . takeWhile ('I' `elem`) . drop 2 $ x)   turn entry@(((x,y),(wc,tx,ty)), cs) = [entry, (((y,x),(wc,ty,tx)), cs)]  -- | Simple parsing of raw CSV data.
Biobase/Secondary/Vienna.hs view
@@ -11,7 +11,10 @@  import Data.Array.Repa.Index import Data.Array.Repa.Shape+import Data.ExtShape import Data.Ix+import Data.PrimitiveArray as PA+import Data.PrimitiveArray.Unboxed.Zero as PA import Data.Primitive.Types import Data.Tuple (swap) import GHC.Base (remInt,quotInt)@@ -61,6 +64,10 @@   {-# INLINE shapeOfList #-}   {-# INLINE deepSeq #-} +instance (Eq sh, Shape sh, Show sh, ExtShape sh) => ExtShape (sh :. ViennaPair) where+  subDim (sh1:.ViennaPair n1) (sh2:.ViennaPair n2) = subDim sh1 sh2 :. (ViennaPair $ n1-n2)+  rangeList (sh1:.ViennaPair n1) (sh2:.ViennaPair n2) = [sh:.ViennaPair n | sh <- rangeList sh1 sh2, n <- [n1 .. (n1+n2)]]+ (vpNP:vpCG:vpGC:vpGU:vpUG:vpAU:vpUA:vpNS:vpUndefined:_) = map ViennaPair [0..]  class MkViennaPair a where@@ -68,7 +75,8 @@   fromViennaPair :: ViennaPair -> a  instance MkViennaPair (Nuc,Nuc) where-  mkViennaPair (b1,b2)+  mkViennaPair (b1,b2) = viennaPairTable `PA.index` (Z:.b1:.b2)+  {-     | b1==nC&&b2==nG = vpCG     | b1==nG&&b2==nC = vpGC     | b1==nG&&b2==nU = vpGU@@ -76,6 +84,8 @@     | b1==nA&&b2==nU = vpAU     | b1==nU&&b2==nA = vpUA     | otherwise = vpNS+  -}+  {-# INLINE mkViennaPair #-}   fromViennaPair p     | p==vpCG = (nC,nG)     | p==vpGC = (nG,nC)@@ -84,7 +94,19 @@     | p==vpAU = (nA,nU)     | p==vpUA = (nU,nA)     | otherwise = error "non-standard pairs can't be backcasted"+  {-# INLINE fromViennaPair #-} +viennaPairTable :: Arr0 (Z:.Nuc:.Nuc) ViennaPair+viennaPairTable = fromAssocs (Z:.nN:.nN) (Z:.nU:.nU) vpNS+  [ (Z:.nC:.nG , vpCG)+  , (Z:.nG:.nC , vpGC)+  , (Z:.nG:.nU , vpGU)+  , (Z:.nU:.nG , vpUG)+  , (Z:.nA:.nU , vpAU)+  , (Z:.nU:.nA , vpUA)+  ]+{-# NOINLINE viennaPairTable #-}+ deriving instance VGM.MVector VU.MVector ViennaPair deriving instance VG.Vector VU.Vector ViennaPair deriving instance VU.Unbox ViennaPair@@ -111,6 +133,7 @@ instance Show ViennaPair where   show x     | Just s <- x `lookup` pairToString = s+    | otherwise = "??"  instance Read ViennaPair where   readsPrec p [] = []
BiobaseXNA.cabal view
@@ -1,5 +1,5 @@ name:           BiobaseXNA-version:        0.6.0.0+version:        0.6.2.0 author:         Christian Hoener zu Siederdissen maintainer:     choener@tbi.univie.ac.at homepage:       http://www.tbi.univie.ac.at/~choener/@@ -30,9 +30,9 @@                 .                 .                 .-                New in 0.6.0.0+                New in 0.6.2.0                 .-                * Updated to PrimitiveArrays >= 0.1+                * Updated to PrimitiveArray >= 0.2.0.0  extra-source-files:   sources/isostericity-matrices.csv@@ -49,8 +49,7 @@     text,     tuple,     vector >=0.9 && <0.10,-    repa >= 2,-    PrimitiveArray >= 0.1.1.2+    PrimitiveArray == 0.2.0.0    exposed-modules:     Biobase.Primary@@ -64,7 +63,7 @@     Biobase.Secondary.Vienna    ghc-options:-    -Odph -funbox-strict-fields+    -Odph -funbox-strict-fields -fspec-constr  source-repository head   type: git