The initialize.py script is designed to manage the installation and querying of Hidden Markov Model (HMM) databases. It provides utilities for configuring the installation directory, downloading databases, and listing available and installed databases.
- Purpose: Loads or initializes the configuration JSON file (
astra_config.json). - Behavior:
- If the configuration file doesn't exist, it creates one with default settings.
- If a custom path is provided by the user, validates and saves it.
- Output: Returns a dictionary containing the configuration settings.
- Purpose: Loads the
hmm_databases.jsonfile. - Behavior: If the file doesn't exist in the specified directory, it copies the file from the package directory.
- Output: Returns a dictionary containing the database information.
- Purpose: Installs the specified HMM database.
- Parameters:
parsed_json: The content ofhmm_databases.jsonas a dictionary.db_name: The name of the database to install.db_path: The directory to install the database into.
- Behavior:
- Downloads and extracts the database files.
- Updates the
installedandinstallation_dirfields inhmm_databases.json.
- Purpose: Lists the available databases that are not yet installed.
- Parameters:
parsed_json: The content ofhmm_databases.jsonas a dictionary.
- Output: Prints the list of available databases to the console.
- Purpose: Lists the databases that are installed.
- Parameters:
parsed_json: The content ofhmm_databases.jsonas a dictionary.
- Output: Prints the list of installed databases to the console.
- Run
load_config()to set up or load the configuration file. - Run
load_json()to prepare the databases JSON file. - Use
install_databases()to install the desired databases. - Utilize
show_available_databases()andshow_installed_databases()to view database status.
If you want to customize the database installation directory, modify the db_path field in astra_config.json.