{-# LANGUAGE DeriveGeneric #-}
module TLynx.Connect.Options
( ConnectArguments (..),
connectArguments,
)
where
import ELynx.Tools
import Options.Applicative
import TLynx.Parsers
data ConnectArguments = ConnectArguments
{ nwFormat :: NewickFormat,
constraints :: Maybe FilePath,
inFileA :: FilePath,
inFileB :: FilePath
}
deriving (Eq, Show, Generic)
instance Reproducible ConnectArguments where
inFiles a = [inFileA a, inFileB a]
outSuffixes _ = [".out"]
getSeed _ = Nothing
setSeed a _ = a
parser = connectArguments
cmdName = "connect"
cmdDsc =
[ "Connect two phylogenetic trees in all ways (possibly honoring constraints)."
]
instance FromJSON ConnectArguments
instance ToJSON ConnectArguments
connectArguments :: Parser ConnectArguments
connectArguments =
ConnectArguments <$> newickFormat <*> constraintsFile <*> fileA <*> fileB
constraintsFile :: Parser (Maybe FilePath)
constraintsFile =
optional $
strOption $
metavar "CONSTRAINTS"
<> short 'c'
<> long "contraints"
<> help "File containing one or more Newick trees to be used as constraints"
fileA :: Parser FilePath
fileA =
strArgument $
metavar "TREE-FILE-A"
<> help
"File containing the first Newick tree"
fileB :: Parser FilePath
fileB =
strArgument $
metavar "TREE-FILE-B"
<> help
"File containing the second Newick tree"