Package cli

Class CLIExpand

java.lang.Object
cli.CLIExpand
All Implemented Interfaces:
CLI

public class CLIExpand extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    final 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.
    final List<Path>
    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

    Constructors
    Constructor
    Description
    CLIExpand(org.apache.commons.cli.CommandLine arguments)
    Constructs a CLIExpand instance by parsing and initializing the command-line arguments.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.commons.cli.Options
    Defines the command-line options for the expand task.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • input

      public final Path input
      The path to the input storage file.
    • output

      public final Path output
      The path to the output storage file. If null, the input file will be overwritten.
    • overwrite

      public final boolean overwrite
      Indicates whether to overwrite the input file. This is true if output is null and dry-run mode is not enabled.
    • vcfFiles

      public final List<Path> vcfFiles
      The list of VCF file paths to expand the storage with.
    • vcfMeta

      public final Map<String,Map<String,String>> 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 dry
      Indicates whether dry-run mode is enabled. If true, no output will be written.
  • Constructor Details

    • CLIExpand

      public CLIExpand(org.apache.commons.cli.CommandLine arguments) throws MusialException, IOException
      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 - The CommandLine 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.
  • Method Details

    • options

      public static org.apache.commons.cli.Options options()
      Defines the command-line options for the expand 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.