Skip to content

Provide charge model#245

Merged
mo-sameh merged 5 commits intomainfrom
provide-charge-model
Jul 11, 2025
Merged

Provide charge model#245
mo-sameh merged 5 commits intomainfrom
provide-charge-model

Conversation

@mo-sameh
Copy link
Copy Markdown
Collaborator

@mo-sameh mo-sameh commented May 2, 2025

Uploaded the char model weights and provided a unified interface for the charge model where the architecture (prediction head) doesn't change based on the number of charge states available in the training data.

@mo-sameh mo-sameh requested a review from Copilot May 2, 2025 14:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR provides a unified interface and updated weights for the charge model while ensuring consistent model handling across different charge state configurations. Key changes include initializing the charge model with global supported charge constants, adding training and prediction methods specific to the charge model, and updating default settings and test notebooks to align with these changes.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
peptdeep/pretrained_models.py Instantiates and loads a unified charge model and adds new training and prediction methods.
peptdeep/model/charge.py Updates the charge model interface to use global charge constants and adjusts indexing logic.
peptdeep/constants/default_settings.yaml Updates model zip names/URLs and adds hyperparameters for charge model training.
nbs_trials/test_charge_model.ipynb Provides a notebook for testing charge model training and prediction.

@mo-sameh mo-sameh requested a review from GeorgWa May 2, 2025 14:28
Copy link
Copy Markdown
Collaborator

@GeorgWa GeorgWa left a comment

Choose a reason for hiding this comment

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

LGTM

min_precursor_charge - self.min_predict_charge : max_precursor_charge
- self.min_predict_charge
min_precursor_charge
- self.min_supported_predict_charge : max_precursor_charge
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if I understand what's happening here :D

Is it user requested or model supported clipping?
Why don't we substract a constant as I would expect that the indicators are always 10elements?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess the constants are loaded into the variables. Should we maybe use the constants in the first place?

def __init__(self, device: str = "gpu"):
super().__init__(
num_target_values=max_charge - min_charge + 1,
num_target_values=MAX_SUPPORTED_CHARGE - MIN_SUPPORTED_CHARGE + 1,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you add a constant for this? Like NUM_SUPPORTED_CHARGE

df: pd.DataFrame,
charge_prob_cutoff: float = 0.3,
min_precursor_charge: int = 1,
max_precursor_charge: int = 6,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The docstring says the default is 10 :D

DataFrame containing the "charge_indicators" and "charge_probs" columns.
charge_prob_cutoff : float, optional
Cutoff for charge prediction, by default 0.3
min_precursor_charge : int, optional
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you add that these are the user requested charges and that the model is limited to charge 1-10

Maximum precursor charge.

charge_prob_cutoff : float
Charge probability cutoff.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you add something like: "Set to None to predict all charges"

@mo-sameh mo-sameh merged commit 38cecfd into main Jul 11, 2025
2 checks passed
@mo-sameh mo-sameh deleted the provide-charge-model branch July 11, 2025 18:06
@mschwoer mschwoer mentioned this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants