{-# LANGUAGE DeriveGeneric #-}
module TLynx.Compare.Options
( CompareArguments (..),
compareArguments,
)
where
import Data.Aeson
import ELynx.Tools.Reproduction
import GHC.Generics
import Options.Applicative
import TLynx.Parsers
data CompareArguments = CompareArguments
{ CompareArguments -> Bool
argsNormalize :: Bool,
CompareArguments -> Bool
argsBipartitions :: Bool,
CompareArguments -> Bool
argsIntersect :: Bool,
CompareArguments -> NewickFormat
argsNewickFormat :: NewickFormat,
CompareArguments -> [FilePath]
argsInFiles :: [FilePath]
}
deriving (CompareArguments -> CompareArguments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompareArguments -> CompareArguments -> Bool
$c/= :: CompareArguments -> CompareArguments -> Bool
== :: CompareArguments -> CompareArguments -> Bool
$c== :: CompareArguments -> CompareArguments -> Bool
Eq, Int -> CompareArguments -> ShowS
[CompareArguments] -> ShowS
CompareArguments -> FilePath
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
showList :: [CompareArguments] -> ShowS
$cshowList :: [CompareArguments] -> ShowS
show :: CompareArguments -> FilePath
$cshow :: CompareArguments -> FilePath
showsPrec :: Int -> CompareArguments -> ShowS
$cshowsPrec :: Int -> CompareArguments -> ShowS
Show, forall x. Rep CompareArguments x -> CompareArguments
forall x. CompareArguments -> Rep CompareArguments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompareArguments x -> CompareArguments
$cfrom :: forall x. CompareArguments -> Rep CompareArguments x
Generic)
instance Reproducible CompareArguments where
inFiles :: CompareArguments -> [FilePath]
inFiles = CompareArguments -> [FilePath]
argsInFiles
outSuffixes :: CompareArguments -> [FilePath]
outSuffixes CompareArguments
_ = [FilePath
".out"]
getSeed :: CompareArguments -> Maybe SeedOpt
getSeed CompareArguments
_ = forall a. Maybe a
Nothing
setSeed :: CompareArguments -> SeedOpt -> CompareArguments
setSeed CompareArguments
a SeedOpt
_ = CompareArguments
a
parser :: Parser CompareArguments
parser = Parser CompareArguments
compareArguments
cmdName :: FilePath
cmdName = FilePath
"compare"
cmdDsc :: [FilePath]
cmdDsc =
[ FilePath
"Compare two phylogenetic trees (compute distances and branch-wise differences)."
]
instance FromJSON CompareArguments
instance ToJSON CompareArguments
compareArguments :: Parser CompareArguments
compareArguments :: Parser CompareArguments
compareArguments =
Bool
-> Bool -> Bool -> NewickFormat -> [FilePath] -> CompareArguments
CompareArguments
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Bool
normalize
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
bipartitions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
intersect
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser NewickFormat
newickFormat
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [FilePath]
file
normalize :: Parser Bool
normalize :: Parser Bool
normalize =
Mod FlagFields Bool -> Parser Bool
switch forall a b. (a -> b) -> a -> b
$
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
long FilePath
"normalize"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. HasName f => Char -> Mod f a
short Char
'n'
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. FilePath -> Mod f a
help
FilePath
"Normalize trees before comparison"
bipartitions :: Parser Bool
bipartitions :: Parser Bool
bipartitions =
Mod FlagFields Bool -> Parser Bool
switch forall a b. (a -> b) -> a -> b
$
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
long FilePath
"bipartitions"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. HasName f => Char -> Mod f a
short Char
'b'
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. FilePath -> Mod f a
help
FilePath
"Print and plot common and missing bipartitions"
intersect :: Parser Bool
intersect :: Parser Bool
intersect =
Mod FlagFields Bool -> Parser Bool
switch forall a b. (a -> b) -> a -> b
$
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
long FilePath
"intersect"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. HasName f => Char -> Mod f a
short Char
't'
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. FilePath -> Mod f a
help
FilePath
"Compare intersections; i.e., before comparison, drop leaves that are not present in the other tree"
file :: Parser [FilePath]
file :: Parser [FilePath]
file = forall (f :: * -> *) a. Alternative f => f a -> f [a]
some forall a b. (a -> b) -> a -> b
$ forall s. IsString s => Mod ArgumentFields s -> Parser s
strArgument forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
metavar FilePath
"NAMES" forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. FilePath -> Mod f a
help FilePath
"Tree files" forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. HasCompleter f => FilePath -> Mod f a
action FilePath
"file"