Skip to content

Commit

Permalink
added option to add branchnames to the prob command
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Schiffels committed Sep 16, 2016
1 parent 70c8096 commit 08d66b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/rarecoal.tex
Expand Up @@ -8,6 +8,8 @@
\date{}
\maketitle

\section{Introduction}
Rarecoal is a method to estimate a population history model, parameterized by population splits, population sizes and admixture edges, from the joint rare site frequency spectrum.

\section{The rarecoal coalescent framework}
This model describes a coalescent framework for rare alleles. We define rare alleles roughly by requiring i) the allele count of the derived mutation to be small, typically not larger than 10, and ii) the total number of samples to be much larger, say 100 or more. The idea is to provide a general approach of computing the joint allele frequency spectrum for rare alleles under an arbitrary demographic model under population splits and population size changes. Migration and admixture will be incorporated in the future.
Expand Down
3 changes: 2 additions & 1 deletion src-rarecoal/Main.hs
Expand Up @@ -67,7 +67,7 @@ parseProb :: OP.Parser Command
parseProb = CmdProb <$> parseProbOpt

parseProbOpt :: OP.Parser ProbOpt
parseProbOpt = ProbOpt <$> parseTheta <*> parseModelDesc <*> parseLinGen <*> parseNVec <*> parseKVec
parseProbOpt = ProbOpt <$> parseTheta <*> parseModelDesc <*> parseLinGen <*> parseBranchnames <*> parseNVec <*> parseKVec
where
parseNVec = OP.argument OP.auto (OP.metavar "[N1,N2,...]" <> OP.help "number of samples, \
\comma-separated, without spaces, and surrounded by square brackets, e.g. \
Expand All @@ -76,6 +76,7 @@ parseProbOpt = ProbOpt <$> parseTheta <*> parseModelDesc <*> parseLinGen <*> par
\alleles in each population, same format as for NVec, e.g. [1,2] for allele \
\count 3 shared with one sample from the first and two from the second \
\population.")
parseBranchnames = OP.option (splitOn "," <$> OP.str) (OP.help "string of branch names" <> OP.long "branchnames" <> OP.metavar "Pop1,Pop2,...")

parseTheta :: OP.Parser Double
parseTheta = OP.option OP.auto $ OP.short 't' <> OP.long "theta" <> OP.hidden <> OP.metavar "FLOAT"
Expand Down
3 changes: 2 additions & 1 deletion src-rarecoal/Prob.hs
Expand Up @@ -9,12 +9,13 @@ data ProbOpt = ProbOpt {
prTheta :: Double,
prModelDesc :: ModelDesc,
prLinGen :: Int,
prBranchnames :: [String],
prNvec :: [Int],
prKvec :: [Int]
}

runProb :: ProbOpt -> Script ()
runProb opts = do
modelSpec <- getModelSpec (prModelDesc opts) [] (prTheta opts) (prLinGen opts)
modelSpec <- getModelSpec (prModelDesc opts) (prBranchnames opts) (prTheta opts) (prLinGen opts)
val <- tryRight $ getProb modelSpec (prNvec opts) False (prKvec opts)
scriptIO $ print val

0 comments on commit 08d66b2

Please sign in to comment.