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

Update update_yaml_config_with_taxid Function to Support Nested Configurations #32

Closed druvus closed 1 year ago

druvus commented 1 year ago

Description:

This PR addresses the issue with the update_yaml_config_with_taxid function, which was initially unable to update YAML files having nested configurations. The modified function now accurately targets the species_of_interest section within the YAML file to update the taxid field. The changes made are in line with our code principles, focusing on readability, DRY, and performance.

Changes:

  1. Added a check for the existence of 'Species' and 'Tax_ID' columns in the DataFrame to avoid unexpected behavior.
  2. Changed the function to directly target the species_of_interest section in the YAML file.
  3. Wrapped YAML read and write operations in try-except blocks for robust error handling.
  4. Implemented logging to provide detailed information on the function's execution.