Package cli
Class CLIExpand
java.lang.Object
cli.CLIExpand
- All Implemented Interfaces:
CLI
Handles the
expand
task CLI parameters.
This class defines the command-line options and validation logic for the expand
task. See options()
for details.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal boolean
Indicates whether dry-run mode is enabled.final Path
The path to the input storage file.final Path
The path to the output storage file.final boolean
Indicates whether to overwrite the input file.The list of VCF file paths to expand the storage with.A map containing the VCF metadata, with the sample ID as the key and another map of metadata attributes and their values as the -
Constructor Summary
ConstructorsConstructorDescriptionCLIExpand
(org.apache.commons.cli.CommandLine arguments) Constructs a CLIExpand instance by parsing and initializing the command-line arguments. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.commons.cli.Options
options()
Defines the command-line options for theexpand
task.
-
Field Details
-
input
The path to the input storage file. -
output
The path to the output storage file. Ifnull
, the input file will be overwritten. -
overwrite
public final boolean overwriteIndicates whether to overwrite the input file. This istrue
ifoutput
isnull
and dry-run mode is not enabled. -
vcfFiles
The list of VCF file paths to expand the storage with. -
vcfMeta
A map containing the VCF metadata, with the sample ID as the key and another map of metadata attributes and their values as the -
dry
public final boolean dryIndicates whether dry-run mode is enabled. Iftrue
, no output will be written.
-
-
Constructor Details
-
CLIExpand
Constructs a CLIExpand instance by parsing and initializing the command-line arguments.This constructor processes the provided
CommandLine
arguments to extract and validate the parameters required for the `expand` task. It initializes fields such as the input storage path, output path, VCF files, VCF metadata, and the dry-run mode flag. Additionally, it determines whether the input storage file should be overwritten based on the presence of the output path and the dry-run mode.The method performs the following steps:
- Parses the input storage file path using
Common.parseInputStorageFile(CommandLine)
. - Parses the output file path using
parseOutput(CommandLine)
. - Parses the list of VCF files using
parseVcfFiles(CommandLine)
. - Parses the VCF metadata using
parseVcfMeta(CommandLine)
. - Checks if the dry-run mode is enabled and sets the overwrite flag accordingly.
If any required parameter is missing or invalid, appropriate exceptions are thrown.
- Parameters:
arguments
- TheCommandLine
object containing the parsed command-line arguments.- Throws:
MusialException
- If any required parameter is missing or invalid.IOException
- If an I/O error occurs during file validation or parsing.
- Parses the input storage file path using
-
-
Method Details
-
options
public static org.apache.commons.cli.Options options()Defines the command-line options for theexpand
task.The options include:
- -I, --storage: Specifies the path to a `.json` or `.json.gz` file generated by the build task of MUSIAL. This option is required.
- -V, --vcfFiles: Specifies a list of file or directory paths. All files must be in VCF format. This option is required.
- -m, --vcfMeta: Specifies the path to a `.tsv` or `.csv` file containing sample annotations. This option is optional .
- -o, --output: Specifies the path to write the output file. If not provided, the input file will be overwritten. This option is optional.
- -d, --dry-run: Enables dry-run mode, which reports novel entries without writing the updated storage. This option is optional.
- Returns:
- An
Options
object containing the defined command-line options.
-