From 913b6a0952fded67d7e07372dac6c30891f0f5af Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:41:05 +0100 Subject: [PATCH 1/4] log whole environment --- alphadia/planning.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/alphadia/planning.py b/alphadia/planning.py index c8dc429f..8bc1370c 100644 --- a/alphadia/planning.py +++ b/alphadia/planning.py @@ -3,6 +3,7 @@ import os import socket from datetime import datetime +from importlib import metadata from pathlib import Path import alphabase @@ -166,6 +167,14 @@ def log_environment(self): logger.progress(f"{'directlfq':<15} : {directlfq.__version__}") logger.progress("===================================================") + logger.progress("================= Pip Environment =================") + pip_env = [ + f"{dist.metadata['Name']}=={dist.version}" + for dist in metadata.distributions() + ] + logger.progress(" ".join(pip_env)) + logger.progress("===================================================") + def init_alphabase(self): """Init alphabase by registering custom modifications.""" From 527fc84af79c8d0dffd3f62cb9c02ae893e06c7a Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:41:44 +0100 Subject: [PATCH 2/4] remove obsolete property and setter for raw_path_list --- alphadia/planning.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/alphadia/planning.py b/alphadia/planning.py index 8bc1370c..40f0513d 100644 --- a/alphadia/planning.py +++ b/alphadia/planning.py @@ -131,15 +131,6 @@ def __init__( torch.set_num_threads(self.config["general"]["thread_count"]) - @property - def raw_path_list(self) -> list[str]: - """List of input files locations.""" - return self._raw_path_list - - @raw_path_list.setter - def raw_path_list(self, raw_path_list: list[str]): - self._raw_path_list = raw_path_list - @property def config(self) -> Config: """Dict with all configuration parameters for the extraction.""" From 0c970a9703ed10a16b798c5d93782795e6da2ef0 Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:42:09 +0100 Subject: [PATCH 3/4] docstrings --- alphadia/planning.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/alphadia/planning.py b/alphadia/planning.py index 40f0513d..ab1d1574 100644 --- a/alphadia/planning.py +++ b/alphadia/planning.py @@ -49,16 +49,23 @@ def __init__( Parameters ---------- - raw_data : list + + output_folder : str + output folder to save the results + + raw_path_list : list list of input file locations - config_path : str, optional - yaml file containing the default config. + library_path : str, optional + path to the spectral library file. If not provided, the library is built from fasta files - config_update_path : str, optional - yaml file to update the default config. + fasta_path_list : list, optional + list of fasta file locations to build the library from + + config_base_path : str, optional + yaml file containing the default config. - config_update : dict, optional + config : dict, optional dict to update the default config. Can be used for debugging purposes etc. quant_path : str, optional @@ -97,7 +104,7 @@ def __init__( # print environment self.log_environment() - # 1. default config path is not defined in the function definition to account for for different path separators on different OS + # 1. default config path is not defined in the function definition to account for different path separators on different OS if config_base_path is None: # default yaml config location under /misc/config/config.yaml config_base_path = os.path.join( @@ -114,7 +121,7 @@ def __init__( update_config = Config("user defined") update_config.from_dict(config) else: - update_config = config + update_config = config # TODO what is it in this case? self.config.update([update_config], print_modifications=True) @@ -150,7 +157,7 @@ def spectral_library(self, spectral_library: SpecLibFlat) -> None: self._spectral_library = spectral_library def log_environment(self): - logger.progress("=================== Environment ===================") + logger.progress("================ AlphaX Environment ===============") logger.progress(f"{'alphatims':<15} : {alphatims.__version__:}") logger.progress(f"{'alpharaw':<15} : {alpharaw.__version__}") logger.progress(f"{'alphabase':<15} : {alphabase.__version__}") From c0d7a8ddcec2d0e91e39af5d653ba7360df88e7c Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:42:25 +0100 Subject: [PATCH 4/4] make speclib file removal safe --- alphadia/planning.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alphadia/planning.py b/alphadia/planning.py index ab1d1574..cd34dd39 100644 --- a/alphadia/planning.py +++ b/alphadia/planning.py @@ -400,7 +400,10 @@ def run( def clean(self): if not self.config["general"]["save_library"]: - os.remove(os.path.join(self.output_folder, "speclib.hdf")) + try: + os.remove(os.path.join(self.output_folder, "speclib.hdf")) + except Exception as e: + logger.exception(f"Error deleting library: {e}") def _log_exception_event(