{-# LANGUAGE OverloadedStrings #-}
module ELynx.Tree.Export.Nexus
( toNexusTrees,
)
where
import qualified Data.ByteString.Lazy.Char8 as BL
import ELynx.Export.Nexus
import ELynx.Tree.Export.Newick
import ELynx.Tree.Named
import ELynx.Tree.Phylogeny
import ELynx.Tree.Rooted
toNexusTrees :: Named a => [(BL.ByteString, Tree Phylo a)] -> BL.ByteString
toNexusTrees ts = toNexus "TREES" (map tree ts)
tree :: Named a => (BL.ByteString, Tree Phylo a) -> BL.ByteString
tree (n, t) = " TREE " <> n <> " = " <> toNewick t