elynx-tree 0.7.2.0 → 0.7.2.1
raw patch · 4 files changed
+16/−7 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- elynx-tree.cabal +1/−1
- src/ELynx/Tree/Import/Newick.hs +9/−4
- src/ELynx/Tree/Import/Nexus.hs +1/−1
- test/ELynx/Tree/DistanceSpec.hs +5/−1
elynx-tree.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: elynx-tree-version: 0.7.2.0+version: 0.7.2.1 synopsis: Handle phylogenetic trees description: Examine, compare, and simulate phylogenetic trees in a reproducible way. Please see the README on GitHub at <https://github.com/dschrempf/elynx>.
src/ELynx/Tree/Import/Newick.hs view
@@ -129,9 +129,12 @@ p <- phylo return $ Node p n f +forestSep :: Parser ()+forestSep = char ',' *> skipWhile isSpace+ -- A 'forest' is a set of trees separated by @,@ and enclosed by parentheses. forest :: Parser (Forest Phylo Name)-forest = char '(' *> (tree `sepBy1` char ',') <* char ')' <?> "forest"+forest = char '(' *> (tree `sepBy1` forestSep) <* char ')' <?> "forest" -- A 'leaf' has a 'name' and a 'phylo' branch. leaf :: Parser (Tree Phylo Name)@@ -161,7 +164,7 @@ -- A name can be any string of printable characters except blanks, colons, -- semicolons, parentheses, and square brackets (and commas). name :: Parser Name-name = nameQuoted <|> nameNotQuoted <?> "name"+name = skipWhile isSpace *> (nameQuoted <|> nameNotQuoted) <?> "name" phylo :: Parser Phylo phylo = Phylo <$> optional branchLengthStandard <*> optional branchSupportStandard <?> "phylo"@@ -177,7 +180,9 @@ -- Branch length. branchLengthStandard :: Parser Length branchLengthStandard = do+ _ <- skipWhile isSpace _ <- char ':' <?> "branchLengthDelimiter"+ _ <- skipWhile isSpace branchLengthSimple branchSupportSimple :: Parser Support@@ -218,7 +223,7 @@ forestIqTree :: Parser (Forest Phylo Name) forestIqTree = (<?> "forestIqTree") $ do _ <- char '('- f <- treeIqTree `sepBy1` char ','+ f <- treeIqTree `sepBy1` forestSep _ <- char ')' return f @@ -256,7 +261,7 @@ forestRevBayes :: Parser (Forest Phylo Name) forestRevBayes = (<?> "forestRevBayes") $ do _ <- char '('- f <- treeRevBayes `sepBy1` char ','+ f <- treeRevBayes `sepBy1` forestSep _ <- char ')' return f
src/ELynx/Tree/Import/Nexus.hs view
@@ -36,7 +36,7 @@ namedNewick :: NewickFormat -> Parser (BS.ByteString, Tree Phylo Name) namedNewick f = do _ <- skipWhile isSpace- _ <- stringCI "TREE" <?> "namedNewickTreeStart"+ _ <- (stringCI "TREE" <|> stringCI "UTREE") <?> "namedNewickTreeStart" _ <- skipWhile isSpace n <- takeWhile1 (\x -> isAlpha_ascii x || isDigit x) <?> "namedNewickTreeName" _ <- skipWhile isSpace
test/ELynx/Tree/DistanceSpec.hs view
@@ -150,7 +150,11 @@ ] prop_dist_same_tree :: (Num b, Eq b) => (Tree e a -> Tree e a -> Either String b) -> Tree e a -> Bool-prop_dist_same_tree distanceMeasure t = distanceMeasure t t == Right 0+prop_dist_same_tree distanceMeasure t = case distanceMeasure t t of+ (Left "bipartitions: Tree contains duplicate leaves.") -> True+ (Left "bipartitionToBranch: Tree contains duplicate leaves.") -> True+ (Left _) -> False+ Right x -> x == 0 each :: Int -> [a] -> [a] each n = map head . takeWhile (not . null) . iterate (drop n)