BiobaseTrainingData 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+24/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Biobase/TrainingData/Manip.hs +19/−0
- BiobaseTrainingData.cabal +1/−1
- MkTrainingData.hs +4/−3
Biobase/TrainingData/Manip.hs view
@@ -2,6 +2,9 @@ module Biobase.TrainingData.Manip where +import Data.List (sort,sortBy)+import Data.Ord (comparing)+ import Biobase.Secondary.PseudoKnots import Biobase.TrainingData@@ -17,3 +20,19 @@ removePK rpk td@TrainingData{..} | not rpk = td | otherwise = td{secondary = removeByCounting secondary}++-- | Remove triplets from training data. "rmTs" will check each extPair and+-- remove it, if it is the worst in a triplet. If not, the pair is rotated to+-- the last position and we continue. In the non-triplet case, we simply remove+-- the pair from consideration and put it into the output (x:).++fRemoveTriplets False td = td+fRemoveTriplets True td@TrainingData{..} = td{secondary = sort $ rmTs secondary} where+ rmTs [] = []+ rmTs (x:xs)+ | ys <- triplets x xs+ , not $ null ys = if worst x ys then rmTs xs else rmTs xs++[x]+ | otherwise = x : rmTs xs+ where+ triplets ((i,j),_) zs = filter (\((k,l),_) -> i==k || i==l || j==k || j==l) zs+ worst z zs = last (sortBy (comparing snd) $ z : zs) == z
BiobaseTrainingData.cabal view
@@ -1,5 +1,5 @@ name: BiobaseTrainingData-version: 0.1.1.0+version: 0.1.2.0 author: Christian Hoener zu Siederdissen maintainer: choener@tbi.univie.ac.at homepage: http://www.tbi.univie.ac.at/~choener/
MkTrainingData.hs view
@@ -30,6 +30,7 @@ , fromdir :: FilePath , errorFile :: Maybe FilePath , relativePairs :: Maybe Double+ , removeTriplets :: Bool } -- | RNAstrand reads from one file | RNAstrand@@ -45,6 +46,7 @@ , fromdir = "./" &= args , errorFile = def &= help "put TrainingData which falls through the filter in this file (default: disabled)" , relativePairs = def &= help "Keep only TrainingData with that fraction of basepairs."+ , removeTriplets = False &= help "remove triplets pairs (tries to remove non-canonical part first) (default: disabled)" } rnastrand = RNAstrand@@ -63,16 +65,15 @@ let (ys :: [TDmanip]) = id . map (fErrorCheck) -- basic error-checking . map (fMinRelPairs relativePairs) -- filtering out trainingdata with too few pairs+ . map (fmap $ fRemoveTriplets removeTriplets) -- removes triplet pairs (parts of) . map (fmap (removePK removepk)) -- remove pseudoknots from trainingdata . map (fmap (mkTrainingData . removeBIF . F.linearizeFR3D)) -- basic conversions . map Right $ xs let (ls,rs) = partition isLeft ys+ mapM_ (print . fromRight) rs when (isJust errorFile) $ do writeFile (fromJust errorFile) . unlines . map (show . fromLeft) $ ls- mapM_ (print . fromRight) rs- return ()- -- mapM_ print $ map (removePK removepk . mkTrainingData . removeBIF . F.linearizeFR3D) xs -- | RNAstrand importer