From ae574bfd3f6d26407cf26f1fc984eaab238bcb0f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 06:52:33 +0000 Subject: [PATCH 1/4] Initial plan From a319a840ce8bcac61c86f7b03ff5a998a22e0e02 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 06:55:42 +0000 Subject: [PATCH 2/4] Replace exit(1) with ModificationNotSupportedError exception Co-authored-by: ypriverol <52113+ypriverol@users.noreply.github.com> --- diann_config.cfg | 1 + quantmsutils/diann/dianncfg.py | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 diann_config.cfg diff --git a/diann_config.cfg b/diann_config.cfg new file mode 100644 index 0000000..afcb43c --- /dev/null +++ b/diann_config.cfg @@ -0,0 +1 @@ +--cut K*,R*,!*P --fixed-mod UniMod:4,57.021464,C --var-mod UniMod:35,15.994915,M --var-mod UniMod:21,79.966331,STY --var-mod UniMod:1,42.010565,*nKR --met-excision \ No newline at end of file diff --git a/quantmsutils/diann/dianncfg.py b/quantmsutils/diann/dianncfg.py index b3db1d8..8e3804d 100644 --- a/quantmsutils/diann/dianncfg.py +++ b/quantmsutils/diann/dianncfg.py @@ -16,6 +16,12 @@ unimod_database = UnimodDatabase() +class ModificationNotSupportedError(Exception): + """Exception raised when a modification is not supported for DIA-NN processing.""" + + pass + + @click.command("dianncfg", short_help="Create DIA-NN config file with enzyme and PTMs") @click.option("--enzyme", "-e", help="") @click.option("--fix_mod", "-f", help="") @@ -64,11 +70,12 @@ def get_mod(mod, mod_type): break if tag == 0: - logging.error( + error_msg = ( "Currently only supported unimod modifications for DIA pipeline. Skipped: " + mod ) - exit(1) + logging.error(error_msg) + raise ModificationNotSupportedError(error_msg) # TODO support DIA multiplex if ( @@ -78,11 +85,12 @@ def get_mod(mod, mod_type): or "mTRAQ" in diann_mod_name or "Dimethyl:" in diann_mod_name ): - logging.error( + error_msg = ( "quantms DIA-NN workflow only support LFQ now! Unsupported modifications: " + mod ) - exit(1) + logging.error(error_msg) + raise ModificationNotSupportedError(error_msg) elif diann_mod_accession is not None: site = re.findall(pattern, " ".join(mod.split(" ")[1:]))[0] if site == "Protein N-term": @@ -103,11 +111,12 @@ def get_mod(mod, mod_type): logging.warning("Restricting to certain terminal AAs isn't directly supported. Please see https://github.com/vdemichev/DiaNN/issues/1791") return diann_mod_accession, site else: - logging.error( + error_msg = ( "Currently only supported unimod modifications for DIA pipeline. Skipped: " + mod ) - exit(1) + logging.error(error_msg) + raise ModificationNotSupportedError(error_msg) def convert_mod(fix_mod: str, var_mod: str) -> Tuple[List, List]: From ff608dc2b045d5bfc352c3088a600885c5133215 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 06:56:07 +0000 Subject: [PATCH 3/4] Remove generated diann_config.cfg and add to .gitignore Co-authored-by: ypriverol <52113+ypriverol@users.noreply.github.com> --- .gitignore | 1 + diann_config.cfg | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 diann_config.cfg diff --git a/.gitignore b/.gitignore index f7e62d9..9a3890a 100644 --- a/.gitignore +++ b/.gitignore @@ -169,3 +169,4 @@ cython_debug/ .qodo /tests/test_data/RD139_Narrow_UPS1_0_1fmol_inj1.mzML +diann_config.cfg diff --git a/diann_config.cfg b/diann_config.cfg deleted file mode 100644 index afcb43c..0000000 --- a/diann_config.cfg +++ /dev/null @@ -1 +0,0 @@ ---cut K*,R*,!*P --fixed-mod UniMod:4,57.021464,C --var-mod UniMod:35,15.994915,M --var-mod UniMod:21,79.966331,STY --var-mod UniMod:1,42.010565,*nKR --met-excision \ No newline at end of file From 135e8c7abb5be25e0945a4a488acaffd9b107f8f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 06:57:57 +0000 Subject: [PATCH 4/4] Fix grammar error in error message (support -> supports) Co-authored-by: ypriverol <52113+ypriverol@users.noreply.github.com> --- quantmsutils/diann/dianncfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantmsutils/diann/dianncfg.py b/quantmsutils/diann/dianncfg.py index 8e3804d..4e7ca98 100644 --- a/quantmsutils/diann/dianncfg.py +++ b/quantmsutils/diann/dianncfg.py @@ -86,7 +86,7 @@ def get_mod(mod, mod_type): or "Dimethyl:" in diann_mod_name ): error_msg = ( - "quantms DIA-NN workflow only support LFQ now! Unsupported modifications: " + "quantms DIA-NN workflow only supports LFQ now! Unsupported modifications: " + mod ) logging.error(error_msg)