packages feed

elynx-nexus 0.4.0 → 0.4.1

raw patch · 5 files changed

+81/−51 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- ELynx.Import.Nexus: nexus :: Block a -> Parser a
+ ELynx.Import.Nexus: nexusBlock :: Block a -> Parser a

Files

ChangeLog.md view
@@ -5,6 +5,20 @@ ## Unreleased changes  +## Version 0.4.1++-   Improve `TimeSpec` (Point process).+-   Parallel evaluation strategies.+-   Change names of some functions involving partitions. For example, `mp` was+    renamed to `pt`.+-   Improve documentation for (bi)partitions.+-   Bugfix `tlynx compare`; do not throw error when branch support values are not+    set.+-   Add `no-elynx-file` option.+-   Also parse Nexus files with `tlynx` commands.+-   Bugfix `subSample`; the sub sample was reversed.++ ## Version 0.4.0  -   Major refactor of `elynx-tree`. All required function can now conveniently
README.md view
@@ -2,7 +2,7 @@  # The ELynx Suite -Version: 0.4.0.+Version: 0.4.1. Reproducible evolution made easy.  <p align="center"><img src="https://travis-ci.org/dschrempf/elynx.svg?branch=master"/></p>@@ -90,12 +90,12 @@      slynx --help | head -n -16 -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx [-v|--verbosity VALUE] [-o|--output-file-basename NAME] -                 [-f|--force] COMMAND+                 [-f|--force] [--no-elynx-file] COMMAND       Analyze, and simulate multi sequence alignments.          Available options:@@ -107,6 +107,7 @@                                Specify base name of output file       -f,--force               Ignore previous analysis and overwrite existing                                output files.+      --no-elynx-file          Do not write files for needed for reproducibility.          Available commands:       concatenate              Concatenate sequences found in input files.@@ -136,9 +137,9 @@      slynx concatenate --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx concatenate (-a|--alphabet NAME) INPUT-FILE       Concatenate sequences found in input files.@@ -157,9 +158,9 @@      slynx examine --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 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 +180,9 @@      slynx filter-rows --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx filter-rows (-a|--alphabet NAME) INPUT-FILE [--longer-than LENGTH]                               [--shorter-than LENGTH] [--standard-characters]@@ -202,9 +203,9 @@      slynx filter-columns --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx filter-columns (-a|--alphabet NAME) INPUT-FILE                                  [--standard-chars DOUBLE]@@ -226,9 +227,9 @@      slynx simulate --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx simulate (-t|--tree-file Name) [-s|--substitution-model MODEL]                            [-m|--mixture-model MODEL] [-e|--edm-file NAME] @@ -305,9 +306,9 @@      slynx sub-sample --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx sub-sample (-a|--alphabet NAME) INPUT-FILE                             (-n|--number-of-sites INT)@@ -335,9 +336,9 @@      slynx translate --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: slynx translate (-a|--alphabet NAME) INPUT-FILE (-r|--reading-frame INT)                            (-u|--universal-code CODE)@@ -360,12 +361,12 @@      tlynx --help | head -n -16 -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: tlynx [-v|--verbosity VALUE] [-o|--output-file-basename NAME] -                 [-f|--force] COMMAND+                 [-f|--force] [--no-elynx-file] COMMAND       Compare, examine, and simulate phylogenetic trees.          Available options:@@ -377,6 +378,7 @@                                Specify base name of output file       -f,--force               Ignore previous analysis and overwrite existing                                output files.+      --no-elynx-file          Do not write files for needed for reproducibility.          Available commands:       compare                  Compare two phylogenetic trees (compute distances and branch-wise differences).@@ -390,6 +392,7 @@     Available tree file formats:       - Newick Standard: Branch support values are stored in square brackets after branch lengths.       - Newick IqTree:   Branch support values are stored as node names after the closing bracket of forests.+      - Newick RevBayes: Key-value pairs is provided in square brackets after node names as well as branch lengths. XXX: Key value pairs are ignored at the moment.   ## Compare@@ -398,9 +401,9 @@      tlynx compare --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: tlynx compare [-n|--normalize] [-b|--bipartitions] [-t|--intersect]                           [-f|--newick-format FORMAT] NAMES@@ -427,9 +430,9 @@      tlynx examine --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: tlynx examine INPUT-FILE [-f|--newick-format FORMAT]       Compute summary statistics of phylogenetic trees.@@ -451,9 +454,9 @@      tlynx simulate --help -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: tlynx simulate (-t|--nTrees INT) (-n|--nLeaves INT) PROCESS                            [-u|--sub-sample DOUBLE] [-s|--summary-statistics] @@ -488,9 +491,9 @@      elynx --help | head -n -16 -    ELynx Suite version 0.4.0.+    ELynx Suite version 0.4.1.     Developed by Dominik Schrempf.-    Compiled on September 4, 2020, at 13:37 pm, UTC.+    Compiled on October 16, 2020, at 12:46 pm, UTC.          Usage: elynx COMMAND       Validate and redo past ELynx analyses
elynx-nexus.cabal view
@@ -1,6 +1,6 @@ cabal-version:  2.2 name:           elynx-nexus-version:        0.4.0+version:        0.4.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
src/ELynx/Export/Nexus.hs view
@@ -18,10 +18,9 @@  import qualified Data.ByteString.Lazy.Char8 as BL --- 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.+--+-- At the moment writing one block only is supported. toNexus :: BL.ByteString -> [BL.ByteString] -> BL.ByteString toNexus n b = BL.unlines $ [start, begin n] <> b <> [end] 
src/ELynx/Import/Nexus.hs view
@@ -13,12 +13,14 @@ -- Creation date: Tue Apr 28 17:10:05 2020. module ELynx.Import.Nexus   ( Block (..),-    nexus,+    nexusBlock,   ) where +import Control.Applicative import Data.Attoparsec.ByteString.Char8 import qualified Data.ByteString.Char8 as BS+import Data.Attoparsec.Combinator  -- | A Nexus block has a name (e.g., TREES), and parser for the entry. data Block a = Block@@ -29,30 +31,42 @@ -- This has to be refined. Like this, only one block can be parsed, and the -- block type has to be known beforehand. --- | Parse a Nexus file with a given 'Block'.-nexus :: Block a -> Parser a-nexus b = start *> block b <* endOfInput <?> "nexus"+-- | Parse a given 'Block' in a Nexus file.+--+-- The Nexus file can contain other blocks.+nexusBlock :: Block a -> Parser a+nexusBlock b = do+  start+  _ <- manyTill anyChar (lookAhead $ beginB b) <?> "nexusBlockSkipUntilBlock"+  r <- block b <?> "nexusBlock"+  _ <- many anyChar <?> "nexusBlockSkipUntilEnd"+  _ <- endOfInput+  return r  start :: Parser ()-start = (<?> "start") $ do-  _ <- string "#NEXUS"-  _ <- skipWhile isSpace+start = do+  _ <- stringCI "#nexus" <?> "nexusStart"+  skipWhile isSpace   return ()  block :: Block a -> Parser a-block b = beginB (name b) *> parser b <* endB <?> "block"+block b = do+  beginB b+  r <- parser b <?> "blockParser"+  endB+  return r -beginB :: BS.ByteString -> Parser ()-beginB n = (<?> "begin") $ do-  _ <- string "BEGIN"-  _ <- skipWhile isSpace-  _ <- string n-  _ <- char ';'-  _ <- skipWhile isSpace+beginB :: Block a -> Parser ()+beginB (Block n _) = do+  _ <- stringCI "begin" <?> "blockBegin"+  skipWhile isSpace+  _ <- stringCI n <?> "blockName"+  _ <- char ';' <?> "blockEnd"+  skipWhile isSpace   return ()  endB :: Parser ()-endB = (<?> "end") $ do-  _ <- string "END;"-  _ <- skipWhile isSpace+endB = do+  _ <- stringCI "end;" <?> "nexusEnd"+  skipWhile isSpace   return ()