Repository navigation
Hydrophobicity scales and profiling - #9179
Conversation
…and turned it into a constant function, improved documentation
…profile of a peptide, 2. calculating a windowed hydrophobicity profile of a peptide, 3. calculating hydrophobic moments in a peptide and added test for the profiling functions
… changes to computeHydrophobicMoments function
…r functions, improved getHydrophobicity function in residue class: replaced map with lookup table
|
Welcome @NoraHeese and thank you for your contribution to OpenMS! To help us better understand our userbase and contributors, we would appreciate if you could complete the survey at the link below. Completing this survey will help us get to your PR sooner. Thank you for your participation! |
|
@NoraHeese The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-04-17 14:03:36.558478902 +0000
+++ AUTHORS.new 2026-04-17 14:03:40.636889959 +0000
@@ -5,17 +5,18 @@
The following authors contributed to OpenMS at some point. For the
authors contributing to a specific piece of code, please refer to
the authors tag in the respective file header.
+ - Michael R. Crusoe
- Achal Bajpai
- Aditya Muzumdar
- Ahmed Khalil
- Alexandra Scherbart
- - Axel Walter
- Alexandra Zerck
- Amanda Wein
- Andreas Bertsch
- Andreas Simon
- Anton Kriese
- Anton Pervukhin
+ - Axel Walter
- Bastian Blank
- Chenghao Zhu
- Chirag Dave
@@ -26,8 +27,8 @@
- Cornelia Friedle
- Daniel Jameson
- Darren Kessner
- - David Wojnar
- David Voigt
+ - David Wojnar
- Dhanmoni Nath
- Dilek Dere
- Dimitri Schachmann
@@ -54,14 +55,14 @@
- Jang Jang Jin
- Jeremi Maciejewski
- Jihyung Kim
- - Johan Teleman
- Johannes Junker
- Johannes Veit
- Johannes von Kleist
+ - Johan Teleman
- Joshua Charkow
- - Julia Thueringer
- Juliane Schmachtenberg
- Julianus Pfeuffer
+ - Julia Thueringer
- Justin Sing
- Katharina Albers
- Khue Nguyen
@@ -77,6 +78,7 @@
- Lukas Zimmermann
- Marcel Schilling
- Marc Sturm
+ - Markus
- Markus Apel
- Markus Mueller
- Martin Langwisch
@@ -85,11 +87,11 @@
- Matteo Pilz
- Matthew The
- Matthias Bernt
- - Michael R. Crusoe
- Michał Startek
- Mohamed Ali
- Nico Pfeifer
- Nora Heese
+ - NoraHeese
- Ole Schulz-Trieglaff
- Oliver Alka
- Oliver Kohlbacher
@@ -112,11 +114,11 @@
- Sven Nahnsen
- Svetlana Kutuzova
- Swenja Wagner
- - Taraneh Strunk
- Tapasweni Pathak
+ - Taraneh Strunk
+ - Till Englert
- Timo Sachsenberg
- Tinatin Kasradze
- - Till Englert
- Tom David Müller
- Tom Lukas Lankenau
- Tom Waschischeck |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAdds hydrophobicity support: a new Changes
Sequence Diagram(s)(omitted) Possibly related issues
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (7)
src/openms/include/OpenMS/CHEMISTRY/Residue.h (1)
441-445: Document the thrown exception explicitly in the new public API docs.This comment block doesn't meet the repo's required Doxygen format yet, and it omits the concrete exception type callers need to expect from
getHydrophobicity().Proposed doc fix
- /// `@brief` returns the hydrophobicity value of the residue - /// `@param` scale which scale to use for the hydrophobicity value - /// `@return` hydrophobicity value of the residue - /// `@throw` this will throw an exception if the residue is not one of the 20 common amino acids + /** + `@brief` Returns the hydrophobicity value for this residue. + + Looks up the residue's one-letter code in the selected hydrophobicity scale. + Only the 20 canonical amino acids are supported. + + `@param` scale Hydrophobicity scale to use for the lookup. + `@return` Hydrophobicity value for the residue in the selected scale. + `@throw` Exception::InvalidValue If the residue has no valid one-letter code or is not one of the 20 canonical amino acids. + */ double getHydrophobicity(const HydrophobicityScaleMethod scale) const;As per coding guidelines, "Document possible exceptions in C++ function/method documentation" and "Use
@briefplus blank line plus detailed description in Doxygen comments; required@brieftag."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/CHEMISTRY/Residue.h` around lines 441 - 445, Update the Doxygen for Residue::getHydrophobicity to follow the project's required format: keep the `@brief` tag then a blank line and a short detailed description, and add an explicit `@throw` (or `@exception`) entry documenting the concrete exception type and condition (e.g., throws OpenMS::Exception::InvalidValue when the residue is not one of the 20 common amino acids). Locate the declaration of getHydrophobicity(const HydrophobicityScaleMethod scale) const in Residue.h and add the exception line so callers know which OpenMS::Exception subtype to handle.src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h (1)
25-31: Minor style cleanups flagged by CodeFactor.Please drop the blank line at the very start of the class body (L27) and the blank line right after
public:(L29). Also,public:is indented at column 0 while the class body is indented 2 spaces — align to the class body indentation for consistency with the rest of the CHEMISTRY headers.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h` around lines 25 - 31, Remove the extra blank line at the start of the HydrophobicityProfile class body and the blank line immediately after the public: access specifier, and adjust the indentation of the public: label to match the class body indentation (align with the two-space indent used in other CHEMISTRY headers) so the class declaration for HydrophobicityProfile is consistently formatted.src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp (2)
45-50: Add coverage for an empty sequence passed tocomputeProfileandcomputeWindowedProfile.
computeGRAVYis tested for both empty and invalid sequences, butcomputeProfile(L53–67) only tests the invalid-symbol case, andcomputeWindowedProfileonly tests the empty-sequence case (no"XXX"case). It would be good to round out the exception coverage so all three guard branches of each method are exercised.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp` around lines 45 - 50, Add missing exception tests to cover all guard branches: for computeProfile add a test that passes an empty AASequence (e.g., reuse seq_2) and assert Exception::InvalidValue is thrown; for computeWindowedProfile add a test that passes an invalid-symbol sequence (e.g., seq_3 with "XXX") and assert Exception::InvalidValue with the same message used in computeGRAVY; update the test cases around profile.computeProfile and profile.computeWindowedProfile to include these two assertions so both empty-sequence and invalid-symbol branches are exercised.
98-98: Remove leftover template comment.
// Add more test sections for each method...looks like a placeholder from the test template; either address it or drop the line.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp` at line 98, Remove the leftover placeholder comment "// Add more test sections for each method..." from HydrophobicityProfile_test.cpp (inside the TEST_CASE/SECTION blocks) or replace it with actual test SECTIONs for the methods under test (e.g., add explicit SECTION("methodName") blocks calling HydrophobicityProfile methods); ensure no leftover template comments remain in the test file.src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp (3)
10-10: Unused include.
#include <OpenMS/KERNEL/DPeak.h>doesn't appear to be used anywhere in this translation unit. Please drop it to keep the include footprint minimal.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp` at line 10, The file HydrophobicityProfile.cpp currently includes an unused header DPeak.h; remove the line '#include <OpenMS/KERNEL/DPeak.h>' from src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp, rebuild to confirm no compile errors, and only reintroduce the include if the compiler later reports an undefined symbol that actually requires DPeak (in which case include it next to the function or class that needs it).
67-81: Hoiststd::min(window_size, seq.size())once and mirrorconstfrom the header.Two small things:
std::min(window_size, seq.size())is recomputed on L67, L73, L75, L79, L80 — compute it once (const Size effective_w = std::min(window_size, seq.size());) and reuse.- If you accept the
const-methods suggestion on the header, make sure to mirror the signatures here (... const { ... }).Minor but makes the sliding-window code easier to read.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp` around lines 67 - 81, Hoist the repeated std::min(window_size, seq.size()) into a single const Size effective_w = std::min(window_size, seq.size()) and use effective_w everywhere (replace uses in subsequence construction, profile normalization, loop bounds, and prev_value indexing), update subsequence to use effective_w, and mirror the header's const qualification by making the method definition const (so the function that contains window_size, seq, profile, prev_value is declared/defined as const). Ensure you replace all occurrences from the diff (window_size, seq.size() uses at the start, in the for loop bounds, push_back divisors, and prev_value index) with effective_w.
113-119: UseOpenMS::Constants::PIandstd::sqrt, and hoist constant expressions out of the inner loop.A few cleanups for numerical quality and performance:
- Hardcoded
3.14159265359— replace withOpenMS::Constants::PI(fromOpenMS/CONCEPT/Constants.h) so precision matches the rest of the codebase.angle * curr_position * PI / 180is recomputed per residue;angle_rad = angle * PI / 180.0can be hoisted before the loop.residue.getHydrophobicity(EISENBERG)is fetched twice per residue; compute it once.std::pow(x, 2)/std::pow(x, 0.5)→x * x/std::sqrt(x). Clearer and typically faster.🔧 Proposed change
+ const double angle_rad = angle * Constants::PI / 180.0; ... for (const auto& residue : subsequence) // sum the values in the window { - sum_sin += residue.getHydrophobicity(HydrophobicityScaleMethod::EISENBERG)*std::sin((angle*curr_position*3.14159265359)/180); - sum_cos += residue.getHydrophobicity(HydrophobicityScaleMethod::EISENBERG)*std::cos((angle*curr_position*3.14159265359)/180); + const double h = residue.getHydrophobicity(HydrophobicityScaleMethod::EISENBERG); + sum_sin += h * std::sin(angle_rad * curr_position); + sum_cos += h * std::cos(angle_rad * curr_position); curr_position++; } - sum_sin = std::pow(sum_sin,2); - sum_cos = std::pow(sum_cos,2); - profile.push_back(std::pow(sum_sin+sum_cos,0.5) / std::min(window_size, seq.size())); + profile.push_back(std::sqrt(sum_sin * sum_sin + sum_cos * sum_cos) / effective_w);You'll need
#include <OpenMS/CONCEPT/Constants.h>.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp` around lines 113 - 119, Replace the hardcoded pi and redundant computations in the hydrophobicity profile loop: include OpenMS/CONCEPT/Constants.h and use OpenMS::Constants::PI instead of 3.14159265359; compute angle_rad = angle * OpenMS::Constants::PI / 180.0 once before the loop in the function that builds the profile (HydrophobicityProfile related routine), fetch residue.getHydrophobicity(HydrophobicityScaleMethod::EISENBERG) into a local variable inside the loop instead of calling it twice, replace std::pow(sum_sin,2)/std::pow(sum_cos,2) with sum_sin*sum_sin / sum_cos*sum_cos as appropriate (compute squares via x*x) and use std::sqrt(sum_sin + sum_cos) instead of std::pow(...,0.5); hoist any other constant subexpressions out of the inner loop and keep the final division by std::min(window_size, seq.size()) as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Line 47: Fix the Doxygen docs in OpenMS::HydrophobicityProfile: correct the
typo on the seq parameter in the comment that reads "seqTthe..." to "@param seq
The amino acid sequence ..." and fix "vektor" to "vector"; then update the
computeHydrophobicMoment comment to include an "@param angle" entry describing
the angle parameter (alongside existing `@param` seq and `@param` window_size).
Locate these changes in the HydrophobicityProfile.h Doxygen block related to the
computeHydrophobicMoment declaration and adjust the parameter descriptions
accordingly.
- Around line 34-71: The listed compute methods are logically const and should
be callable on a const HydrophobicityProfile; update the method declarations
computeGRAVY, computeProfile, computeWindowedProfile, and
computeHydrophobicMoment in HydrophobicityProfile.h to be const, and update
their corresponding definitions/implementations in the .cpp to include the same
trailing const qualifier; ensure any overriding/forwarding functions or
callers/signatures match the new const methods.
In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp`:
- Line 64: Fix the typo and clarify the warning text in
HydrophobicityProfile.cpp: update the OPENMS_LOG_WARN messages (the lines that
currently mention "seequence" and occur around the uses in
HydrophobicityProfile.cpp, e.g., the two OPENMS_LOG_WARN calls) to correct
"seequence" -> "sequence" and reword the message to indicate the effective
window size is being clamped (e.g., "Effective window size clamped to sequence
length (N): " << seq.size()) so it accurately reflects that the
divisor/subsequence length is clamped rather than mutating window_size.
- Around line 58-61: The check using "window_size <= 0" is wrong for the
unsigned Size type; update both occurrences in HydrophobicityProfile.cpp to test
for equality to zero instead (use "window_size == 0" rather than "<= 0") where
the Exception::InvalidSize is thrown (keep the same exception message and
context), ensuring you modify the checks that reference the variable window_size
in the function that builds the hydrophobicity profile and the second site that
validates the window size.
- Line 105: The loop uses a signed index (auto i = 0) causing signed/unsigned
mismatches with seq.size() and std::min(window_size, seq.size()); change the
index to the appropriate unsigned OpenMS size type (Size or SignedSize per
project convention) and compute an effective_w = std::min(window_size,
seq.size()), then rewrite the condition to use i + effective_w <= seq.size()
(e.g. for (Size i = 0; i + effective_w <= seq.size(); ++i)) so calls like
seq.getSubsequence(i, ...) no longer cause conversions or UB for very long
sequences; update references to window_size/seq.size() accordingly.
In `@src/openms/source/CHEMISTRY/Residue.cpp`:
- Around line 633-705: The function Residue::getHydrophobicity uses the enum
parameter scale directly as an index into the 7x26 array scales, allowing
out-of-range enum values to cause OOB reads; validate scale before indexing by
converting scale to an integer (e.g. int si = static_cast<int>(scale)) and check
0 <= si && si < 7, throwing Exception::InvalidValue (similar to other checks) if
it is out of range, then use si to index scales and compute result.
In `@src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp`:
- Line 69: The START_SECTION entries use the bare method name; update them to
the full method signature to match project convention and other tests. Replace
START_SECTION(computeWindowedProfile) occurrences with
START_SECTION(HydrophobicityProfile::computeWindowedProfile(...)) using the
exact signature used elsewhere in this file (the full
HydrophobicityProfile::computeWindowedProfile(...) overload(s)) so each overload
is explicitly documented; ensure both occurrences are changed to the same full
signature form as the other START_SECTION lines.
In `@src/tests/class_tests/openms/source/Residue_test.cpp`:
- Line 751: The test START_SECTION macro uses a stale signature; update the
START_SECTION label to match the actual public API in Residue.h by changing the
parameter type from HydrophobicityScaleNumber to the correct enum/type used in
the declaration (the getHydrophobicity method in class Residue). Locate the
START_SECTION line referencing getHydrophobicity and replace the incorrect
parameter type with the exact type name declared in Residue.h so the test header
matches the real method signature.
---
Nitpick comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Around line 25-31: Remove the extra blank line at the start of the
HydrophobicityProfile class body and the blank line immediately after the
public: access specifier, and adjust the indentation of the public: label to
match the class body indentation (align with the two-space indent used in other
CHEMISTRY headers) so the class declaration for HydrophobicityProfile is
consistently formatted.
In `@src/openms/include/OpenMS/CHEMISTRY/Residue.h`:
- Around line 441-445: Update the Doxygen for Residue::getHydrophobicity to
follow the project's required format: keep the `@brief` tag then a blank line and
a short detailed description, and add an explicit `@throw` (or `@exception`) entry
documenting the concrete exception type and condition (e.g., throws
OpenMS::Exception::InvalidValue when the residue is not one of the 20 common
amino acids). Locate the declaration of getHydrophobicity(const
HydrophobicityScaleMethod scale) const in Residue.h and add the exception line
so callers know which OpenMS::Exception subtype to handle.
In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp`:
- Line 10: The file HydrophobicityProfile.cpp currently includes an unused
header DPeak.h; remove the line '#include <OpenMS/KERNEL/DPeak.h>' from
src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp, rebuild to confirm no
compile errors, and only reintroduce the include if the compiler later reports
an undefined symbol that actually requires DPeak (in which case include it next
to the function or class that needs it).
- Around line 67-81: Hoist the repeated std::min(window_size, seq.size()) into a
single const Size effective_w = std::min(window_size, seq.size()) and use
effective_w everywhere (replace uses in subsequence construction, profile
normalization, loop bounds, and prev_value indexing), update subsequence to use
effective_w, and mirror the header's const qualification by making the method
definition const (so the function that contains window_size, seq, profile,
prev_value is declared/defined as const). Ensure you replace all occurrences
from the diff (window_size, seq.size() uses at the start, in the for loop
bounds, push_back divisors, and prev_value index) with effective_w.
- Around line 113-119: Replace the hardcoded pi and redundant computations in
the hydrophobicity profile loop: include OpenMS/CONCEPT/Constants.h and use
OpenMS::Constants::PI instead of 3.14159265359; compute angle_rad = angle *
OpenMS::Constants::PI / 180.0 once before the loop in the function that builds
the profile (HydrophobicityProfile related routine), fetch
residue.getHydrophobicity(HydrophobicityScaleMethod::EISENBERG) into a local
variable inside the loop instead of calling it twice, replace
std::pow(sum_sin,2)/std::pow(sum_cos,2) with sum_sin*sum_sin / sum_cos*sum_cos
as appropriate (compute squares via x*x) and use std::sqrt(sum_sin + sum_cos)
instead of std::pow(...,0.5); hoist any other constant subexpressions out of the
inner loop and keep the final division by std::min(window_size, seq.size()) as
before.
In `@src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp`:
- Around line 45-50: Add missing exception tests to cover all guard branches:
for computeProfile add a test that passes an empty AASequence (e.g., reuse
seq_2) and assert Exception::InvalidValue is thrown; for computeWindowedProfile
add a test that passes an invalid-symbol sequence (e.g., seq_3 with "XXX") and
assert Exception::InvalidValue with the same message used in computeGRAVY;
update the test cases around profile.computeProfile and
profile.computeWindowedProfile to include these two assertions so both
empty-sequence and invalid-symbol branches are exercised.
- Line 98: Remove the leftover placeholder comment "// Add more test sections
for each method..." from HydrophobicityProfile_test.cpp (inside the
TEST_CASE/SECTION blocks) or replace it with actual test SECTIONs for the
methods under test (e.g., add explicit SECTION("methodName") blocks calling
HydrophobicityProfile methods); ensure no leftover template comments remain in
the test file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 69cb15c9-6547-4227-867c-cfc83cfa57aa
📒 Files selected for processing (12)
AUTHORSCHANGELOGsrc/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.hsrc/openms/include/OpenMS/CHEMISTRY/Residue.hsrc/openms/include/OpenMS/CHEMISTRY/sources.cmakesrc/openms/include/OpenMS/CONCEPT/CommonEnums.hsrc/openms/source/CHEMISTRY/HydrophobicityProfile.cppsrc/openms/source/CHEMISTRY/Residue.cppsrc/openms/source/CHEMISTRY/sources.cmakesrc/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/HydrophobicityProfile_test.cppsrc/tests/class_tests/openms/source/Residue_test.cpp
|
hi can you cite your sources? |
|
Thanks for the PR
Add them to the class documentation for future reference. The rabbit has useful comments as well. |
…ces to the hydrophobic profiles, improved readability of functions, fixed issues of Test-Names in Residue_test and HydrophobicityProfile_test
|
Hello. Thank you for your feedback. We have cited the sources in the HydrophobicityProfile class and implemented the changes suggested by the CodeRabbit. |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp (2)
112-112: Remove the resolved TODO from the loop.The loop already uses
Size; the inline German TODO looks like a leftover review/debug note.🧹 Proposed cleanup
- for (Size i = 0; i + effective_window <= seq.size(); i++) // window slides by one amino acid in each iteration // TODO: Wie fixen? Nur Size oder so wie der Code es angibt? + for (Size i = 0; i + effective_window <= seq.size(); ++i) // window slides by one amino acid in each iterationI can help turn this into a small cleanup patch if you want.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp` at line 112, Remove the leftover inline German TODO from the for-loop comment that starts with "for (Size i = 0; i + effective_window <= seq.size(); i++)" in HydrophobicityProfile.cpp; keep the existing explanatory comment ("window slides by one amino acid in each iteration") and delete the "TODO: Wie fixen? Nur Size oder so wie der Code es angibt?" fragment so the code comment is clean and English-only.
9-12: Add missing standard library includes for used functions.This file uses
std::min(lines 70, 110, 128) and<cmath>functions (std::sin,std::cos,std::pow,std::sqrton lines 122–128) without including<algorithm>or<cmath>. While transitive includes currently provide these, explicitly including the headers improves robustness.🔧 Proposed fix
`#include` <OpenMS/CHEMISTRY/HydrophobicityProfile.h> `#include` <OpenMS/CONCEPT/Constants.h> `#include` <OpenMS/KERNEL/DPeak.h> + +#include <algorithm> +#include <cmath>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp` around lines 9 - 12, The source uses std::min and math functions (std::sin, std::cos, std::pow, std::sqrt) in HydrophobicityProfile.cpp (seen near usages in the code around the min and trig/power/sqrt calls), but does not include the corresponding headers; add explicit includes for <algorithm> to cover std::min and <cmath> to cover the trig/power/sqrt functions at the top of HydrophobicityProfile.cpp (alongside the existing OpenMS includes) so these symbols are defined without relying on transitive includes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Around line 19-46: Add the Chemistry Doxygen group and fix the typo in the
HydrophobicityProfile class docblock: edit the top comment in
OpenMS/CHEMISTRY/HydrophobicityProfile.h (the doc for the HydrophobicityProfile
class) to include an "@ingroup Chemistry" tag (so the class joins the Chemistry
API group) and correct "Refernced" to "Referenced"; keep the existing `@ref`
HydrophobicityScaleMethod and other references intact.
- Around line 48-95: Add pyOpenMS bindings for the new HydrophobicityProfile
class in bind_chemistry.cpp by creating a pybind11 class_ for
HydrophobicityProfile, exposing its default constructor and the methods
computeGRAVY, computeProfile, computeWindowedProfile, and
computeHydrophobicMoment (ensure signatures use const AASequence& and preserve
default arguments for window_size and scale/angle), and implement Python
copy/deepcopy support (e.g., __copy__ returning a copy constructed
HydrophobicityProfile and __deepcopy__ handling memo). Ensure method names
exactly match HydrophobicityProfile::computeGRAVY, ::computeProfile,
::computeWindowedProfile, and ::computeHydrophobicMoment so bindings link to the
correct symbols and add the binding block into the CHEMISTRY section of
bind_chemistry.cpp.
In `@src/openms/include/OpenMS/CHEMISTRY/Residue.h`:
- Around line 445-448: The doc comment for getHydrophobicity(const
HydrophobicityScaleMethod scale) const is incomplete: besides invalid residues
it can also throw Exception::InvalidValue when the provided
HydrophobicityScaleMethod value is outside the supported enum range; update the
function's documentation to mention this exception path explicitly and describe
when it is thrown (invalid/unsupported scale), referring to the
HydrophobicityScaleMethod enum and Exception::InvalidValue to make the contract
clear for callers.
In `@src/openms/source/CHEMISTRY/Residue.cpp`:
- Around line 656-689: In the hydrophobicity tables in Residue.cpp (the
Eisenberg normalized, HoppWoods, BullBreese, BlackMould and Guy scale
initializer blocks), swap the values for residues E and Q in each scale (they
were transcribed reversed); additionally in the Eisenberg normalized block
correct L from 1.088 to 1.060 and correct W from -0.81 to 0.810. Locate the
initializer blocks labeled "Eisenberg normalized scale", "HoppWoods scale",
"BullBreese scale", "BlackMould scale", and "Guy scale" and update the numeric
entries for E and Q (and the L and W entries in the Eisenberg block) accordingly
so the tables match the corrected values in the review comment.
---
Nitpick comments:
In `@src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp`:
- Line 112: Remove the leftover inline German TODO from the for-loop comment
that starts with "for (Size i = 0; i + effective_window <= seq.size(); i++)" in
HydrophobicityProfile.cpp; keep the existing explanatory comment ("window slides
by one amino acid in each iteration") and delete the "TODO: Wie fixen? Nur Size
oder so wie der Code es angibt?" fragment so the code comment is clean and
English-only.
- Around line 9-12: The source uses std::min and math functions (std::sin,
std::cos, std::pow, std::sqrt) in HydrophobicityProfile.cpp (seen near usages in
the code around the min and trig/power/sqrt calls), but does not include the
corresponding headers; add explicit includes for <algorithm> to cover std::min
and <cmath> to cover the trig/power/sqrt functions at the top of
HydrophobicityProfile.cpp (alongside the existing OpenMS includes) so these
symbols are defined without relying on transitive includes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e16143e1-53d0-4f31-85a1-a4d5c0985e5b
📒 Files selected for processing (8)
CHANGELOGsrc/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.hsrc/openms/include/OpenMS/CHEMISTRY/Residue.hsrc/openms/include/OpenMS/CONCEPT/CommonEnums.hsrc/openms/source/CHEMISTRY/HydrophobicityProfile.cppsrc/openms/source/CHEMISTRY/Residue.cppsrc/tests/class_tests/openms/source/HydrophobicityProfile_test.cppsrc/tests/class_tests/openms/source/Residue_test.cpp
✅ Files skipped from review due to trivial changes (3)
- src/openms/include/OpenMS/CONCEPT/CommonEnums.h
- src/tests/class_tests/openms/source/Residue_test.cpp
- CHANGELOG
🚧 Files skipped from review as they are similar to previous changes (1)
- src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp
| class OPENMS_DLLAPI HydrophobicityProfile | ||
| { | ||
|
|
||
| public: | ||
|
|
||
| /// @brief Calculates the GRAVY score | ||
| /// @param seq The amino acid sequence for which to calculate the GRAVY score | ||
| /// @return The GRAVY score of a given peptide | ||
| /// @throw Exception::InvalidValue Throws an exception if the sequence is empty or contains invalid symbols (sequence can only contain the standard 20 Amino acids) | ||
| double computeGRAVY(const AASequence& seq) const; | ||
|
|
||
| /// @brief Calculates hydrophobicity profile per residue | ||
| /// @param seq The amino acid sequence for which to calculate the profile | ||
| /// @param scale The scale to use for the calculation | ||
| /// @return A vector which contains the hydrophobicity value for each amino acid | ||
| /// @throw Exception::InvalidValue Throws an exception if the sequence is empty or contains invalid symbols (sequence can only contain the standard 20 Amino acids) | ||
| std::vector<double> computeProfile( | ||
| const AASequence& seq, | ||
| const HydrophobicityScaleMethod scale = HydrophobicityScaleMethod::KYTE_DOOLITTLE | ||
| ) const; | ||
|
|
||
| /// @brief Calculates windowed hydrophobicity profile | ||
| /// @param seq The Amino acid Sequence for which to calculate the profile | ||
| /// @param window_size The size of the sliding window for the calculation | ||
| /// @param scale The scale to use for the calculation | ||
| /// @return A vector which contains the average hydrophobicity for each window | ||
| /// @throw Exception::InvalidValue Throws an exception if the sequence is empty or contains invalid symbols (sequence can only contain the standard 20 Amino acids) | ||
| /// @throw Exception::InvalidSize Throws an exception when the window size is 0 | ||
| /// @warning When the window size is larger than the sequence the window size will be clamped to the sequence length | ||
| std::vector<double> computeWindowedProfile( | ||
| const AASequence& seq, | ||
| Size window_size = 7, | ||
| const HydrophobicityScaleMethod scale = HydrophobicityScaleMethod::KYTE_DOOLITTLE | ||
| ) const; | ||
|
|
||
| /// @brief Calculates hydrophobic moments | ||
| /// @param seq The Amino acid sequence | ||
| /// @param window_size The size of the sliding window for the calculation | ||
| /// @param angle The angle to use: 100 for alpha-helices, 160 for beta-sheets, other angles can be used | ||
| /// @return A vector which contains the hydrophobic moment for each window | ||
| /// @throw Exception::InvalidValue Throws an exception if the sequence is empty or contains invalid symbols (sequence can only contain the standard 20 Amino acids) | ||
| /// @throw Exception::InvalidSize Throws an exception when the window size is 0 | ||
| /// @warning When the window size is larger than the sequence the window size will be clamped to the sequence length | ||
| std::vector<double> computeHydrophobicMoment( | ||
| const AASequence& seq, | ||
| Size window_size = 11, | ||
| double angle = 100.0 // degrees; 100=alpha-helix, 160=beta-sheet | ||
| ) const; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether the new hydrophobicity APIs are already exposed in pyOpenMS.
# Expected: matches in bind_chemistry.cpp if bindings were added; no matches means this still needs a product/API decision.
rg -n -C3 'HydrophobicityProfile|getHydrophobicity|HydrophobicityScaleMethod' --iglob 'bind_*.cpp' src/pyOpenMS/bindings || trueRepository: OpenMS/OpenMS
Length of output: 39
Add pyOpenMS bindings for HydrophobicityProfile to bind_chemistry.cpp.
This new public class in the CHEMISTRY module is not yet exposed to Python. Add the class binding with constructor, methods (computeGRAVY, computeProfile, computeWindowedProfile, computeHydrophobicMoment), and required copy/deepcopy support to src/pyOpenMS/bindings/bind_chemistry.cpp.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h` around lines 48
- 95, Add pyOpenMS bindings for the new HydrophobicityProfile class in
bind_chemistry.cpp by creating a pybind11 class_ for HydrophobicityProfile,
exposing its default constructor and the methods computeGRAVY, computeProfile,
computeWindowedProfile, and computeHydrophobicMoment (ensure signatures use
const AASequence& and preserve default arguments for window_size and
scale/angle), and implement Python copy/deepcopy support (e.g., __copy__
returning a copy constructed HydrophobicityProfile and __deepcopy__ handling
memo). Ensure method names exactly match HydrophobicityProfile::computeGRAVY,
::computeProfile, ::computeWindowedProfile, and ::computeHydrophobicMoment so
bindings link to the correct symbols and add the binding block into the
CHEMISTRY section of bind_chemistry.cpp.
…anged the testing values accordingly
|
Thank you for bringing this to our attention. We fixed the incorrect values in the table |
| TEST_REAL_SIMILAR(vec[1],0.435170599); | ||
| TEST_REAL_SIMILAR(vec[2],0.734926405); |
There was a problem hiding this comment.
can you use some external tools that independently calculate these values? to double check that implementation is correct
There was a problem hiding this comment.
We have compared our results with the R package: Peptides https://github.com/dosorio/Peptides/blob/master/R/hmoment.R
the R package got the following results:
0.5115768
0.4351706
0.7349264
we also calculated the results with the formula using Wolfram alpha:
0.5115768030587373
0.43517059859465823
0.7349264053539316
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h (1)
50-50:⚠️ Potential issue | 🟠 MajorExpose the new Chemistry API in pyOpenMS, or document the exclusion.
This new public
OPENMS_DLLAPIclass still appears to need abind_chemistry.cppbinding for Python users. If it is intentionally C++-only, please make that explicit; otherwise add the nanobind class and method bindings. Based on learnings, “Update pyOpenMS bindings when changing C++ APIs”.Run this read-only check to verify whether the bindings were added:
#!/bin/bash # Expected after fix: matches in bind_chemistry.cpp for HydrophobicityProfile, # HydrophobicityScaleMethod, and/or Residue::getHydrophobicity. rg -n -C3 '\b(HydrophobicityProfile|HydrophobicityScaleMethod|getHydrophobicity)\b' --iglob 'bind_*.cpp' src/pyOpenMS/bindings || true🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h` at line 50, The new public C++ API declares HydrophobicityProfile (and related symbols like HydrophobicityScaleMethod and Residue::getHydrophobicity) but the pyOpenMS bindings were not updated; either add nanobind wrappers in bind_chemistry.cpp to expose HydrophobicityProfile and its methods (and any new enums/functions such as HydrophobicityScaleMethod and Residue::getHydrophobicity) or explicitly document that these types are C++-only; update bind_chemistry.cpp to register a nanobind class_ for HydrophobicityProfile with its constructors and methods and bind the enum/methods so the rg check finds matches, or add a comment in the binding area explaining intentional exclusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Around line 61-83: Update the Doxygen `@throw` entries for computeProfile and
computeWindowedProfile to also document that Exception::InvalidValue can be
thrown if an unsupported HydrophobicityScaleMethod is provided (propagated from
Residue::getHydrophobicity); specifically, add a second `@throw`
Exception::InvalidValue line or extend the existing one to mention "invalid
scale value (unsupported HydrophobicityScaleMethod)" so readers see both
empty/invalid-sequence and invalid-scale cases for these methods.
- Around line 11-15: The header OpenMS/CHEMISTRY/HydrophobicityProfile.h uses
the enum HydrophobicityScaleMethod in default arguments (e.g. the functions that
declare default parameters using HydrophobicityScaleMethod), but does not
include its defining header; add a direct include of
OpenMS/CONCEPT/CommonEnums.h at the top of HydrophobicityProfile.h so the
HydrophobicityScaleMethod type is available to any translation unit including
this header and resolves the compilation error.
---
Duplicate comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Line 50: The new public C++ API declares HydrophobicityProfile (and related
symbols like HydrophobicityScaleMethod and Residue::getHydrophobicity) but the
pyOpenMS bindings were not updated; either add nanobind wrappers in
bind_chemistry.cpp to expose HydrophobicityProfile and its methods (and any new
enums/functions such as HydrophobicityScaleMethod and
Residue::getHydrophobicity) or explicitly document that these types are
C++-only; update bind_chemistry.cpp to register a nanobind class_ for
HydrophobicityProfile with its constructors and methods and bind the
enum/methods so the rg check finds matches, or add a comment in the binding area
explaining intentional exclusion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 46221415-b522-4120-b9a1-20ec6c242572
📒 Files selected for processing (5)
src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.hsrc/openms/include/OpenMS/CHEMISTRY/Residue.hsrc/openms/source/CHEMISTRY/HydrophobicityProfile.cppsrc/openms/source/CHEMISTRY/Residue.cppsrc/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp
✅ Files skipped from review due to trivial changes (1)
- src/tests/class_tests/openms/source/HydrophobicityProfile_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp
| #include <OpenMS/CHEMISTRY/AASequence.h> | ||
| #include <OpenMS/CONCEPT/LogStream.h> | ||
| #include <OpenMS/CONCEPT/Types.h> | ||
| #include <functional> | ||
| #include <sstream> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Expected: HydrophobicityProfile.h directly includes CommonEnums.h and still references HydrophobicityScaleMethod.
rg -n 'CommonEnums|HydrophobicityScaleMethod' src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.hRepository: OpenMS/OpenMS
Length of output: 275
🏁 Script executed:
#!/bin/bash
# Find where HydrophobicityScaleMethod is defined
rg -l 'enum.*HydrophobicityScaleMethod|class HydrophobicityScaleMethod' src/openms/include/OpenMS/ --type hRepository: OpenMS/OpenMS
Length of output: 104
🏁 Script executed:
#!/bin/bash
# Check what AASequence.h includes (to see if CommonEnums comes transitively)
rg -n '#include' src/openms/include/OpenMS/CHEMISTRY/AASequence.h | head -20Repository: OpenMS/OpenMS
Length of output: 408
🏁 Script executed:
#!/bin/bash
# Inspect the full HydrophobicityProfile.h file to check exception documentation
cat -n src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h | sed -n '50,100p'Repository: OpenMS/OpenMS
Length of output: 3388
🏁 Script executed:
#!/bin/bash
# Check if HydrophobicityScaleMethod is an enum class and what values it has
rg -A 15 'enum.*HydrophobicityScaleMethod' src/openms/include/OpenMS/CONCEPT/CommonEnums.hRepository: OpenMS/OpenMS
Length of output: 293
🏁 Script executed:
#!/bin/bash
# Check the implementation to see if scale validation occurs
rg -n 'computeProfile|computeWindowedProfile' src/openms/source/OpenMS/CHEMISTRY/HydrophobicityProfile.cpp | head -5Repository: OpenMS/OpenMS
Length of output: 157
🏁 Script executed:
#!/bin/bash
# Find the implementation file for HydrophobicityProfile
find src/openms/source -name '*HydrophobicityProfile*' -type fRepository: OpenMS/OpenMS
Length of output: 110
🏁 Script executed:
#!/bin/bash
# Also check if there's any Residue::getHydrophobicity call that might fail
rg -A 10 'getHydrophobicity' src/openms/include/OpenMS/CHEMISTRY/ | head -30Repository: OpenMS/OpenMS
Length of output: 779
🏁 Script executed:
#!/bin/bash
# Check the implementation of computeProfile to see exception handling for scale
cat -n src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp | head -60Repository: OpenMS/OpenMS
Length of output: 2236
🏁 Script executed:
#!/bin/bash
# Check Residue::getHydrophobicity implementation
rg -B 2 -A 15 'getHydrophobicity.*HydrophobicityScaleMethod' src/openms/source/CHEMISTRY/Residue.cppRepository: OpenMS/OpenMS
Length of output: 660
🏁 Script executed:
#!/bin/bash
# Also verify the current includes in HydrophobicityProfile.h
head -20 src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.hRepository: OpenMS/OpenMS
Length of output: 620
Include the enum definition directly.
Lines 68 and 82 use HydrophobicityScaleMethod in default arguments, so this header must directly include OpenMS/CONCEPT/CommonEnums.h. Currently this type is not directly included and will cause compilation failures for users of this header.
Proposed include fix
`#include` <OpenMS/CHEMISTRY/AASequence.h>
+#include <OpenMS/CONCEPT/CommonEnums.h>
`#include` <OpenMS/CONCEPT/LogStream.h>
`#include` <OpenMS/CONCEPT/Types.h>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h` around lines 11
- 15, The header OpenMS/CHEMISTRY/HydrophobicityProfile.h uses the enum
HydrophobicityScaleMethod in default arguments (e.g. the functions that declare
default parameters using HydrophobicityScaleMethod), but does not include its
defining header; add a direct include of OpenMS/CONCEPT/CommonEnums.h at the top
of HydrophobicityProfile.h so the HydrophobicityScaleMethod type is available to
any translation unit including this header and resolves the compilation error.
…to functions, improved readability of documentation
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h (1)
11-15:⚠️ Potential issue | 🟡 MinorMake this public header self-contained.
This header directly uses
HydrophobicityScaleMethodandstd::vector, so it should include their defining headers instead of relying on transitive includes fromAASequence.h.Suggested include fix
`#include` <OpenMS/CHEMISTRY/AASequence.h> +#include <OpenMS/CONCEPT/CommonEnums.h> `#include` <OpenMS/CONCEPT/LogStream.h> `#include` <OpenMS/CONCEPT/Types.h> `#include` <functional> `#include` <sstream> +#include <vector>Verify with:
#!/bin/bash # Expected after the fix: HydrophobicityProfile.h directly includes CommonEnums.h and <vector>. rg -n 'HydrophobicityScaleMethod|std::vector|#include <OpenMS/CONCEPT/CommonEnums.h>|#include <vector>' src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h` around lines 11 - 15, The header is not self-contained because it uses HydrophobicityScaleMethod and std::vector without including their defining headers; update HydrophobicityProfile.h to directly include OpenMS/CONCEPT/CommonEnums.h (for HydrophobicityScaleMethod) and <vector> (for std::vector) so it no longer depends on transitive includes from AASequence.h, keeping existing includes (e.g., AASequence.h, LogStream.h, Types.h) intact; verify by ensuring references to HydrophobicityScaleMethod and std::vector compile with only this header included.
🧹 Nitpick comments (2)
src/openms/source/CHEMISTRY/Residue.cpp (1)
633-711: Minor: hardcoded7couples to enum size; consider deriving from the enum.The bound
7inscale_idx >= 7and the outer dimension ofscales[7][26]must be kept in sync manually withHydrophobicityScaleMethodinCommonEnums.h. If a new scale is ever appended to the enum without extending this table,static_cast<int>(scale)will silently index past the last initialized row and return garbage (thescale_idx >= 7guard won't fire). A simple guard is to size the table from the array itself and validate against that, e.g.:Proposed tightening
- static const double scales[7][26] = + static const double scales[][26] = { ... }; + constexpr size_t NUM_SCALES = sizeof(scales) / sizeof(scales[0]); const int scale_idx = static_cast<int>(scale); - if (scale_idx < 0 || scale_idx >= 7) + if (scale_idx < 0 || static_cast<size_t>(scale_idx) >= NUM_SCALES) { throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Unknown hydrophobicity scale", String(scale_idx)); }Also a small nit: the comment on line 650 says
KyteDoolitlle— should beKyte-Doolittle.Separately, comparing a
doubleagainst the sentinel999with==works here only because999is exactly representable and stored verbatim, but a named constant (e.g.constexpr double UNKNOWN = 999.0;) would make the intent clearer and avoid any future silent drift if values are ever computed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/CHEMISTRY/Residue.cpp` around lines 633 - 711, The getHydrophobicity implementation uses a hardcoded 7 and raw magic value 999 which can drift from HydrophobicityScaleMethod and is unclear; update Residue::getHydrophobicity to derive the number of rows from the scales array (use something like rows = sizeof(scales)/sizeof(scales[0]) or a constexpr sized container) and validate scale_idx against that derived rows value instead of 7, introduce a named sentinel (e.g. constexpr double UNKNOWN = 999.0) and compare result against UNKNOWN, and fix the comment spelling "KyteDoolitlle" -> "Kyte-Doolittle"; ensure references to scales, scale_idx, result, and HydrophobicityScaleMethod are updated accordingly.src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h (1)
49-90: Add Doxygen parameter directions for the public API.The public method docs should use
@param[in]for all input parameters.Documentation polish
- /// `@param` seq The amino acid sequence for which to calculate the GRAVY score + /// `@param`[in] seq The amino acid sequence for which to calculate the GRAVY score @@ - /// `@param` seq The amino acid sequence for which to calculate the profile - /// `@param` scale The scale to use for the calculation + /// `@param`[in] seq The amino acid sequence for which to calculate the profile + /// `@param`[in] scale The scale to use for the calculation @@ - /// `@param` seq The Amino acid Sequence for which to calculate the profile - /// `@param` window_size The size of the sliding window for the calculation - /// `@param` scale The scale to use for the calculation + /// `@param`[in] seq The Amino acid Sequence for which to calculate the profile + /// `@param`[in] window_size The size of the sliding window for the calculation + /// `@param`[in] scale The scale to use for the calculation @@ - /// `@param` seq The Amino acid sequence - /// `@param` window_size The size of the sliding window for the calculation - /// `@param` angle The angle to use: 100 for alpha-helices, 160 for beta-sheets, other angles can be used + /// `@param`[in] seq The Amino acid sequence + /// `@param`[in] window_size The size of the sliding window for the calculation + /// `@param`[in] angle The angle to use: 100 for alpha-helices, 160 for beta-sheets, other angles can be usedAs per coding guidelines, “include parameter directions
[in],[out], or[in,out]for all parameters”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h` around lines 49 - 90, Update the Doxygen parameter tags for the public API methods computeGRAVY, computeProfile, computeWindowedProfile, and computeHydrophobicMoment to use `@param`[in] for all input parameters (e.g., seq, window_size, scale, angle) instead of `@param`; leave `@return` and `@throw` entries unchanged and keep the existing warnings intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Around line 11-15: The header is not self-contained because it uses
HydrophobicityScaleMethod and std::vector without including their defining
headers; update HydrophobicityProfile.h to directly include
OpenMS/CONCEPT/CommonEnums.h (for HydrophobicityScaleMethod) and <vector> (for
std::vector) so it no longer depends on transitive includes from AASequence.h,
keeping existing includes (e.g., AASequence.h, LogStream.h, Types.h) intact;
verify by ensuring references to HydrophobicityScaleMethod and std::vector
compile with only this header included.
---
Nitpick comments:
In `@src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.h`:
- Around line 49-90: Update the Doxygen parameter tags for the public API
methods computeGRAVY, computeProfile, computeWindowedProfile, and
computeHydrophobicMoment to use `@param`[in] for all input parameters (e.g., seq,
window_size, scale, angle) instead of `@param`; leave `@return` and `@throw` entries
unchanged and keep the existing warnings intact.
In `@src/openms/source/CHEMISTRY/Residue.cpp`:
- Around line 633-711: The getHydrophobicity implementation uses a hardcoded 7
and raw magic value 999 which can drift from HydrophobicityScaleMethod and is
unclear; update Residue::getHydrophobicity to derive the number of rows from the
scales array (use something like rows = sizeof(scales)/sizeof(scales[0]) or a
constexpr sized container) and validate scale_idx against that derived rows
value instead of 7, introduce a named sentinel (e.g. constexpr double UNKNOWN =
999.0) and compare result against UNKNOWN, and fix the comment spelling
"KyteDoolitlle" -> "Kyte-Doolittle"; ensure references to scales, scale_idx,
result, and HydrophobicityScaleMethod are updated accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6eac6515-6fe0-4804-95ba-b3e2a058888e
📒 Files selected for processing (5)
src/openms/include/OpenMS/CHEMISTRY/HydrophobicityProfile.hsrc/openms/include/OpenMS/CHEMISTRY/Residue.hsrc/openms/include/OpenMS/CONCEPT/CommonEnums.hsrc/openms/source/CHEMISTRY/HydrophobicityProfile.cppsrc/openms/source/CHEMISTRY/Residue.cpp
🚧 Files skipped from review as they are similar to previous changes (3)
- src/openms/include/OpenMS/CHEMISTRY/Residue.h
- src/openms/include/OpenMS/CONCEPT/CommonEnums.h
- src/openms/source/CHEMISTRY/HydrophobicityProfile.cpp
Description
Added hydrophobicity scale data by adding the function getHydrophobicity() to the Residue which returns the hydrophobocity value for an amino acid in a given scale.
Added the new class HydrophobicityProfile which is used for calculation hydrophobicity profiles for peptides.
It has functions for calculating GRAVY score, hydrophobicity profiles, windowed hydrophobicity profiles and hydrophobic moments of a peptide.
for Issue #9005
Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkinswill retrigger Jenkins-based CI buildsSummary by CodeRabbit
New Features
Tests
Chores