Repository navigation
refactor: peptide id - move rank to metavalue - #7997
Conversation
|
""" WalkthroughThe changes refactor the PeptideHit class to remove the explicit rank member variable, storing rank as a meta value instead. Static constants for the rank meta key and default value are introduced. Constructors, assignment operators, and methods are updated accordingly. Numerous test output files are updated to include rank as a user parameter in peptide hits. Additionally, rank handling in file formats (mzIdentML, pepXML) is adjusted to convert between 0-based internal and 1-based external indexing. The IDFilter interface is simplified by removing a peptide-based Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant PeptideHit
participant MetaInfoInterface
User->>PeptideHit: setRank(value)
PeptideHit->>MetaInfoInterface: setMetaValue("rank", value)
Note right of MetaInfoInterface: Stores rank as meta value
User->>PeptideHit: getRank()
PeptideHit->>MetaInfoInterface: getMetaValue("rank")
MetaInfoInterface-->>PeptideHit: returns value or DEFAULT_RANK
PeptideHit-->>User: returns rank
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (5)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This comment was marked as outdated.
This comment was marked as outdated.
|
Can you comment on the reasoning for still having the "default" rank? |
|
This is mainly for backwards compatibility reasons. |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/openms/include/OpenMS/PROCESSING/ID/IDFilter.h(1 hunks)src/tests/topp/CMakeLists.txt(1 hunks)src/tests/topp/THIRDPARTY/Chy_test.idXML(2 hunks)src/tests/topp/THIRDPARTY/CometAdapter_1_out.idXML(2 hunks)src/tests/topp/THIRDPARTY/CometAdapter_2_out.idXML(7 hunks)src/tests/topp/THIRDPARTY/CometAdapter_3_out.idXML(3 hunks)src/tests/topp/THIRDPARTY/CometAdapter_6_out.idXML(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- src/tests/topp/THIRDPARTY/CometAdapter_2_out.idXML
- src/tests/topp/THIRDPARTY/CometAdapter_3_out.idXML
🚧 Files skipped from review as they are similar to previous changes (3)
- src/tests/topp/THIRDPARTY/CometAdapter_1_out.idXML
- src/tests/topp/THIRDPARTY/Chy_test.idXML
- src/tests/topp/THIRDPARTY/CometAdapter_6_out.idXML
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: cppcheck-test
🔇 Additional comments (1)
src/tests/topp/CMakeLists.txt (1)
3137-3137: Added 'SearchDatabase' to whitelist for test comparison - LGTM.This change adds "SearchDatabase" to the whitelist for the diff comparison in the PSMFeatureExtractor test output. This is appropriate as it aligns with the PR's refactoring of rank handling, which affects metadata in test output files. When ranks are stored as meta values instead of member variables, differences in XML output are expected, and this whitelist addition ensures the test properly validates the new behavior.
I removed it. Just use plain 0. |
jpfeuffer
left a comment
There was a problem hiding this comment.
All fine with me. Didn't check code logic in detail.
Based on description and overall look, looks good.
| rank = StringManager::convert(spectrumIdentificationItemElement->getAttribute(CONST_XMLCH("rank"))).toInt(); | ||
| if (rank == 0) | ||
| { | ||
| // MzIdentML ranks are typically 1-based. For some special data (PMF) it can be 0. |
There was a problem hiding this comment.
What the heck? 😂 Do we still need mzidentml?
There was a problem hiding this comment.
I think MSGFPlus uses it? not sure though...
| } | ||
|
|
||
| f << "\t\t<search_hit hit_rank=\"1\" peptide=\"" | ||
| f << "\t\t<search_hit hit_rank=\"" << String(h.getRank() + 1) << "\" peptide=\"" // rank in pepXML is 1-based, 0-based in OpenMS |
There was a problem hiding this comment.
So this was never written to pepxml anyway?
This pull request refactors rank handling in the OpenMS codebase by replacing it with a new approach that stores ranks as meta values. It also updates related rank-based operations and simplifies the code structure.
If a rank got never assigned, no meta value needs to be stored and written out. This "default" is rank=0.
Setting a rank to default with setRank(0) prevents that it is written out to idXML (as rank 0 is implicit).
When importing data from external formats like pepXML or mzIdentML, OpenMS reads the rank information provided. If the imported rank is not 0 (or 1 depending how they are based in the file format), OpenMS stores it as a meta value to preserve the original ranking information from the external source. This ensures that any non-default ranks assigned by other search engines are retained during data processing.
This pull request introduces significant changes to how peptide hit ranks are managed in the OpenMS library, transitioning from a dedicated member variable to storing ranks as meta values. It also includes updates to related methods, file handlers, and tests to align with this new approach. Below is a summary of the most important changes:
Peptide Hit Rank Refactoring:
rank_member variable fromPeptideHitand replaced it with a meta value using the key"rank"for backward compatibility. This ensures ranks are stored as meta values instead of a direct class member. ([[1]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-f57d0fe81ff42dba982fa9f9f2d4d83db5845f66fff737b3a0902e845f285e56L290-L292),[[2]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-70fb8b85bc442403ca3eae6bc8b2623f975050af018cf10e96323927c24c5ff6L143-R152),[[3]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-70fb8b85bc442403ca3eae6bc8b2623f975050af018cf10e96323927c24c5ff6L332-R349))PeptideHitconstructor andsetRankmethod to handle the rank as a meta value, with default rank (0) not being stored explicitly. ([[1]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-70fb8b85bc442403ca3eae6bc8b2623f975050af018cf10e96323927c24c5ff6R10-R85),[[2]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-70fb8b85bc442403ca3eae6bc8b2623f975050af018cf10e96323927c24c5ff6L332-R349))getRankmethod to retrieve the rank from meta values, defaulting to0if not set. ([src/openms/source/METADATA/PeptideHit.cppL143-R152](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-70fb8b85bc442403ca3eae6bc8b2623f975050af018cf10e96323927c24c5ff6L143-R152))Updates to Filtering and Sorting:
filterHitsByRankmethod inIDFilterby removing explicit rank calculation logic and instead relying on the updated rank handling mechanism. ([src/openms/include/OpenMS/PROCESSING/ID/IDFilter.hL902-R927](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-551b8cf5af907a3a1534ef80b20ed5ca34e1ce4c87cf864e218d6188d895eef5L902-R927))updateHitRanksmethod fromIDFilteras it is no longer necessary with the new rank handling. ([src/pyOpenMS/pxds/IDFilter.pxdL80](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-3b3bbe829f276767eeea58af38db0dce7c9f1a428a33b3e53cb22524c5304dd3L80))File Format Adjustments:
[[1]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-e4574eb9f0cd35d749b40f507752fde2333bd97f18a348e27eabd4aff75797e9L2043-R2043),[[2]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-f4393735b439104f428d4c0b4ed61c37138594bf5ce2922c521b762f9b015978L339-R340),[[3]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-5b4ff2575a11d9aef1db84b0346d167d37a6e904cb6381437fdfe52dbf1ea11aL643-R643))[[1]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-f4393735b439104f428d4c0b4ed61c37138594bf5ce2922c521b762f9b015978L2098-R2099),[[2]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-5b4ff2575a11d9aef1db84b0346d167d37a6e904cb6381437fdfe52dbf1ea11aL1307-R1308))Test Updates:
PeptideHitimplementation. ([[1]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-88ccad1148b828c54c4c317c0f630fedd3bf2c942d2ef2ca69fb225066b13c37L96-R96),[[2]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-88ccad1148b828c54c4c317c0f630fedd3bf2c942d2ef2ca69fb225066b13c37L227-R227),[[3]](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-88ccad1148b828c54c4c317c0f630fedd3bf2c942d2ef2ca69fb225066b13c37L370-R370))Miscellaneous:
RANKinConstants.hto standardize the meta value key for rank. ([src/openms/include/OpenMS/CONCEPT/Constants.hR571-R575](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-3da0f7da14951308957e047a5ccc6bebb8a11e49a080e2fe884685d2d2da4056R571-R575))CHANGELOGto document the removal ofrank_and related methods, as well as the transition to storing ranks as meta values. ([CHANGELOGL28-R29](https://github.com/OpenMS/OpenMS/pull/7997/files#diff-ecec88c33adb7591ee6aa88e29b62ad52ef443611cba5e0f0ecac9b5725afdbaL28-R29))Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Style
Documentation
Tests
Chores