packages feed

cobot-io 0.1.3.6 → 0.1.3.7

raw patch · 5 files changed

+32/−18 lines, 5 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Bio.FASTA: fastaPGeneric :: (Char -> Bool) -> Parser (Fasta Char)
+ Bio.FASTA.Parser: fastaPGeneric :: (Char -> Bool) -> Parser (Fasta Char)
+ Bio.Sequence: bareSequ :: Lens' (BareSequence a) (Vector a)
+ Bio.Sequence.Class: bareSequ :: Lens' (BareSequence a) (Vector a)

Files

ChangeLog.md view
@@ -2,6 +2,10 @@  ## [Unreleased] +## [0.1.3.7] - 2020-10-14+### Added+- Generic fasta parser. + ## [0.1.3.6] - 2020-07-14 ### Added - Convertation from `Model`s to `PDB`.
cobot-io.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: d500de47d0d255dded7c634645493f8c346ab2866697db6058faf292f585dff0+-- hash: eadbc12a962f0486f48dd57f8e72d5c4e7ea9528924b23e7b77ca0f67e9b0d4f  name:           cobot-io-version:        0.1.3.6+version:        0.1.3.7 synopsis:       Biological data file formats and IO description:    Please see the README on GitHub at <https://github.com/biocad/cobot-io#readme> category:       Bio
src/Bio/FASTA.hs view
@@ -5,6 +5,7 @@   , fromFile   , toFile   , fastaP+  , fastaPGeneric   ) where  import           Bio.FASTA.Parser
src/Bio/FASTA/Parser.hs view
@@ -1,31 +1,35 @@ module Bio.FASTA.Parser   ( fastaP+  , fastaPGeneric   ) where -import           Bio.FASTA.Type       (Fasta, FastaItem (..))-import           Bio.Sequence         (BareSequence, bareSequence)-import           Data.Attoparsec.Text (Parser, char, choice, endOfInput,-                                       endOfLine, letter, many', many1',-                                       takeWhile)-import           Data.Text            (Text, strip)-import           Prelude              hiding (takeWhile)+import Bio.FASTA.Type       (Fasta, FastaItem (..))+import Bio.Sequence         (BareSequence, bareSequence)+import Data.Attoparsec.Text (Parser, char, choice, endOfInput, endOfLine, many', many1', satisfy,+                             takeWhile)+import Data.Char            (isLetter)+import Data.Text            (Text, strip)+import Prelude              hiding (takeWhile)  -- | Parser of .fasta file. -- fastaP :: Parser (Fasta Char)-fastaP = many' item+fastaP = fastaPGeneric isLetter -item :: Parser (FastaItem Char)-item = FastaItem <$> seqName <*> fastaSeq+fastaPGeneric :: (Char -> Bool) -> Parser (Fasta Char)+fastaPGeneric = many' . item -seqName :: Parser (Text)+item :: (Char -> Bool) -> Parser (FastaItem Char)+item predicate = FastaItem <$> seqName <*> fastaSeq predicate++seqName :: Parser Text seqName = strip <$> (char '>' *> tabs *> takeWhile (`notElem` ['\n', '\r']) <* tabs <* eol) -fastaSeq :: Parser (BareSequence Char)-fastaSeq = bareSequence . mconcat <$> many' line+fastaSeq :: (Char -> Bool) -> Parser (BareSequence Char)+fastaSeq predicate = bareSequence . mconcat <$> many' (line predicate) -line :: Parser String-line = concat <$> many1' (many1' letter <* many' (char ' ')) <* eol+line :: (Char -> Bool) -> Parser String+line predicate = concat <$> many1' (many1' (satisfy predicate) <* many' (char ' ')) <* eol  eol :: Parser () eol = tabs *> choice [slashN, endOfInput]
src/Bio/Sequence/Class.hs view
@@ -14,6 +14,7 @@   , sequ   , markings   , weights+  , bareSequ    -- classes for weights and markings of sequence   , IsMarking@@ -87,7 +88,7 @@   length = V.length . _sequ  instance Traversable (Sequence mk w) where-  traverse f s@Sequence{..} = fmap (\newSeq -> s { _sequ = newSeq }) $ traverse f _sequ+  traverse f s@Sequence{..} = (\newSeq -> s { _sequ = newSeq }) <$> traverse f _sequ  -- | Exported constructor for 'Sequence'. Should be used ONLY in module Bio.Sequence. --@@ -113,6 +114,7 @@ -------------------------------------------------------------------------------- -- Lenses for 'Sequence'. -- We create only getters, so user that couldn't ruin 'Sequence's invariant.+-- But we can create a Lens for 'BareSequence', and it won't ruin any invariants. --------------------------------------------------------------------------------  sequ :: Getter (Sequence mk w a) (Vector a)@@ -123,6 +125,9 @@  weights :: Getter (Sequence mk w a) (Vector w) weights  = to _weights++bareSequ :: Lens' (BareSequence a) (Vector a)+bareSequ = lens _sequ (\s v -> s { _sequ = v })   --------------------------------------------------------------------------------