elynx-nexus 0.3.0 → 0.3.1
raw patch · 5 files changed
+66/−64 lines, 5 filesdep +attoparsecdep −megaparsec
Dependencies added: attoparsec
Dependencies removed: megaparsec
Files
- ChangeLog.md +8/−1
- README.md +27/−27
- elynx-nexus.cabal +4/−4
- src/ELynx/Export/Nexus.hs +7/−8
- src/ELynx/Import/Nexus.hs +20/−24
ChangeLog.md view
@@ -2,7 +2,14 @@ # Changelog for ELynx -## Version 0.3.1; in development+## Version 0.3.2; in development+++## Version 0.3.1++- Use Attoparsec.+- Use ByteString consistently.+- Remove elynx-tools dependency from libaries. ## Version 0.3.0
README.md view
@@ -2,7 +2,7 @@ # The ELynx Suite -Version: 0.3.0.+Version: 0.3.1. Reproducible evolution made easy. <p align="center"><img src="https://travis-ci.org/dschrempf/elynx.svg?branch=master"/></p>@@ -90,9 +90,9 @@ slynx --help | head -n -16 - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx [-v|--verbosity VALUE] [-o|--output-file-basename NAME] [-f|--force] COMMAND@@ -136,9 +136,9 @@ slynx concatenate --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx concatenate (-a|--alphabet NAME) INPUT-FILE Concatenate sequences found in input files.@@ -157,9 +157,9 @@ slynx examine --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx examine (-a|--alphabet NAME) INPUT-FILE [--per-site] Examine sequences. If data is a multi sequence alignment, additionally analyze columns.@@ -179,9 +179,9 @@ slynx filter-rows --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx filter-rows (-a|--alphabet NAME) INPUT-FILE [--longer-than LENGTH] [--shorter-than LENGTH] [--standard-characters]@@ -202,9 +202,9 @@ slynx filter-columns --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx filter-columns (-a|--alphabet NAME) INPUT-FILE [--standard-chars DOUBLE]@@ -226,9 +226,9 @@ slynx simulate --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx simulate (-t|--tree-file Name) [-s|--substitution-model MODEL] [-m|--mixture-model MODEL] [-e|--edm-file NAME] @@ -305,9 +305,9 @@ slynx sub-sample --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx sub-sample (-a|--alphabet NAME) INPUT-FILE (-n|--number-of-sites INT)@@ -335,9 +335,9 @@ slynx translate --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: slynx translate (-a|--alphabet NAME) INPUT-FILE (-r|--reading-frame INT) (-u|--universal-code CODE)@@ -360,9 +360,9 @@ tlynx --help | head -n -16 - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: tlynx [-v|--verbosity VALUE] [-o|--output-file-basename NAME] [-f|--force] COMMAND@@ -399,9 +399,9 @@ tlynx compare --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: tlynx compare [-n|--normalize] [-b|--bipartitions] [-t|--intersect] [-f|--newick-format FORMAT] NAMES@@ -428,9 +428,9 @@ tlynx examine --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: tlynx examine INPUT-FILE [-f|--newick-format FORMAT] Compute summary statistics of phylogenetic trees.@@ -452,9 +452,9 @@ tlynx simulate --help - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: tlynx simulate [-t|--nTrees INT] [-n|--nLeaves INT] [-H|--height DOUBLE] [-M|--condition-on-mrca] [-l|--lambda DOUBLE] @@ -491,9 +491,9 @@ elynx --help | head -n -16 - ELynx Suite version 0.3.0.+ ELynx Suite version 0.3.1. Developed by Dominik Schrempf.- Compiled on July 30, 2020, at 12:40 pm, UTC.+ Compiled on August 3, 2020, at 12:12 pm, UTC. Usage: elynx COMMAND Validate and redo past ELynx analyses
elynx-nexus.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 9c674ee4c190e6ed28b942de7dd8ded7fdc03eb4fb5b0fbcdbc6560f57bcba4a+-- hash: b78b847dab23ec4452d24d3ccc5a20019353a0324d5fd7c51781f4033fda34d0 name: elynx-nexus-version: 0.3.0+version: 0.3.1 synopsis: Import and export Nexus files description: Examine, modify, and simulate molecular sequences in a reproducible way. Please see the README on GitHub at <https://github.com/dschrempf/elynx>. category: Bioinformatics@@ -39,9 +39,9 @@ src ghc-options: -Wall -fllvm build-depends:- base >=4.7 && <5+ attoparsec+ , base >=4.7 && <5 , bytestring- , megaparsec default-language: Haskell2010 test-suite seq-test
src/ELynx/Export/Nexus.hs view
@@ -16,21 +16,20 @@ ) where -import Data.ByteString.Lazy.Char8 (ByteString)-import qualified Data.ByteString.Lazy.Char8 as L+import qualified Data.ByteString.Lazy.Char8 as BL --- This has to be refined. Like this, only one block can be parsed, and the+-- XXX: This has to be refined. Like this, only one block can be parsed, and the -- block type has to be known beforehand. -- | Create nexus file with block name and block body.-toNexus :: ByteString -> [ByteString] -> ByteString-toNexus n b = L.unlines $ [start, begin n] <> b <> [end]+toNexus :: BL.ByteString -> [BL.ByteString] -> BL.ByteString+toNexus n b = BL.unlines $ [start, begin n] <> b <> [end] -start :: ByteString+start :: BL.ByteString start = "#NEXUS" -begin :: ByteString -> ByteString+begin :: BL.ByteString -> BL.ByteString begin n = "BEGIN " <> n <> ";" -end :: ByteString+end :: BL.ByteString end = "END;"
src/ELynx/Import/Nexus.hs view
@@ -12,25 +12,17 @@ -- -- Creation date: Tue Apr 28 17:10:05 2020. module ELynx.Import.Nexus- ( Parser,- Block (..),+ ( Block (..), nexus, ) where -import Control.Monad (void)-import Data.ByteString.Internal (c2w)-import Data.ByteString.Lazy.Char8 (ByteString)-import Data.Void (Void)-import Text.Megaparsec-import Text.Megaparsec.Byte---- | Megaparsec shortcut.-type Parser = Parsec Void ByteString+import Data.Attoparsec.ByteString.Char8+import qualified Data.ByteString.Char8 as BS -- | A Nexus block has a name (e.g., TREES), and parser for the entry. data Block a = Block- { name :: ByteString,+ { name :: BS.ByteString, parser :: Parser a } @@ -39,24 +31,28 @@ -- | Parse a Nexus file with a given 'Block'. nexus :: Block a -> Parser a-nexus b = start *> block b+nexus b = start *> block b <* endOfInput <?> "nexus" start :: Parser ()-start = void $ string "#NEXUS" <* space+start = (<?> "start") $ do+ _ <- string "#NEXUS"+ _ <- skipWhile isSpace+ return () block :: Block a -> Parser a-block b = between (begin $ name b) end (parser b)+block b = beginB (name b) *> parser b <* endB <?> "block" -begin :: ByteString -> Parser ()-begin n = do+beginB :: BS.ByteString -> Parser ()+beginB n = (<?> "begin") $ do _ <- string "BEGIN"- _ <- space+ _ <- skipWhile isSpace _ <- string n- _ <- char (c2w ';')- _ <-- space- <?> "block-begin"+ _ <- char ';'+ _ <- skipWhile isSpace return () -end :: Parser ()-end = void $ string "END;" <* space+endB :: Parser ()+endB = (<?> "end") $ do+ _ <- string "END;"+ _ <- skipWhile isSpace+ return ()