Package op

Class StorageFactory

java.lang.Object
op.StorageFactory

public class StorageFactory extends Object
Factory class for creating and loading Storage objects.
  • Method Details

    • fromPath

      public static Storage fromPath(Path path) throws IOException
      Reads a Storage object from the specified file path.

      This method validates the file, determines if it is GZIP-compressed based on its extension, and reads its contents. The contents are then deserialized into a Storage object using Gson.

      Parameters:
      path - The Path to the file containing the serialized Storage object.
      Returns:
      The deserialized Storage object.
      Throws:
      IOException - If the file cannot be read or deserialized.
    • fromCli

      public static Storage fromCli(CLIBuild cli) throws IOException
      Constructs a Storage object from definitions in CLIBuild.

      This method initializes a Storage object using parameters provided via the CLIBuild instance. It sets up the storage parameters, optionally populates contigs from a reference, and loads features and sample information from the CLI parameters.

      Parameters:
      cli - The CLIBuild instance containing the parameters and definitions for constructing the Storage object.
      Returns:
      A Storage object representing the loaded data.
      Throws:
      IOException - If an error occurs while reading files or parsing data.