elynx-seq 0.7.2.2 → 0.8.0.0
raw patch · 9 files changed
+38/−33 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- ELynx.Character.Character: class CharacterX a => CharacterI a
+ ELynx.Character.Character: class (CharacterX a) => CharacterI a
- ELynx.Character.Character: class Character a => CharacterX a
+ ELynx.Character.Character: class (Character a) => CharacterX a
Files
- ChangeLog.md +5/−0
- README.md +5/−5
- elynx-seq.cabal +1/−1
- src/ELynx/Alphabet/Character.hs +2/−2
- src/ELynx/Alphabet/DistributionDiversity.hs +5/−5
- src/ELynx/Character/Character.hs +11/−11
- src/ELynx/Character/Codon.hs +4/−4
- src/ELynx/Sequence/Alignment.hs +4/−4
- src/ELynx/Sequence/Translate.hs +1/−1
ChangeLog.md view
@@ -5,6 +5,11 @@ ## Unreleased changes +## Version 0.8.0.0++- Adapt to breaking changes in upstream libraries (`data-default`).++ ## Version 0.7.2.0 - `slynx`: Allow global normalization of mixture models.
README.md view
@@ -2,7 +2,7 @@ # The ELynx Suite -Version: 0.7.2.1.+Version: 0.8.0.0. Reproducible evolution made easy. <p align="center"><img src="https://travis-ci.org/dschrempf/elynx.svg?branch=master"/></p>@@ -73,9 +73,9 @@ # OR: stack exec slynx -- --help # OR: slynx --help - ELynx Suite version 0.7.2.1.+ ELynx Suite version 0.8.0.0. Developed by Dominik Schrempf.- Compiled on June 15, 2023, at 19:54 pm, UTC.+ Compiled on October 27, 2024, at 07:14 am, UTC. Usage: slynx [-v|--verbosity VALUE] [-o|--output-file-basename NAME] [-f|--force] [--no-elynx-file] COMMAND@@ -143,9 +143,9 @@ # OR: stack exec slynx -- simulate --help # OR: slynx simulate --help - ELynx Suite version 0.7.2.1.+ ELynx Suite version 0.8.0.0. Developed by Dominik Schrempf.- Compiled on June 15, 2023, at 19:54 pm, UTC.+ Compiled on October 27, 2024, at 07:14 am, UTC. Usage: slynx simulate (-t|--tree-file Name) [-s|--substitution-model MODEL] [-m|--mixture-model MODEL] [-n|--global-normalization]
elynx-seq.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: elynx-seq-version: 0.7.2.2+version: 0.8.0.0 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>.
src/ELynx/Alphabet/Character.hs view
@@ -68,9 +68,9 @@ fromString = map fromChar -- | Conversion of 'Character's.-toCVec :: C.Character a => V.Vector Character -> V.Vector a+toCVec :: (C.Character a) => V.Vector Character -> V.Vector a toCVec = V.map (C.fromWord . toWord) -- | Conversion of 'Character's.-fromCVec :: C.Character a => V.Vector a -> V.Vector Character+fromCVec :: (C.Character a) => V.Vector a -> V.Vector Character fromCVec = V.map (fromWord . C.toWord)
src/ELynx/Alphabet/DistributionDiversity.hs view
@@ -57,29 +57,29 @@ -- | Effective number of used characters measured using 'entropy'. The result -- only makes sense when the sum of the array is 1.0.-kEffEntropy :: Vector v Double => v Double -> Double+kEffEntropy :: (Vector v Double) => v Double -> Double kEffEntropy v = if e < eps then 1.0 else exp e where e = entropy v -- | Probability of homoplasy of vector. The result is the probability of -- binomially sampling the same character twice and only makes sense when the -- sum of the array is 1.0.-homoplasy :: Vector v Double => v Double -> Double+homoplasy :: (Vector v Double) => v Double -> Double homoplasy v = V.sum $ V.map (\x -> x * x) v -- | Effective number of used characters measured using 'homoplasy'. The result -- only makes sense when the sum of the array is 1.0.-kEffHomoplasy :: Vector v Double => v Double -> Double+kEffHomoplasy :: (Vector v Double) => v Double -> Double kEffHomoplasy v = 1.0 / homoplasy v -- XXX: Use mutable vector; then V.// is much faster. -- Increment element at index in vector by one.-incrementElemIndexByOne :: Vector v Int => [Int] -> v Int -> v Int+incrementElemIndexByOne :: (Vector v Int) => [Int] -> v Int -> v Int incrementElemIndexByOne is v = v V.// zip is es' where es' = [v V.! i + 1 | i <- is] -- For a given code and counts vector, increment the count of the given character.-acc :: Vector v Int => AlphabetSpec -> v Int -> Character -> v Int+acc :: (Vector v Int) => AlphabetSpec -> v Int -> Character -> v Int acc alph vec char = incrementElemIndexByOne is vec where is = [S.findIndex c (std alph) | c <- toStd alph char]
src/ELynx/Character/Character.hs view
@@ -45,48 +45,48 @@ fromWord :: Word8 -> a -- | Conversion to 'Char'.-toChar :: Character a => a -> Char+toChar :: (Character a) => a -> Char toChar = w2c . toWord -- | Conversion from 'Char'.-fromChar :: Character a => Char -> a+fromChar :: (Character a) => Char -> a fromChar = fromWord . c2w -- | Conversion to 'String'.-toString :: Character a => [a] -> String+toString :: (Character a) => [a] -> String toString = map toChar -- | Conversion from 'String'.-fromString :: Character a => String -> [a]+fromString :: (Character a) => String -> [a] fromString = map fromChar -- | An extended character type with gaps and unknowns.-class Character a => CharacterX a where+class (Character a) => CharacterX a where gap :: a -- | Is the character a gap or unknown?-isGap :: CharacterX a => a -> Bool+isGap :: (CharacterX a) => a -> Bool isGap c = c == gap -- | IUPAC characters with a mapping to extended characters.-class CharacterX a => CharacterI a where+class (CharacterX a) => CharacterI a where unknown :: a iupac :: [a] toStandard :: a -> [a] -- | Check if a IUPAC 'CharacterI' is unknown (e.g., N for nucleotides).-isUnknown :: CharacterI a => a -> Bool+isUnknown :: (CharacterI a) => a -> Bool isUnknown c = c == unknown -iupacLookup :: CharacterI a => S.Set a+iupacLookup :: (CharacterI a) => S.Set a iupacLookup = S.fromList iupac -- | Is the given character a IUPAC character?-isIUPAC :: CharacterI a => a -> Bool+isIUPAC :: (CharacterI a) => a -> Bool isIUPAC c = c `S.member` iupacLookup -- | Is the given character a standard character?-isStandard :: CharacterI a => a -> Bool+isStandard :: (CharacterI a) => a -> Bool isStandard c = not $ isIUPAC c -- | Convert between character classes. May throw error.
src/ELynx/Character/Codon.hs view
@@ -50,7 +50,7 @@ -- | Unsafe conversion from vector with at least three elements; only the first -- three elements are used, the rest is discarded.-fromVecUnsafe :: V.Vector v a => v a -> Codon a+fromVecUnsafe :: (V.Vector v a) => v a -> Codon a fromVecUnsafe xs = Codon (V.head xs, V.head . V.tail $ xs, V.head . V.tail . V.tail $ xs) @@ -63,16 +63,16 @@ instance ToJSON UniversalCode -- It is important that the map is lazy, because some keys have errors as values.-mapFromLists :: Ord a => [a] -> [a] -> [a] -> [b] -> M.Map (Codon a) b+mapFromLists :: (Ord a) => [a] -> [a] -> [a] -> [b] -> M.Map (Codon a) b mapFromLists xs ys zs as = M.fromList $ zipWith4 (\f s t a -> (Codon (f, s, t), a)) xs ys zs as -nucs :: Enum a => [a]+nucs :: (Enum a) => [a] nucs = map toEnum [3, 1, 0, 2] -- Order T, C, A , G. -- Permutation of the triplets PLUS GAPS! I avoid 'Z' because I do not want to -- translate DNAI.-base1, base2, base3 :: Enum a => [a]+base1, base2, base3 :: (Enum a) => [a] base1 = [n | n <- nucs, _ <- [0 .. 3 :: Int], _ <- [0 .. 3 :: Int]] -- base1 = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG" ++ "-." base2 = [n | _ <- [0 .. 3 :: Int], n <- nucs, _ <- [0 .. 3 :: Int]]
src/ELynx/Sequence/Alignment.hs view
@@ -140,14 +140,14 @@ summarize a = header a <> S.body (toSequences a) -- Vertical concatenation.-(===) :: V.Unbox a => M.Matrix a -> M.Matrix a -> M.Matrix a+(===) :: (V.Unbox a) => M.Matrix a -> M.Matrix a -> M.Matrix a (===) l r = M.fromRows $ lRs ++ rRs where lRs = M.toRows l rRs = M.toRows r -- Horizontal concatenation.-(|||) :: V.Unbox a => M.Matrix a -> M.Matrix a -> M.Matrix a+(|||) :: (V.Unbox a) => M.Matrix a -> M.Matrix a -> M.Matrix a (|||) l r = M.fromColumns $ lCs ++ rCs where lCs = M.toColumns l@@ -305,7 +305,7 @@ allChars = M.flatten $ matrix a -- Sample the given sites from a matrix.-subSampleMatrix :: V.Unbox a => [Int] -> M.Matrix a -> M.Matrix a+subSampleMatrix :: (V.Unbox a) => [Int] -> M.Matrix a -> M.Matrix a subSampleMatrix is m = M.fromColumns $ foldl' (\a i -> M.takeColumn m i : a) [] (reverse is) @@ -314,7 +314,7 @@ subSample is a = a {matrix = m'} where m' = subSampleMatrix is $ matrix a -- | Randomly sample a given number of sites of the multi sequence alignment.-randomSubSample :: StatefulGen g m => Int -> Alignment -> g -> m Alignment+randomSubSample :: (StatefulGen g m) => Int -> Alignment -> g -> m Alignment randomSubSample n a g = do let l = length a is <- replicateM n $ uniformRM (0, l - 1) g
src/ELynx/Sequence/Translate.hs view
@@ -22,7 +22,7 @@ -- Chop list into chunks of given length. If the last chop is shorter than -- length, it is dropped.-chopVec :: V.Unbox a => Int -> V.Vector a -> [V.Vector a]+chopVec :: (V.Unbox a) => Int -> V.Vector a -> [V.Vector a] chopVec n xs | V.length xs < n = [] | otherwise = V.take n xs : chopVec n (V.drop n xs)