From cc424dbc5c3e6b80964acdeb7ec10730239b3435 Mon Sep 17 00:00:00 2001 From: GeorgWa Date: Mon, 6 Jan 2025 14:41:42 +0100 Subject: [PATCH 1/2] move from str to list --- alphadia/constants/default.yaml | 12 +++-- alphadia/libtransform.py | 2 +- alphadia/search_step.py | 2 +- alphadia/workflow/peptidecentric.py | 2 +- gui/src/renderer/components/ParameterInput.js | 23 ++++++++++ gui/workflows/PeptideCentric.v1.json | 44 ++++++++++++++++--- 6 files changed, 72 insertions(+), 13 deletions(-) diff --git a/alphadia/constants/default.yaml b/alphadia/constants/default.yaml index f44fe459..1b572cce 100644 --- a/alphadia/constants/default.yaml +++ b/alphadia/constants/default.yaml @@ -46,8 +46,11 @@ library_prediction: - 200 - 2000 nce: 25.0 - # semicolon separated list of fragment types. Supported types are: a, b, c, x, y, z, b_modloss, y_modloss - fragment_types: 'b;y' + + # list of fragment types (see alphabase.peptide.fragment.FRAGMENT_TYPES for supported types) + # Supported types are: a, b, c, x, y, z, b_modloss, y_modloss, b_H2O, y_H2O, b_NH3, y_NH3, c_lossH, z_addH + fragment_types: ['b', 'y'] + # maximum charge state for predicted fragments max_fragment_charge: 2 instrument: Lumos @@ -321,8 +324,9 @@ transfer_library: # if true, the library is created for transfer learning enabled: False - # semicolon separated list of fragment types to include in the library. possible values are 'a', 'b', 'c', 'x', 'y', 'z' - fragment_types: 'b;y' + # list of fragment types (see alphabase.peptide.fragment.FRAGMENT_TYPES for supported types) + # Supported types are: a, b, c, x, y, z, b_modloss, y_modloss, b_H2O, y_H2O, b_NH3, y_NH3, c_lossH, z_addH + fragment_types: ['b', 'y'] # maximum charge for fragments max_charge: 2 diff --git a/alphadia/libtransform.py b/alphadia/libtransform.py index 9084ac58..52e53619 100644 --- a/alphadia/libtransform.py +++ b/alphadia/libtransform.py @@ -286,7 +286,7 @@ def __init__( Default is None, which means the peptdeep default model ("generic") is being used. Possible values are ['generic','phospho','digly'] - fragment_types : List[str], optional + fragment_types : list[str], optional Fragment types to predict. Default is ["b", "y"]. max_fragment_charge : int, optional diff --git a/alphadia/search_step.py b/alphadia/search_step.py index 0032b404..eb1f03f1 100644 --- a/alphadia/search_step.py +++ b/alphadia/search_step.py @@ -217,7 +217,7 @@ def _parse_modifications(mod_str: str) -> list[str]: mp_process_num=thread_count, peptdeep_model_path=prediction_config["peptdeep_model_path"], peptdeep_model_type=prediction_config["peptdeep_model_type"], - fragment_types=prediction_config["fragment_types"].split(";"), + fragment_types=prediction_config["fragment_types"], max_fragment_charge=prediction_config["max_fragment_charge"], ) diff --git a/alphadia/workflow/peptidecentric.py b/alphadia/workflow/peptidecentric.py index b03c05c0..410582ed 100644 --- a/alphadia/workflow/peptidecentric.py +++ b/alphadia/workflow/peptidecentric.py @@ -1126,7 +1126,7 @@ def requantify_fragments( verbosity="progress", ) - fragment_types = self.config["transfer_library"]["fragment_types"].split(";") + fragment_types = self.config["transfer_library"]["fragment_types"] max_charge = self.config["transfer_library"]["max_charge"] self.reporter.log_string( diff --git a/gui/src/renderer/components/ParameterInput.js b/gui/src/renderer/components/ParameterInput.js index bb1a63a8..31e6ebf8 100644 --- a/gui/src/renderer/components/ParameterInput.js +++ b/gui/src/renderer/components/ParameterInput.js @@ -172,6 +172,29 @@ const ParameterInput = ({ />) break; + case "multi_select": + input = ( + + + + ) + break; + default: input = ( diff --git a/gui/workflows/PeptideCentric.v1.json b/gui/workflows/PeptideCentric.v1.json index 00c6afe5..090426dd 100644 --- a/gui/workflows/PeptideCentric.v1.json +++ b/gui/workflows/PeptideCentric.v1.json @@ -210,9 +210,25 @@ { "id": "fragment_types", "name": "Fragment types", - "value": "b;y", - "description": "Semicolon separated list of fragment types. \n Supported types: b, y, b_modloss, y_modloss. \n Must be supported by the chosen PeptDeep model.", - "type": "string" + "value": ["b", "y"], + "description": "List of fragment types to quantify in the library. The PeptDeep model must support the chosen fragment types.", + "type": "multi_select", + "options": [ + "b", + "y", + "b_modloss", + "y_modloss", + "a", + "c", + "x", + "z", + "b_H2O", + "y_H2O", + "b_NH3", + "y_NH3", + "c_lossH", + "z_addH" + ] }, { "id": "max_fragment_charge", @@ -560,9 +576,25 @@ { "id": "fragment_types", "name": "Fragment types", - "value": "b;y", - "description": "Semicolon separated list of fragment types to include in the library. \n possible values are 'a', 'b', 'c', 'x', 'y', 'z'", - "type": "string" + "value": ["b", "y"], + "description": "List of fragment types to quantify in the library.", + "type": "multi_select", + "options": [ + "b", + "y", + "b_modloss", + "y_modloss", + "a", + "c", + "x", + "z", + "b_H2O", + "y_H2O", + "b_NH3", + "y_NH3", + "c_lossH", + "z_addH" + ] }, { "id": "max_charge", From 974da81a82fe4922d890948a5b1f51c643c8e43d Mon Sep 17 00:00:00 2001 From: GeorgWa Date: Mon, 6 Jan 2025 15:01:55 +0100 Subject: [PATCH 2/2] fix test --- tests/unit_tests/test_outputaccumulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit_tests/test_outputaccumulator.py b/tests/unit_tests/test_outputaccumulator.py index 896aa06d..06dadb6c 100644 --- a/tests/unit_tests/test_outputaccumulator.py +++ b/tests/unit_tests/test_outputaccumulator.py @@ -53,7 +53,7 @@ def prepare_input_data(): }, "transfer_library": { "enabled": True, - "fragment_types": "b;y", + "fragment_types": ["b", "y"], "max_charge": 2, "top_k_samples": 3, "norm_delta_max": True,