Skip to content

Provide charge model #245

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Provide charge model #245

wants to merge 4 commits into from

Conversation

mo-sameh
Copy link
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

@Copilot 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
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
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
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?

super().__init__(
num_target_values=max_charge - min_charge + 1,
num_target_values=MAX_SUPPORTED_CHARGE - MIN_SUPPORTED_CHARGE + 1,
Copy link
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
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
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
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"

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.

2 participants