FOI-Bioinformatics / nanometa_live

A streamlined workflow and GUI for real-time species identification and pathogen characterization via nanopore sequencing data. Engineered for precision, speed, and user-friendliness, with offline functionality post-initialization.
GNU General Public License v3.0
15 stars 2 forks source link

Improved Configuration Loading and Error Handling in nanometa_live Backend #37

Closed druvus closed 1 year ago

druvus commented 1 year ago

Description:

This pull request introduces several updates to the nanometa_backend.py script in the nanometa_live package. The primary changes focus on enhancing the configuration file loading mechanism and adding robust error handling. Below are the key changes:

Changes:

  1. Switch to ruamel.yaml: The code now uses the ruamel.yaml library instead of the pyyaml library for loading YAML configuration files. This change offers better compatibility and control over YAML parsing.

  2. Type Annotations: Added type annotations to the load_config function to improve code readability and type checking.

  3. Improved Error Handling: The load_config function now has robust error handling to catch and log specific exceptions like FileNotFoundError and PermissionError. This will aid in debugging configuration issues.

  4. Logging Enhancements: Improved the logging messages for better clarity on the configuration file loading process.

Impact:

  1. These changes make the code more robust against possible errors related to configuration files.
  2. Improved logging will assist in troubleshooting.
  3. The code is now more readable, thanks to type annotations and improved function signatures.