Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved config for fragment types #424

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions alphadia/constants/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use

fragment_types: 
  - 'b'
  - 'y'

here to be consistent with rest of config?


# maximum charge state for predicted fragments
max_fragment_charge: 2
instrument: Lumos
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion alphadia/libtransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion alphadia/search_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)

Expand Down
2 changes: 1 addition & 1 deletion alphadia/workflow/peptidecentric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
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 @@ -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",
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
Loading