slynx 0.3.3 → 0.3.4
raw patch · 6 files changed
+92/−58 lines, 6 filesdep +statisticssetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies added: statistics
API changes (from Hackage documentation)
Files
- ChangeLog.md +8/−0
- README.md +45/−48
- Setup.hs +1/−0
- slynx.cabal +2/−1
- src/SLynx/Examine/Examine.hs +36/−7
- src/SLynx/SLynx.hs +0/−2
ChangeLog.md view
@@ -5,6 +5,14 @@ ## Unreleased changes +## Version 0.3.4++- Improve `slynx examine`; show hamming distance; show constant sites.+- PhyloStrict -> PhyloExplicit; and some conversion functions were changed.+- `tlynx coalesce` was merged into `tlynx simulate`, the syntax has changed; see+ `tlynx simulate --help`.++ ## Version 0.3.3 - Fix test suites.
README.md view
@@ -2,7 +2,7 @@ # The ELynx Suite -Version: 0.3.3.+Version: 0.3.4. 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, 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.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, UTC. Usage: tlynx [-v|--verbosity VALUE] [-o|--output-file-basename NAME] [-f|--force] COMMAND@@ -379,13 +379,12 @@ output files. Available commands:- coalesce Simulate phylogenetic trees using the coalescent processes (see also the 'simulate' command for simulations using the birth and death process). compare Compare two phylogenetic trees (compute distances and branch-wise differences). connect Connect two phylogenetic trees in all ways (possibly honoring constraints). distance Compute distances between many phylogenetic trees. examine Compute summary statistics of phylogenetic trees. shuffle Shuffle a phylogenetic tree (keep coalescent times, but shuffle topology and leaves).- simulate Simulate phylogenetic trees using birth and death processes (see also the 'coalesce' command for simulations using the coalescent process).+ simulate Simulate phylogenetic trees using a birth and death or coalescent process. Available tree file formats:@@ -399,9 +398,9 @@ tlynx compare --help - ELynx Suite version 0.3.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, UTC. Usage: tlynx compare [-n|--normalize] [-b|--bipartitions] [-t|--intersect] [-f|--newick-format FORMAT] NAMES@@ -428,9 +427,9 @@ tlynx examine --help - ELynx Suite version 0.3.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, UTC. Usage: tlynx examine INPUT-FILE [-f|--newick-format FORMAT] Compute summary statistics of phylogenetic trees.@@ -452,37 +451,35 @@ tlynx simulate --help - ELynx Suite version 0.3.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, UTC. - Usage: tlynx simulate [-t|--nTrees INT] [-n|--nLeaves INT] [-H|--height DOUBLE] - [-M|--condition-on-mrca] [-l|--lambda DOUBLE] - [-m|--mu DOUBLE] [-r|--rho DOUBLE] [-u|--sub-sample] - [-s|--summary-statistics] [-S|--seed [INT]]- Simulate phylogenetic trees using birth and death processes (see also the 'coalesce' command for simulations using the coalescent process).+ Usage: tlynx simulate (-t|--nTrees INT) (-n|--nLeaves INT) PROCESS + [-u|--sub-sample DOUBLE] [-s|--summary-statistics] + [-S|--seed [INT]]+ Simulate phylogenetic trees using a birth and death or coalescent process. Available options: -h,--help Show this help text -V,--version Show version- -t,--nTrees INT Number of trees (default: 10)- -n,--nLeaves INT Number of leaves per tree (default: 5)- -H,--height DOUBLE Fix tree height (no default)- -M,--condition-on-mrca Do not condition on height of origin but on height of- MRCA- -l,--lambda DOUBLE Birth rate lambda (default: 1.0)- -m,--mu DOUBLE Death rate mu (default: 0.9)- -r,--rho DOUBLE Sampling probability rho (default: 1.0)- -u,--sub-sample Perform sub-sampling; see below.- -s,--summary-statistics Only output number of children for each branch+ -t,--nTrees INT Number of trees+ -n,--nLeaves INT Number of leaves per tree+ -u,--sub-sample DOUBLE Perform sub-sampling; see below.+ -s,--summary-statistics For each branch, print length and number of children -S,--seed [INT] Seed for random number generator; list of 32 bit integers with up to 256 elements (default: random) -h,--help Show this help text - Height of Trees: if no tree height is given, the heights will be randomly drawn from the expected distribution given the number of leaves, the birth and the death rate.- Summary statistics only: only print (NumberOfExtantChildren BranchLength) pairs for each branch of each tree. The trees are separated by a newline character.- Sub-sampling: simulate one big tree with n'=round(n/rho), n'>=n, leaves, and randomly sample sub-trees with n leaves. Hence, with rho=1.0, the same tree is reported over and over again.- Gernhard, T. (2008). The conditioned reconstructed process. Journal of Theoretical Biology, 253(4), 769–778. http://doi.org/10.1016/j.jtbi.2008.04.005+ Available processes:+ birthdeath Birth and death process+ coalescent Coalescent process+ + See, for example, 'tlynx simulate birthdeath --help'.+ Sub-sample with probability p:+ 1. Simulate one big tree with n'=round(n/p), n'>=n, leaves;+ 2. Randomly sample sub-trees with n leaves.+ (With p=1.0, the same tree is reported over and over again.) # ELynx@@ -491,9 +488,9 @@ elynx --help | head -n -16 - ELynx Suite version 0.3.3.+ ELynx Suite version 0.3.4. Developed by Dominik Schrempf.- Compiled on August 18, 2020, at 08:07 am, UTC.+ Compiled on August 21, 2020, at 09:40 am, UTC. Usage: elynx COMMAND Validate and redo past ELynx analyses
Setup.hs view
@@ -1,2 +1,3 @@ import Distribution.Simple+ main = defaultMain
slynx.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: slynx-version: 0.3.3+version: 0.3.4 synopsis: Handle molecular sequences 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@@ -60,6 +60,7 @@ , monad-logger , mwc-random , optparse-applicative+ , statistics , text , transformers , vector
src/SLynx/Examine/Examine.hs view
@@ -22,13 +22,16 @@ import Control.Monad.Trans.Reader (ask) import qualified Data.ByteString.Lazy.Char8 as BL import qualified Data.Set as S+import qualified Data.Vector.Unboxed as V import qualified ELynx.Data.Alphabet.Alphabet as A import qualified ELynx.Data.Alphabet.Character as C import qualified ELynx.Data.Sequence.Alignment as M+import qualified ELynx.Data.Sequence.Distance as D import qualified ELynx.Data.Sequence.Sequence as Seq import ELynx.Tools import SLynx.Examine.Options import SLynx.Tools+import qualified Statistics.Sample as Sm import Text.Printf pRow :: String -> String -> BL.ByteString@@ -42,9 +45,12 @@ BL.unlines [ BL.pack "Sequences have equal length (multi sequence alignment, or single sequence).",- pRow "Total number of columns in alignment:" $ show (M.length a),- pRow "Number of columns without gaps:" $ show (M.length aNoGaps),- pRow "Number of columns with standard characters only:" $+ BL.pack "Number of columns in alignment:",+ pRow " Total:" $ show aL,+ pRow " Constant:" $ show nConstant,+ pRow " Constant (including gaps or unknowns):" $ show nConstantSoft,+ pRow " Without gaps:" $ show (M.length aNoGaps),+ pRow " With standard characters only:" $ show (M.length aOnlyStd), BL.empty, pRow "Total number of characters:" $ show nTot,@@ -71,6 +77,12 @@ M.alphabet a, BL.pack $ unwords $ map (printf "%.3f") charFreqs, BL.empty,+ BL.pack "Pairwise hamming distances (per site):",+ pRow " Mean:" $ printf "%.3f" hMean,+ pRow " Standard deviation:" $ printf "%.3f" $ sqrt hVar,+ pRow " Minimum:" $ printf "%.3f" hMin,+ pRow " Maximum:" $ printf "%.3f" hMax,+ BL.empty, BL.pack "Mean effective number of states (measured using entropy):", pRow "Across whole alignment:" $ printf "%.3f" kEffMean, pRow "Across columns without gaps:" $ printf "%.3f" kEffMeanNoGaps,@@ -85,6 +97,9 @@ ] <> perSiteBS where+ aL = M.length a+ nConstant = M.length $ M.filterColsConstant a+ nConstantSoft = M.length $ M.filterColsConstantSoft a nTot = M.length a * M.nSequences a nIUPAC = M.countIUPACChars a nGaps = M.countGaps a@@ -93,18 +108,32 @@ percentGaps = 100 * fromIntegral nGaps / fromIntegral nTot :: Double percentUnknowns = 100 * fromIntegral nUnknowns / fromIntegral nTot :: Double aNoGaps = M.filterColsNoGaps a+ aNoGapsFreq = M.toFrequencyData aNoGaps aOnlyStd = M.filterColsOnlyStd aNoGaps+ aOnlyStdFreq = M.toFrequencyData aOnlyStd charFreqsPerSite = M.toFrequencyData a charFreqs = M.distribution charFreqsPerSite+ seqs = M.toSequences a+ normlz x = fromIntegral x / fromIntegral aL+ pairwiseHamming =+ V.fromList+ [ either error normlz $ D.hamming x y+ | x <- seqs,+ y <- seqs,+ x /= y+ ]+ (hMean, hVar) = Sm.meanVariance pairwiseHamming+ hMin = V.minimum pairwiseHamming+ hMax = V.maximum pairwiseHamming kEffs = M.kEffEntropy charFreqsPerSite- kEffsNoGaps = M.kEffEntropy . M.toFrequencyData $ aNoGaps- kEffsOnlyStd = M.kEffEntropy . M.toFrequencyData $ aOnlyStd+ kEffsNoGaps = M.kEffEntropy aNoGapsFreq+ kEffsOnlyStd = M.kEffEntropy aOnlyStdFreq kEffMean = sum kEffs / fromIntegral (length kEffs) kEffMeanNoGaps = sum kEffsNoGaps / fromIntegral (length kEffsNoGaps) kEffMeanOnlyStd = sum kEffsOnlyStd / fromIntegral (length kEffsOnlyStd) kEffsHomo = M.kEffHomoplasy charFreqsPerSite- kEffsNoGapsHomo = M.kEffHomoplasy . M.toFrequencyData $ aNoGaps- kEffsOnlyStdHomo = M.kEffHomoplasy . M.toFrequencyData $ aOnlyStd+ kEffsNoGapsHomo = M.kEffHomoplasy aNoGapsFreq+ kEffsOnlyStdHomo = M.kEffHomoplasy aOnlyStdFreq kEffMeanHomo = sum kEffsHomo / fromIntegral (length kEffsHomo) kEffMeanNoGapsHomo = sum kEffsNoGapsHomo / fromIntegral (length kEffsNoGapsHomo)
src/SLynx/SLynx.hs view
@@ -24,8 +24,6 @@ import SLynx.SubSample.SubSample import SLynx.Translate.Translate --- TODO: Use a class here (e.g., elynx-wrappable) which defines the extractor function.- -- | Run SLynx with given arguments. slynx :: Arguments CommandArguments -> IO () slynx c = case local c of