{-# LANGUAGE DeriveGeneric #-}
module TLynx.Options (CommandArguments (..)) where
import Data.Aeson
import ELynx.Tools.Options
import ELynx.Tools.Reproduction
import GHC.Generics
import Options.Applicative
import TLynx.Compare.Options
import TLynx.Connect.Options
import TLynx.Distance.Options
import TLynx.Examine.Options
import TLynx.Parsers (newickHelp)
import TLynx.Shuffle.Options
import TLynx.Simulate.Options
data CommandArguments
= Compare CompareArguments
| Connect ConnectArguments
| Distance DistanceArguments
| Examine ExamineArguments
| Shuffle ShuffleArguments
| Simulate SimulateArguments
deriving (CommandArguments -> CommandArguments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandArguments -> CommandArguments -> Bool
$c/= :: CommandArguments -> CommandArguments -> Bool
== :: CommandArguments -> CommandArguments -> Bool
$c== :: CommandArguments -> CommandArguments -> Bool
Eq, Int -> CommandArguments -> ShowS
[CommandArguments] -> ShowS
CommandArguments -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandArguments] -> ShowS
$cshowList :: [CommandArguments] -> ShowS
show :: CommandArguments -> String
$cshow :: CommandArguments -> String
showsPrec :: Int -> CommandArguments -> ShowS
$cshowsPrec :: Int -> CommandArguments -> ShowS
Show, forall x. Rep CommandArguments x -> CommandArguments
forall x. CommandArguments -> Rep CommandArguments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CommandArguments x -> CommandArguments
$cfrom :: forall x. CommandArguments -> Rep CommandArguments x
Generic)
instance Reproducible CommandArguments where
inFiles :: CommandArguments -> [String]
inFiles (Compare CompareArguments
a) = forall a. Reproducible a => a -> [String]
inFiles CompareArguments
a
inFiles (Connect ConnectArguments
a) = forall a. Reproducible a => a -> [String]
inFiles ConnectArguments
a
inFiles (Distance DistanceArguments
a) = forall a. Reproducible a => a -> [String]
inFiles DistanceArguments
a
inFiles (Examine ExamineArguments
a) = forall a. Reproducible a => a -> [String]
inFiles ExamineArguments
a
inFiles (Shuffle ShuffleArguments
a) = forall a. Reproducible a => a -> [String]
inFiles ShuffleArguments
a
inFiles (Simulate SimulateArguments
a) = forall a. Reproducible a => a -> [String]
inFiles SimulateArguments
a
outSuffixes :: CommandArguments -> [String]
outSuffixes (Compare CompareArguments
a) = forall a. Reproducible a => a -> [String]
outSuffixes CompareArguments
a
outSuffixes (Connect ConnectArguments
a) = forall a. Reproducible a => a -> [String]
outSuffixes ConnectArguments
a
outSuffixes (Distance DistanceArguments
a) = forall a. Reproducible a => a -> [String]
outSuffixes DistanceArguments
a
outSuffixes (Examine ExamineArguments
a) = forall a. Reproducible a => a -> [String]
outSuffixes ExamineArguments
a
outSuffixes (Shuffle ShuffleArguments
a) = forall a. Reproducible a => a -> [String]
outSuffixes ShuffleArguments
a
outSuffixes (Simulate SimulateArguments
a) = forall a. Reproducible a => a -> [String]
outSuffixes SimulateArguments
a
getSeed :: CommandArguments -> Maybe SeedOpt
getSeed (Compare CompareArguments
a) = forall a. Reproducible a => a -> Maybe SeedOpt
getSeed CompareArguments
a
getSeed (Connect ConnectArguments
a) = forall a. Reproducible a => a -> Maybe SeedOpt
getSeed ConnectArguments
a
getSeed (Distance DistanceArguments
a) = forall a. Reproducible a => a -> Maybe SeedOpt
getSeed DistanceArguments
a
getSeed (Examine ExamineArguments
a) = forall a. Reproducible a => a -> Maybe SeedOpt
getSeed ExamineArguments
a
getSeed (Shuffle ShuffleArguments
a) = forall a. Reproducible a => a -> Maybe SeedOpt
getSeed ShuffleArguments
a
getSeed (Simulate SimulateArguments
a) = forall a. Reproducible a => a -> Maybe SeedOpt
getSeed SimulateArguments
a
setSeed :: CommandArguments -> SeedOpt -> CommandArguments
setSeed (Compare CompareArguments
a) = CompareArguments -> CommandArguments
Compare forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Reproducible a => a -> SeedOpt -> a
setSeed CompareArguments
a
setSeed (Connect ConnectArguments
a) = ConnectArguments -> CommandArguments
Connect forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Reproducible a => a -> SeedOpt -> a
setSeed ConnectArguments
a
setSeed (Distance DistanceArguments
a) = DistanceArguments -> CommandArguments
Distance forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Reproducible a => a -> SeedOpt -> a
setSeed DistanceArguments
a
setSeed (Examine ExamineArguments
a) = ExamineArguments -> CommandArguments
Examine forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Reproducible a => a -> SeedOpt -> a
setSeed ExamineArguments
a
setSeed (Shuffle ShuffleArguments
a) = ShuffleArguments -> CommandArguments
Shuffle forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Reproducible a => a -> SeedOpt -> a
setSeed ShuffleArguments
a
setSeed (Simulate SimulateArguments
a) = SimulateArguments -> CommandArguments
Simulate forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Reproducible a => a -> SeedOpt -> a
setSeed SimulateArguments
a
parser :: Parser CommandArguments
parser = Parser CommandArguments
commandArguments
cmdName :: String
cmdName = String
"tlynx"
cmdDsc :: [String]
cmdDsc = [String
"Compare, examine, and simulate phylogenetic trees."]
cmdFtr :: [String]
cmdFtr = String
"" forall a. a -> [a] -> [a]
: String
"Available tree file formats:" forall a. a -> [a] -> [a]
: [String] -> [String]
indent [String]
newickHelp
where
indent :: [String] -> [String]
indent = forall a b. (a -> b) -> [a] -> [b]
map (String
" " forall a. [a] -> [a] -> [a]
++)
instance FromJSON CommandArguments
instance ToJSON CommandArguments
compareCommand :: Mod CommandFields CommandArguments
compareCommand :: Mod CommandFields CommandArguments
compareCommand = forall a b. Reproducible a => (a -> b) -> Mod CommandFields b
createCommandReproducible CompareArguments -> CommandArguments
Compare
connectCommand :: Mod CommandFields CommandArguments
connectCommand :: Mod CommandFields CommandArguments
connectCommand = forall a b. Reproducible a => (a -> b) -> Mod CommandFields b
createCommandReproducible ConnectArguments -> CommandArguments
Connect
distanceCommand :: Mod CommandFields CommandArguments
distanceCommand :: Mod CommandFields CommandArguments
distanceCommand = forall a b. Reproducible a => (a -> b) -> Mod CommandFields b
createCommandReproducible DistanceArguments -> CommandArguments
Distance
examineCommand :: Mod CommandFields CommandArguments
examineCommand :: Mod CommandFields CommandArguments
examineCommand = forall a b. Reproducible a => (a -> b) -> Mod CommandFields b
createCommandReproducible ExamineArguments -> CommandArguments
Examine
shuffleCommand :: Mod CommandFields CommandArguments
shuffleCommand :: Mod CommandFields CommandArguments
shuffleCommand = forall a b. Reproducible a => (a -> b) -> Mod CommandFields b
createCommandReproducible ShuffleArguments -> CommandArguments
Shuffle
simulateCommand :: Mod CommandFields CommandArguments
simulateCommand :: Mod CommandFields CommandArguments
simulateCommand = forall a b. Reproducible a => (a -> b) -> Mod CommandFields b
createCommandReproducible SimulateArguments -> CommandArguments
Simulate
commandArguments :: Parser CommandArguments
commandArguments :: Parser CommandArguments
commandArguments =
forall a. Mod CommandFields a -> Parser a
hsubparser forall a b. (a -> b) -> a -> b
$
Mod CommandFields CommandArguments
compareCommand
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields CommandArguments
connectCommand
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields CommandArguments
distanceCommand
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields CommandArguments
examineCommand
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields CommandArguments
shuffleCommand
forall a. Semigroup a => a -> a -> a
<> Mod CommandFields CommandArguments
simulateCommand