aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2022-12-16 10:57:55 +1100
committerJustin Bedo <cu@cua0.org>2023-01-16 09:02:49 +1100
commita09d5c9d9f7097dd4baf4e9611e488ee1d12ca2f (patch)
tree5fbabdaa8fbc3929dddacf2ddc19eded9a0c692d
init
-rw-r--r--.gitignore1
-rw-r--r--bin/cluster.hs88
-rw-r--r--cabal.project7
-rw-r--r--flake.lock900
-rw-r--r--flake.nix39
-rw-r--r--package.yaml17
-rw-r--r--phylogenies.cabal28
7 files changed, 1080 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fcfc4a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+result*
diff --git a/bin/cluster.hs b/bin/cluster.hs
new file mode 100644
index 0000000..70e22c7
--- /dev/null
+++ b/bin/cluster.hs
@@ -0,0 +1,88 @@
+{-# LANGUAGE ViewPatterns #-}
+
+module Main where
+
+import Data.Fixed (mod')
+import Data.Foldable (toList)
+import Data.List
+import qualified Data.Map as M
+import qualified Data.Vector.Unboxed as V
+import Numeric.Log hiding (sum)
+import PPL
+import System.Random (mkStdGen, setStdGen)
+
+cumsum = scanl1 (+)
+
+first f xs = snd . head . filter (f . fst) $ zip xs [0 ..]
+
+stirling n = n * log n - n
+
+pois lambda (fromIntegral -> k) = lambda' ** k' * Exp (negate lambda) / Exp (stirling k)
+ where
+ lambda' = Exp $ log lambda
+ k' = Exp $ log k
+
+-- (infinite) binary trees
+data Tree a = Empty | Tree a (Tree a) (Tree a)
+ deriving (Show)
+
+instance Foldable Tree where
+ foldMap f t = bftrav [t]
+ where
+ bftrav [] = mempty
+ bftrav (Empty : ts) = bftrav ts
+ bftrav ((Tree a l r) : ts) = f a <> bftrav (ts <> [l, r])
+
+-- Infinite trees from infinite lists
+-- NB: it's harder to partition a list so that it folds back to
+-- equivalence. It doesn't really matter here since we're only
+-- unfolding random uniforms anyway.
+treeFromList (x : xs) = Tree x (treeFromList lpart) (treeFromList rpart)
+ where
+ (lpart, rpart) = unzip $ partition xs
+ partition (a : b : xs) = (a, b) : partition xs
+
+-- Constrain trees so leaves sum to node value
+normTree :: Tree Double -> Tree Double
+normTree (Tree x l r) = go $ Tree x l r
+ where
+ go (Tree x (Tree u l r) (Tree v l' r')) =
+ let s = x / (u + v)
+ in Tree x (go $ Tree (s * u) l r) (go $ Tree (s * v) l' r')
+
+drawTreeProbs = toList . normTree . treeFromList <$> iid uniform
+
+model xs = do
+ (clmuAcinar, clmuDuctal, params, clusters) <- sample $ do
+ -- Sample hyperparameters
+ a <- bounded 1 10
+
+ -- CRP style
+ dir <- cumsum <$> dirichletProcess a
+ rs <- iid uniform
+ clmuAcinar <- drawTreeProbs
+ clmuDuctal <- drawTreeProbs
+ let clusters = map (\r -> first (>= r) dir) rs
+ params = map (\i -> zip clmuAcinar clmuDuctal !! i) clusters
+ pure (clmuAcinar, clmuDuctal, params, clusters)
+ mapM_ scoreLog $ zipWith likelihood params (V.toList xs)
+ let cls = take (V.length xs) clusters
+ k = maximum cls + 1
+ pure (take k clmuAcinar, take k clmuDuctal, cls)
+ where
+ likelihood (ap, dp) (ac, ad, dc, dd) =
+ max (pois (fromIntegral ad * ap) ac) (pois (fromIntegral ad * ap / 2) ac)
+ * max (pois (fromIntegral dd * dp) dc) (pois (fromIntegral dd * dp / 2) dc)
+
+main = do
+ setStdGen $ mkStdGen 42
+ (hdr : lines) <- lines <$> readFile "/nix/store/9xkb2apajv9sy37akz24x3jj6kw5hn7h-bionix-dump-counts"
+ let parsed = V.fromList $ map ((\[_, ac, ad, dc, dd] -> (dbl ac, dbl ad, dbl dc, dbl dd)) . words) lines
+ dbl = round . read :: String -> Int
+ ((a, d, cl), _) <- foldl1' (\a c -> if mml a < mml c then a else c) . take 100000 <$> mh 0.3 (model parsed)
+ writeFile "/data/props" . unlines $ zipWith (\a b -> show a <> "," <> show b) a d
+ writeFile "/data/clusters" . unlines $ map show cl
+ where
+ mml ((a, d, cl), lik) = sum (map (log . (+ 1)) a) + sum (map (log . (+ 1)) d) + sum (map (log . (+ 1)) tab) - sum (map stirling tab) - ln lik
+ where
+ tab = M.elems $ M.fromListWith (+) [(c, 1) | c <- cl]
diff --git a/cabal.project b/cabal.project
new file mode 100644
index 0000000..265b3e2
--- /dev/null
+++ b/cabal.project
@@ -0,0 +1,7 @@
+packages: *.cabal
+
+source-repository-package
+ type: git
+ location: https://vk3.wtf/cgit/ppl.git
+ tag: b906da9afa6802bf8104dfabe26b67a6c673af91
+ --sha256: 14gqgs4akf74q5wh3spn72fnggb28dgmmh52vi9a5kx7dc23pxj2
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..2f052dd
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,900 @@
+{
+ "nodes": {
+ "HTTP": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1451647621,
+ "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=",
+ "owner": "phadej",
+ "repo": "HTTP",
+ "rev": "9bc0996d412fef1787449d841277ef663ad9a915",
+ "type": "github"
+ },
+ "original": {
+ "owner": "phadej",
+ "repo": "HTTP",
+ "type": "github"
+ }
+ },
+ "blank": {
+ "locked": {
+ "lastModified": 1625557891,
+ "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=",
+ "owner": "divnix",
+ "repo": "blank",
+ "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "divnix",
+ "repo": "blank",
+ "type": "github"
+ }
+ },
+ "cabal-32": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1603716527,
+ "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=",
+ "owner": "haskell",
+ "repo": "cabal",
+ "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee",
+ "type": "github"
+ },
+ "original": {
+ "owner": "haskell",
+ "ref": "3.2",
+ "repo": "cabal",
+ "type": "github"
+ }
+ },
+ "cabal-34": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1640353650,
+ "narHash": "sha256-N1t6M3/wqj90AEdRkeC8i923gQYUpzSr8b40qVOZ1Rk=",
+ "owner": "haskell",
+ "repo": "cabal",
+ "rev": "942639c18c0cd8ec53e0a6f8d120091af35312cd",
+ "type": "github"
+ },
+ "original": {
+ "owner": "haskell",
+ "ref": "3.4",
+ "repo": "cabal",
+ "type": "github"
+ }
+ },
+ "cabal-36": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1641652457,
+ "narHash": "sha256-BlFPKP4C4HRUJeAbdembX1Rms1LD380q9s0qVDeoAak=",
+ "owner": "haskell",
+ "repo": "cabal",
+ "rev": "f27667f8ec360c475027dcaee0138c937477b070",
+ "type": "github"
+ },
+ "original": {
+ "owner": "haskell",
+ "ref": "3.6",
+ "repo": "cabal",
+ "type": "github"
+ }
+ },
+ "cardano-shell": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1608537748,
+ "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=",
+ "owner": "input-output-hk",
+ "repo": "cardano-shell",
+ "rev": "9392c75087cb9a3d453998f4230930dea3a95725",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "repo": "cardano-shell",
+ "type": "github"
+ }
+ },
+ "devshell": {
+ "inputs": {
+ "flake-utils": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "flake-utils"
+ ],
+ "nixpkgs": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1663445644,
+ "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=",
+ "owner": "numtide",
+ "repo": "devshell",
+ "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "devshell",
+ "type": "github"
+ }
+ },
+ "dmerge": {
+ "inputs": {
+ "nixlib": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "nixpkgs"
+ ],
+ "yants": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "yants"
+ ]
+ },
+ "locked": {
+ "lastModified": 1659548052,
+ "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=",
+ "owner": "divnix",
+ "repo": "data-merge",
+ "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497",
+ "type": "github"
+ },
+ "original": {
+ "owner": "divnix",
+ "repo": "data-merge",
+ "type": "github"
+ }
+ },
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1635892615,
+ "narHash": "sha256-harGbMZr4hzat2BWBU+Y5OYXlu+fVz7E4WeQzHi5o8A=",
+ "owner": "input-output-hk",
+ "repo": "flake-compat",
+ "rev": "eca47d3377946315596da653862d341ee5341318",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-compat_2": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1650374568,
+ "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "b4a34015c698c7793d592d66adbab377907a2be8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-utils": {
+ "locked": {
+ "lastModified": 1667395993,
+ "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_2": {
+ "locked": {
+ "lastModified": 1644229661,
+ "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_3": {
+ "locked": {
+ "lastModified": 1653893745,
+ "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_4": {
+ "locked": {
+ "lastModified": 1659877975,
+ "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_5": {
+ "locked": {
+ "lastModified": 1653893745,
+ "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "ghc-8.6.5-iohk": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1600920045,
+ "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=",
+ "owner": "input-output-hk",
+ "repo": "ghc",
+ "rev": "95713a6ecce4551240da7c96b6176f980af75cae",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "ref": "release/8.6.5-iohk",
+ "repo": "ghc",
+ "type": "github"
+ }
+ },
+ "gomod2nix": {
+ "inputs": {
+ "nixpkgs": "nixpkgs_2",
+ "utils": "utils"
+ },
+ "locked": {
+ "lastModified": 1655245309,
+ "narHash": "sha256-d/YPoQ/vFn1+GTmSdvbSBSTOai61FONxB4+Lt6w/IVI=",
+ "owner": "tweag",
+ "repo": "gomod2nix",
+ "rev": "40d32f82fc60d66402eb0972e6e368aeab3faf58",
+ "type": "github"
+ },
+ "original": {
+ "owner": "tweag",
+ "repo": "gomod2nix",
+ "type": "github"
+ }
+ },
+ "hackage": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1671063994,
+ "narHash": "sha256-4YZ6+JUSFPBlK0zNErqBY8GLvBVbS8q1ldNcBwqSuME=",
+ "owner": "input-output-hk",
+ "repo": "hackage.nix",
+ "rev": "f42f80c9eda52453b6042aee6f614302d076b852",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "repo": "hackage.nix",
+ "type": "github"
+ }
+ },
+ "haskellNix": {
+ "inputs": {
+ "HTTP": "HTTP",
+ "cabal-32": "cabal-32",
+ "cabal-34": "cabal-34",
+ "cabal-36": "cabal-36",
+ "cardano-shell": "cardano-shell",
+ "flake-compat": "flake-compat",
+ "flake-utils": "flake-utils_2",
+ "ghc-8.6.5-iohk": "ghc-8.6.5-iohk",
+ "hackage": "hackage",
+ "hpc-coveralls": "hpc-coveralls",
+ "hydra": "hydra",
+ "iserv-proxy": "iserv-proxy",
+ "nixpkgs": [
+ "haskellNix",
+ "nixpkgs-unstable"
+ ],
+ "nixpkgs-2003": "nixpkgs-2003",
+ "nixpkgs-2105": "nixpkgs-2105",
+ "nixpkgs-2111": "nixpkgs-2111",
+ "nixpkgs-2205": "nixpkgs-2205",
+ "nixpkgs-2211": "nixpkgs-2211",
+ "nixpkgs-unstable": "nixpkgs-unstable",
+ "old-ghc-nix": "old-ghc-nix",
+ "stackage": "stackage",
+ "tullia": "tullia"
+ },
+ "locked": {
+ "lastModified": 1671065520,
+ "narHash": "sha256-Mbcbyx0DKTdzNWmDj17nzfaazL7qg/cNAzJFKZ1i92E=",
+ "owner": "input-output-hk",
+ "repo": "haskell.nix",
+ "rev": "af2c47f5909c5c74c28124f8793539736680d606",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "repo": "haskell.nix",
+ "type": "github"
+ }
+ },
+ "hpc-coveralls": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1607498076,
+ "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=",
+ "owner": "sevanspowell",
+ "repo": "hpc-coveralls",
+ "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430",
+ "type": "github"
+ },
+ "original": {
+ "owner": "sevanspowell",
+ "repo": "hpc-coveralls",
+ "type": "github"
+ }
+ },
+ "hydra": {
+ "inputs": {
+ "nix": "nix",
+ "nixpkgs": [
+ "haskellNix",
+ "hydra",
+ "nix",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1646878427,
+ "narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=",
+ "owner": "NixOS",
+ "repo": "hydra",
+ "rev": "28b682b85b7efc5cf7974065792a1f22203a5927",
+ "type": "github"
+ },
+ "original": {
+ "id": "hydra",
+ "type": "indirect"
+ }
+ },
+ "iserv-proxy": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1639165170,
+ "narHash": "sha256-QsWL/sBDL5GM8IXd/dE/ORiL4RvteEN+aok23tXgAoc=",
+ "rev": "6e95df7be6dd29680f983db07a057fc2f34f81f6",
+ "revCount": 7,
+ "type": "git",
+ "url": "https://gitlab.haskell.org/ghc/iserv-proxy.git"
+ },
+ "original": {
+ "rev": "6e95df7be6dd29680f983db07a057fc2f34f81f6",
+ "type": "git",
+ "url": "https://gitlab.haskell.org/ghc/iserv-proxy.git"
+ }
+ },
+ "lowdown-src": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1633514407,
+ "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
+ "owner": "kristapsdz",
+ "repo": "lowdown",
+ "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "kristapsdz",
+ "repo": "lowdown",
+ "type": "github"
+ }
+ },
+ "mdbook-kroki-preprocessor": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1661755005,
+ "narHash": "sha256-1TJuUzfyMycWlOQH67LR63/ll2GDZz25I3JfScy/Jnw=",
+ "owner": "JoelCourtney",
+ "repo": "mdbook-kroki-preprocessor",
+ "rev": "93adb5716d035829efed27f65f2f0833a7d3e76f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "JoelCourtney",
+ "repo": "mdbook-kroki-preprocessor",
+ "type": "github"
+ }
+ },
+ "n2c": {
+ "inputs": {
+ "flake-utils": "flake-utils_5",
+ "nixpkgs": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1665039323,
+ "narHash": "sha256-SAh3ZjFGsaCI8FRzXQyp56qcGdAqgKEfJWPCQ0Sr7tQ=",
+ "owner": "nlewo",
+ "repo": "nix2container",
+ "rev": "b008fe329ffb59b67bf9e7b08ede6ee792f2741a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nlewo",
+ "repo": "nix2container",
+ "type": "github"
+ }
+ },
+ "nix": {
+ "inputs": {
+ "lowdown-src": "lowdown-src",
+ "nixpkgs": "nixpkgs",
+ "nixpkgs-regression": "nixpkgs-regression"
+ },
+ "locked": {
+ "lastModified": 1643066034,
+ "narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=",
+ "owner": "NixOS",
+ "repo": "nix",
+ "rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "2.6.0",
+ "repo": "nix",
+ "type": "github"
+ }
+ },
+ "nix-nomad": {
+ "inputs": {
+ "flake-compat": "flake-compat_2",
+ "flake-utils": [
+ "haskellNix",
+ "tullia",
+ "nix2container",
+ "flake-utils"
+ ],
+ "gomod2nix": "gomod2nix",
+ "nixpkgs": [
+ "haskellNix",
+ "tullia",
+ "nixpkgs"
+ ],
+ "nixpkgs-lib": [
+ "haskellNix",
+ "tullia",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1658277770,
+ "narHash": "sha256-T/PgG3wUn8Z2rnzfxf2VqlR1CBjInPE0l1yVzXxPnt0=",
+ "owner": "tristanpemble",
+ "repo": "nix-nomad",
+ "rev": "054adcbdd0a836ae1c20951b67ed549131fd2d70",
+ "type": "github"
+ },
+ "original": {
+ "owner": "tristanpemble",
+ "repo": "nix-nomad",
+ "type": "github"
+ }
+ },
+ "nix2container": {
+ "inputs": {
+ "flake-utils": "flake-utils_3",
+ "nixpkgs": "nixpkgs_3"
+ },
+ "locked": {
+ "lastModified": 1658567952,
+ "narHash": "sha256-XZ4ETYAMU7XcpEeAFP3NOl9yDXNuZAen/aIJ84G+VgA=",
+ "owner": "nlewo",
+ "repo": "nix2container",
+ "rev": "60bb43d405991c1378baf15a40b5811a53e32ffa",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nlewo",
+ "repo": "nix2container",
+ "type": "github"
+ }
+ },
+ "nixago": {
+ "inputs": {
+ "flake-utils": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "flake-utils"
+ ],
+ "nixago-exts": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "blank"
+ ],
+ "nixpkgs": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1661824785,
+ "narHash": "sha256-/PnwdWoO/JugJZHtDUioQp3uRiWeXHUdgvoyNbXesz8=",
+ "owner": "nix-community",
+ "repo": "nixago",
+ "rev": "8c1f9e5f1578d4b2ea989f618588d62a335083c3",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "nixago",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1632864508,
+ "narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "82891b5e2c2359d7e58d08849e4c89511ab94234",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "ref": "nixos-21.05-small",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs-2003": {
+ "locked": {
+ "lastModified": 1620055814,
+ "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-20.03-darwin",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-2105": {
+ "locked": {
+ "lastModified": 1659914493,
+ "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-21.05-darwin",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-2111": {
+ "locked": {
+ "lastModified": 1659446231,
+ "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-21.11-darwin",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-2205": {
+ "locked": {
+ "lastModified": 1663981975,
+ "narHash": "sha256-TKaxWAVJR+a5JJauKZqibmaM5e/Pi5tBDx9s8fl/kSE=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "309faedb8338d3ae8ad8f1043b3ccf48c9cc2970",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-22.05-darwin",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-2211": {
+ "locked": {
+ "lastModified": 1669997163,
+ "narHash": "sha256-vhjC0kZMFoN6jzK0GR+tBzKi5KgBXgehadfidW8+Va4=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "6f87491a54d8d64d30af6663cb3bf5d2ee7db958",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-22.11-darwin",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-regression": {
+ "locked": {
+ "lastModified": 1643052045,
+ "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs-unstable": {
+ "locked": {
+ "lastModified": 1663905476,
+ "narHash": "sha256-0CSwRKaYravh9v6qSlBpM0gNg0UhKT2lL7Yn6Zbx7UM=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "e14f9fb57315f0d4abde222364f19f88c77d2b79",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1653581809,
+ "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_3": {
+ "locked": {
+ "lastModified": 1654807842,
+ "narHash": "sha256-ADymZpr6LuTEBXcy6RtFHcUZdjKTBRTMYwu19WOx17E=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "fc909087cc3386955f21b4665731dbdaceefb1d8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_4": {
+ "locked": {
+ "lastModified": 1665087388,
+ "narHash": "sha256-FZFPuW9NWHJteATOf79rZfwfRn5fE0wi9kRzvGfDHPA=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "95fda953f6db2e9496d2682c4fc7b82f959878f7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "old-ghc-nix": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1631092763,
+ "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=",
+ "owner": "angerman",
+ "repo": "old-ghc-nix",
+ "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "angerman",
+ "ref": "master",
+ "repo": "old-ghc-nix",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "haskellNix": "haskellNix",
+ "nixpkgs": [
+ "haskellNix",
+ "nixpkgs-unstable"
+ ]
+ }
+ },
+ "stackage": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1670890221,
+ "narHash": "sha256-kV7irjUr4Ot3b2MwTcgVKYuEe+legxhGh4ApBeESy1s=",
+ "owner": "input-output-hk",
+ "repo": "stackage.nix",
+ "rev": "56f59c2d4ecdb237348a0774274f38874f81a3ca",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "repo": "stackage.nix",
+ "type": "github"
+ }
+ },
+ "std": {
+ "inputs": {
+ "blank": "blank",
+ "devshell": "devshell",
+ "dmerge": "dmerge",
+ "flake-utils": "flake-utils_4",
+ "makes": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "blank"
+ ],
+ "mdbook-kroki-preprocessor": "mdbook-kroki-preprocessor",
+ "microvm": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "blank"
+ ],
+ "n2c": "n2c",
+ "nixago": "nixago",
+ "nixpkgs": "nixpkgs_4",
+ "yants": "yants"
+ },
+ "locked": {
+ "lastModified": 1665513321,
+ "narHash": "sha256-D6Pacw9yf/HMs84KYuCxHXnNDL7v43gtcka5URagFqE=",
+ "owner": "divnix",
+ "repo": "std",
+ "rev": "94a90eedb9cfc115b12ae8f6622d9904788559e4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "divnix",
+ "repo": "std",
+ "type": "github"
+ }
+ },
+ "tullia": {
+ "inputs": {
+ "nix-nomad": "nix-nomad",
+ "nix2container": "nix2container",
+ "nixpkgs": [
+ "haskellNix",
+ "nixpkgs"
+ ],
+ "std": "std"
+ },
+ "locked": {
+ "lastModified": 1668711738,
+ "narHash": "sha256-CBjky16o9pqsGE1bWu6nRlRajgSXMEk+yaFQLibqXcE=",
+ "owner": "input-output-hk",
+ "repo": "tullia",
+ "rev": "ead1f515c251f0e060060ef0e2356a51d3dfe4b0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "input-output-hk",
+ "repo": "tullia",
+ "type": "github"
+ }
+ },
+ "utils": {
+ "locked": {
+ "lastModified": 1653893745,
+ "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "yants": {
+ "inputs": {
+ "nixpkgs": [
+ "haskellNix",
+ "tullia",
+ "std",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1660507851,
+ "narHash": "sha256-BKjq7JnVuUR/xDtcv6Vm9GYGKAblisXrAgybor9hT/s=",
+ "owner": "divnix",
+ "repo": "yants",
+ "rev": "0b895ca02a8fa72bad50b454cb3e7d8a66407c96",
+ "type": "github"
+ },
+ "original": {
+ "owner": "divnix",
+ "repo": "yants",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..90d4b35
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,39 @@
+{
+ nixConfig = {
+ extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
+ extra-substituters = ["https://cache.iog.io"];
+ };
+ description = "Bayesian phylogentic playground";
+ inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
+ inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
+ inputs.flake-utils.url = "github:numtide/flake-utils";
+ outputs = {
+ self,
+ nixpkgs,
+ flake-utils,
+ haskellNix,
+ }:
+ flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
+ overlays = [
+ haskellNix.overlay
+ (final: prev: {
+ phylogenies = final.haskell-nix.project' {
+ src = ./.;
+ compiler-nix-name = "ghc925";
+ shell.tools = {
+ hlint = {};
+ ormolu = {};
+ };
+ shell.buildInputs = with pkgs; [
+ ];
+ };
+ })
+ ];
+ pkgs = import nixpkgs {
+ inherit system overlays;
+ inherit (haskellNix) config;
+ };
+ flake = pkgs.phylogenies.flake {};
+ in
+ flake // { packages.default = flake.packages."phylogenies:exe:phylogenies";});
+}
diff --git a/package.yaml b/package.yaml
new file mode 100644
index 0000000..4d96c25
--- /dev/null
+++ b/package.yaml
@@ -0,0 +1,17 @@
+name: phylogenies
+version: 0.0.1
+synopsis: phylogeny playground
+maintainer: Justin Bedo <cu@cua0.org>
+license: MIT
+
+executable:
+ main: cluster.hs
+ source-dirs: bin
+ ghc-options: [-rtsopts]
+ dependencies:
+ - base >= 4.9 && < 5
+ - ppl
+ - containers
+ - log-domain
+ - vector
+ - random
diff --git a/phylogenies.cabal b/phylogenies.cabal
new file mode 100644
index 0000000..15db8d9
--- /dev/null
+++ b/phylogenies.cabal
@@ -0,0 +1,28 @@
+cabal-version: 1.12
+
+-- This file has been generated from package.yaml by hpack version 0.34.7.
+--
+-- see: https://github.com/sol/hpack
+
+name: phylogenies
+version: 0.0.1
+synopsis: phylogeny playground
+maintainer: Justin Bedo <cu@cua0.org>
+license: MIT
+build-type: Simple
+
+executable phylogenies
+ main-is: cluster.hs
+ other-modules:
+ Paths_phylogenies
+ hs-source-dirs:
+ bin
+ ghc-options: -rtsopts
+ build-depends:
+ base >=4.9 && <5
+ , containers
+ , log-domain
+ , ppl
+ , random
+ , vector
+ default-language: Haskell2010