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

Feature/score-type #144

Merged
merged 4 commits into from
Oct 17, 2024
Merged

Conversation

theGreatHerrLebert
Copy link
Contributor

This PR draft provides a slightly modified version of hyperscore as it can be found in the OpenMS repository, details in #139.

  • addition of an enumerator as extendable switch for potential additional score implementations
  • moved original hyperscore calculation into an extra function
  • added OpenMS hyperscore implementation
  • added optional string argument to config to choose between scores (defaults to original hyperscore, excepts unknown score string to original hyperscore with warning)

crates/sage-cli/src/input.rs Outdated Show resolved Hide resolved
crates/sage-cli/src/input.rs Outdated Show resolved Hide resolved
crates/sage-cli/src/input.rs Outdated Show resolved Hide resolved
crates/sage/src/scoring.rs Outdated Show resolved Hide resolved
@@ -156,12 +163,45 @@ fn lnfact(n: u16) -> f64 {
}
}

fn log_factorial(n: u16, k: u16) -> f64 {
Copy link
Owner

Choose a reason for hiding this comment

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

Why use this instead of the ln_fact function? If I wanted to calculate a precise log factorial instead of an approximation, I would already be doing so :)

Copy link
Contributor Author

@theGreatHerrLebert theGreatHerrLebert Jul 26, 2024

Choose a reason for hiding this comment

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

I wanted to stay true to the original implementation, but it should be equivalent to using the ln_fact function with approximation instead, replaced it accordingly.

Copy link
Owner

Choose a reason for hiding this comment

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

If there's a big difference, we can generate a pre-computed lookup table and use that.

crates/sage/src/scoring.rs Outdated Show resolved Hide resolved
impl Score {
/// Calculate the hyperscore for a given PSM choosing between implementations based on `score_type`
fn hyperscore(&self, score_type: ScoreType) -> f64 {
match score_type {
Copy link
Owner

Choose a reason for hiding this comment

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

Match expression is unnecessary here, you can simply write score_type.score(...)

Copy link
Owner

@lazear lazear left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the changes. I will test it out!

@lazear
Copy link
Owner

lazear commented Oct 17, 2024

I will work on getting this rebased and merged today. Next time, please don't merge in the master branch - makes it harder to clean up and fix later :)

@lazear lazear force-pushed the feature/score-type branch 2 times, most recently from 9014727 to 2e2bb14 Compare October 17, 2024 16:17
@lazear lazear merged commit 888afad into lazear:master Oct 17, 2024
1 check passed
@theGreatHerrLebert
Copy link
Contributor Author

Makes sense, thanks!

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