{-# LANGUAGE DeriveGeneric #-}
module TLynx.Shuffle.Options
( ShuffleArguments (..),
shuffleArguments,
)
where
import ELynx.Tools
import Options.Applicative
import TLynx.Parsers
data ShuffleArguments = ShuffleArguments
{ nwFormat :: NewickFormat,
nReplicates :: Int,
inFile :: FilePath,
argsSeed :: Seed
}
deriving (Eq, Show, Generic)
instance Reproducible ShuffleArguments where
inFiles = pure . inFile
outSuffixes _ = [".tree"]
getSeed = Just . argsSeed
setSeed a s = a {argsSeed = Fixed s}
parser = shuffleArguments
cmdName = "shuffle"
cmdDsc =
[ "Shuffle a phylogenetic tree (keep coalescent times, but shuffle topology and leaves)."
]
instance FromJSON ShuffleArguments
instance ToJSON ShuffleArguments
shuffleArguments :: Parser ShuffleArguments
shuffleArguments = ShuffleArguments <$> newickFormat <*> n <*> file <*> seedOpt
n :: Parser Int
n =
option auto $
long "replicates" <> short 'n' <> metavar "N" <> value 1
<> help
"Number of trees to generate"
file :: Parser FilePath
file =
strArgument $ metavar "TREE-FILE" <> help "File containing a Newick tree"