Skip to content

Commit

Permalink
Merge pull request #424 from MannLabs/list-config
Browse files Browse the repository at this point in the history
Improved config for fragment types
  • Loading branch information
GeorgWa authored Jan 24, 2025
2 parents 65a9583 + 3cb5ca1 commit abfefaf
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 14 deletions.
14 changes: 10 additions & 4 deletions alphadia/constants/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ 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
Expand Down Expand Up @@ -327,8 +332,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
Expand Down
2 changes: 1 addition & 1 deletion alphadia/libtransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,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
Expand Down
2 changes: 1 addition & 1 deletion alphadia/search_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,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"],
)

Expand Down
2 changes: 1 addition & 1 deletion alphadia/workflow/peptidecentric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,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(
Expand Down
23 changes: 23 additions & 0 deletions gui/src/renderer/components/ParameterInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,29 @@ const ParameterInput = ({
/>)
break;

case "multi_select":
input = (
<FormControl variant="standard" size="small" sx={{width: "150px", minHeight: "0px"}}>
<Select
multiple
value={parameter.value}
onChange={(event) => {onChange(event.target.value)}}
renderValue={(selected) => (
<Typography>
{selected.length} selected
</Typography>
)}
>
{parameter.options.map((option) => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</Select>
</FormControl>
)
break;

default:
input = (
<Typography>
Expand Down
44 changes: 38 additions & 6 deletions gui/workflows/PeptideCentric.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -574,9 +590,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",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_outputaccumulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit abfefaf

Please sign in to comment.