Repository navigation
refactor: move significance_threshold and pepXML analysis results member in PeptideIdentifications to a meta value as it is often unused - #7985
Conversation
WalkthroughThis change refactors the handling of analysis results and significance thresholds in the OpenMS metadata classes. In Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant PeptideHit
participant MetaInfoInterface
User->>PeptideHit: setAnalysisResults(vector<AnalysisResult>)
PeptideHit->>MetaInfoInterface: Clear old analysis result meta values
PeptideHit->>MetaInfoInterface: Store each AnalysisResult as meta values
User->>PeptideHit: getAnalysisResults()
PeptideHit->>MetaInfoInterface: Extract analysis results from meta values
PeptideHit-->>User: vector<AnalysisResult>
sequenceDiagram
participant User
participant PeptideIdentification
participant MetaInfoInterface
User->>PeptideIdentification: setSignificanceThreshold(value)
PeptideIdentification->>MetaInfoInterface: Set meta value "significance_threshold"
User->>PeptideIdentification: getSignificanceThreshold()
PeptideIdentification->>MetaInfoInterface: Get meta value "significance_threshold"
PeptideIdentification-->>User: value
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/openms/source/METADATA/PeptideIdentification.cpp (2)
40-40: Avoid direct floating-point equality for significance thresholds.Comparing doubles with
==can lead to unexpected results due to floating-point precision. Consider an approximate comparison instead.Apply this diff to change exact equality into a tolerance check, and ensure
<cmath>is included:- && getSignificanceThreshold() == rhs.getSignificanceThreshold() + && std::fabs(getSignificanceThreshold() - rhs.getSignificanceThreshold()) < 1e-12+#include <cmath>
254-254: Use an epsilon-based comparison instead of== 0.0.Directly comparing to zero can miss floating-point inaccuracies. Use a negligible threshold check.
Apply this diff:
- && getSignificanceThreshold() == 0.0 + && std::fabs(getSignificanceThreshold()) < 1e-12src/openms/source/METADATA/PeptideHit.cpp (1)
246-250:thread_localcaching forgetAnalysisResultsis efficient, but be cautious.Returning a reference to a thread-local static vector avoids frequent allocations. Just ensure the caller does not store this reference across multiple calls.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/openms/include/OpenMS/CONCEPT/Constants.h(1 hunks)src/openms/include/OpenMS/METADATA/PeptideHit.h(2 hunks)src/openms/include/OpenMS/METADATA/PeptideIdentification.h(3 hunks)src/openms/source/METADATA/PeptideHit.cpp(1 hunks)src/openms/source/METADATA/PeptideIdentification.cpp(4 hunks)src/tests/class_tests/openms/source/PeptideHit_test.cpp(1 hunks)src/tests/class_tests/openms/source/PeptideIdentification_test.cpp(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/openms/source/METADATA/PeptideIdentification.cpp (2)
src/openms/include/OpenMS/METADATA/PeptideIdentification.h (4)
getSignificanceThreshold(115-115)rhs(83-83)rhs(85-85)setSignificanceThreshold(117-117)src/tests/class_tests/openms/source/PeptideIdentification_test.cpp (2)
metaValueExists(503-503)getMetaValue(504-504)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: build-and-test (windows-2022, cl.exe, default)
- 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 (21)
src/openms/include/OpenMS/CONCEPT/Constants.h (1)
566-570: Good addition of the significance threshold constant.This new constant and documentation align well with existing user parameter definitions, promoting maintainable meta value usage.
src/tests/class_tests/openms/source/PeptideIdentification_test.cpp (1)
236-262: Thorough test coverage for significance threshold meta value.These tests effectively validate default initialization, setting, and copying of the new meta value. Consider adding boundary or negative-value checks if relevant, but overall the coverage is solid.
src/openms/include/OpenMS/METADATA/PeptideHit.h (3)
22-23: Alias introduction for PeptideHit.Renaming
PeptideHitthroughusing SpectrumMatchis clear and self-documenting. This addition should not break existing code because it’s purely an alias.
26-36: Expanded class documentation.This updated doc block accurately reflects the metadata-driven design and clarifies how
PeptideHitis used within the framework.
299-306: Private helper methods enhance readability.The new functions for extracting and counting analysis results from meta values keep the core interface clean. They appear well-documented and maintainable.
src/tests/class_tests/openms/source/PeptideHit_test.cpp (8)
269-360: Great test coverage forsetAnalysisResults.These test scenarios thoroughly verify overwriting of existing analysis results and synchronization with meta values. No issues found.
362-400: Comprehensive validation ofaddAnalysisResults.The addition of multiple analysis results and proper meta value handling are well-verified.
401-421: Adequate checks forgetAnalysisResults.Retrieving empty vs. populated analysis results is confirmed, ensuring correct meta value reconstruction.
422-449: Copy constructor tests look solid.These tests confirm that analysis results are copied correctly, including meta values and sub-scores.
450-478: Assignment operator coverage is well-designed.Verifying that analysis results are properly reassigned ensures consistent meta value behavior.
479-514: Equality operator checks are comprehensive.Different combinations of analysis results and sub-scores are thoroughly compared.
516-547: Move constructor handling is verified thoroughly.Ensuring analysis results and meta values are moved correctly helps prevent unintended data copy and potential leaks.
549-579: Move assignment tests are robust.The tests confirm that all analysis results are transferred properly, leaving the source PeptideHit empty.
src/openms/source/METADATA/PeptideIdentification.cpp (1)
28-29: Initializing significance threshold as a meta value is a good design.Setting the default to 0.0 via a meta value simplifies metadata management and remains consistent with the new approach.
src/openms/include/OpenMS/METADATA/PeptideIdentification.h (3)
22-25: New aliasSpectrumIdentificationis well-introduced.This forward declaration and alias can simplify future naming transitions.
26-57: Documentation improvements are clear and thorough.The expanded explanation of retention time, m/z, and the relationship to
ProteinIdentificationfurther clarifies usage.
114-117: Updated significance threshold docs align with the meta value approach.This clarifies how the threshold is stored and retrieved, promoting consistency.
src/openms/source/METADATA/PeptideHit.cpp (4)
204-228: Removing existing analysis results before resetting is a clean approach.Purging old meta values ensures we do not mix stale and new analysis results.
232-242: Indexing new analysis results is straightforward.Acquiring the current count from meta values prevents overwriting existing entries.
253-268: Counting analysis results by detecting ScoreType keys is consistent.This logic is simple and effective for enumerating all result entries.
270-327: Extracting sub-scores inextractAnalysisResultsFromMetaValues_is well-structured.Iterating over meta keys by index is a clear approach. The overall design is readable and logically sound.
|
I like the cleanups. Have you checked how often "rank" is used? Would be a candidate for removal IMHO. |
I think it is used quite frequently and it could have some performance impact - I can take a look. |
|
Really? I was convinced that I have never seen an occurrence where rank is actually needed for an algorithm. |
Totally agree and I want to get rid of it. I think last time I checked there was some funky semantics (e.g. hits with same score had same rank; sometimes same rank reported by search engine etc.). One would need to check individually if it breaks something if we just rely on the order in the vector... |
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp (1)
403-409: 🛠️ Refactor suggestion
⚠️ Potential issueDo not silently discard a legitimate threshold value of 0.0.
Using
double tmp = 0.0; optionalAttributeAsDouble_(tmp, …)and subsequently testingtmp != 0.0means:
- a missing attribute and an attribute explicitly set to
0.0are treated identically;- when writing, the code later serialises
significance_threshold="0"unconditionally (id.getSignificanceThreshold()defaults to0).If a workflow genuinely wants to record a zero threshold this information will now be lost on round‑trip.
Suggested approach:
-double tmp = 0.0; -if (optionalAttributeAsDouble_(tmp, attributes, "significance_threshold") /* returns true when present */) -{ - prot_id_.setSignificanceThreshold(tmp); -} +double tmp; +if (optionalAttributeAsDouble_(tmp, attributes, "significance_threshold")) +{ + prot_id_.setSignificanceThreshold(tmp); +}Repeat for the
PeptideIdentificationbranch.
Additionally, during writing only emit the attribute when the meta value was actually present or when a dedicated “is set” flag is true.Also applies to: 451-454
🧹 Nitpick comments (3)
src/openms/source/METADATA/PeptideHit.cpp (2)
203-229: Consider serialising the boolean flag as an actual boolean/int DataValue.The meta value
_ar_*_higher_is_betteris stored as the strings"true"/"false"and later parsed viatoBool().
While this works, using anint(1/0) (or a dedicated bool‑to‑int helper) avoids the extra string parsing cost and removes any locale‑dependent pitfalls.Not urgent, but a small improvement in both performance and robustness.
250-266: Minor optimisation: avoid repeated key scans in tight loops.
getNumberOfAnalysisResultsFromMetaValues_()rebuilds the complete key list and iterates over it every time it is called (e.g. once peraddAnalysisResults).
If many analysis results are added in succession, caching the count or incrementing it directly would be O(1) instead of O(N·K).Not blocking, just pointing out a potential micro‑optimisation path.
src/openms/source/FORMAT/MzTab.cpp (1)
1170-1172: Improve code clarity with more descriptive commentThe comment explains that this key is being removed for backward compatibility, but it would be more informative to mention that this key is now handled as a standard meta value through a constant in Constants.h (judging from the PR description).
- // remove key that only exists for backwards compatibility (will likely be deprecated in the future) + // Remove significance_threshold from meta values to avoid duplication since it's stored as a dedicated attribute + // and now managed via Constants::UserParam::SIGNIFICANCE_THRESHOLD
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
src/openms/include/OpenMS/METADATA/PeptideHit.h(2 hunks)src/openms/include/OpenMS/METADATA/PeptideIdentification.h(2 hunks)src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp(2 hunks)src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp(1 hunks)src/openms/source/FORMAT/IdXMLFile.cpp(3 hunks)src/openms/source/FORMAT/MzTab.cpp(4 hunks)src/openms/source/METADATA/ID/IdentificationDataConverter.cpp(1 hunks)src/openms/source/METADATA/PeptideHit.cpp(2 hunks)src/tests/class_tests/openms/source/PeptideHit_test.cpp(1 hunks)src/tests/topp/IDFileConverter_10_output.idXML(8 hunks)src/tests/topp/IDFileConverter_16_output.idXML(6 hunks)src/tests/topp/IDFileConverter_24_output.idXML(2 hunks)src/tests/topp/THIRDPARTY/Chy_test.tmp.idXML(1 hunks)src/tests/topp/THIRDPARTY/CometAdapter_1_out.idXML(1 hunks)src/tests/topp/THIRDPARTY/CometAdapter_2_out.idXML(1 hunks)src/tests/topp/THIRDPARTY/CometAdapter_3_out.idXML(1 hunks)src/tests/topp/THIRDPARTY/CometAdapter_4_out.idXML(1 hunks)src/tests/topp/THIRDPARTY/CometAdapter_6_out.idXML(1 hunks)src/topp/TextExporter.cpp(3 hunks)
✅ Files skipped from review due to trivial changes (12)
- src/tests/topp/THIRDPARTY/CometAdapter_2_out.idXML
- src/tests/topp/IDFileConverter_24_output.idXML
- src/openms/source/METADATA/ID/IdentificationDataConverter.cpp
- src/tests/topp/THIRDPARTY/CometAdapter_4_out.idXML
- src/tests/topp/IDFileConverter_10_output.idXML
- src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp
- src/tests/topp/THIRDPARTY/CometAdapter_1_out.idXML
- src/tests/topp/THIRDPARTY/Chy_test.tmp.idXML
- src/tests/topp/IDFileConverter_16_output.idXML
- src/openms/include/OpenMS/METADATA/PeptideIdentification.h
- src/tests/topp/THIRDPARTY/CometAdapter_6_out.idXML
- src/tests/topp/THIRDPARTY/CometAdapter_3_out.idXML
🚧 Files skipped from review as they are similar to previous changes (2)
- src/openms/include/OpenMS/METADATA/PeptideHit.h
- src/tests/class_tests/openms/source/PeptideHit_test.cpp
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- 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 (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (windows-2022, cl.exe, default)
- GitHub Check: cppcheck-test
🔇 Additional comments (10)
src/topp/TextExporter.cpp (3)
690-696: LGTM – duplicate “significance_threshold” column is correctly filtered.
865-872: LGTM – keeps exported consensus files free of duplicate thresholds.
1347-1353: LGTM – prevents duplicate meta columns for idXML export as well.src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp (1)
904-908: Good – meta value removal avoids duplicate XML output.src/openms/source/FORMAT/MzTab.cpp (3)
2459-2460: Apply consistent removal pattern for meta valueGood removal of the significance_threshold to maintain consistency with the member variable to meta value refactoring approach. This ensures the key doesn't appear as an optional meta value column in mzTab output.
2536-2537: Apply consistent cleanup for meta valuesThis properly removes both "spectrum_reference" and "significance_threshold" to prevent these values from being duplicated in the output. This is consistent with the refactoring approach.
2559-2560: Ensure consistent management of meta valuesThis correctly removes the significance_threshold key after extracting meta values, which is consistent with the overall refactoring approach of moving the significance threshold to a meta value.
src/openms/source/FORMAT/IdXMLFile.cpp (3)
221-223: Improve numerical-to-string conversionExplicitly converting the significance_threshold to a String ensures proper formatting in the XML output. This is a good defensive programming practice to avoid potential issues with floating-point representation.
287-289: Consistent explicit string conversionThis change applies the same explicit string conversion pattern as used for protein IDs, maintaining consistency throughout the code. This is good practice for XML serialization.
374-375: Eliminate duplicate meta value in XML outputRemoving the "significance_threshold" meta value before writing user parameters prevents duplication, since it's already written as an XML attribute. This ensures clean, non-redundant output.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/openms/source/METADATA/PeptideHit.cpp (4)
202-228: Refactoring looks good with some potential optimizations.The implementation correctly manages analysis results as meta values instead of a dedicated member variable. This follows the intended refactoring from the PR objectives.
The current implementation scans all meta value keys and does multiple string operations. Consider these optimizations:
void PeptideHit::setAnalysisResults(const std::vector<PeptideHit::PepXMLAnalysisResult>& aresult) { // Remove all existing analysis result meta values - std::vector<String> keys; - getKeys(keys); - for (const auto& key : keys) - { - if (key.hasPrefix("_ar_")) - { - removeMetaValue(key); - } - } + // Define constants for prefixes to improve maintainability + const String AR_PREFIX = "_ar_"; + + // Use a more efficient approach to remove specific meta values + std::vector<String> keys_to_remove; + std::vector<String> all_keys; + getKeys(all_keys); + for (const auto& key : all_keys) + { + if (key.hasPrefix(AR_PREFIX)) + { + keys_to_remove.push_back(key); + } + } + + for (const auto& key : keys_to_remove) + { + removeMetaValue(key); + } // Add new analysis results as meta values for (size_t i = 0; i < aresult.size(); ++i) { const auto& ar = aresult[i]; - setMetaValue("_ar_" + String(i) + "_score_type", ar.score_type); - setMetaValue("_ar_" + String(i) + "_score", ar.main_score); - setMetaValue("_ar_" + String(i) + "_higher_is_better", ar.higher_is_better == true ? "true" : "false"); + String index_prefix = AR_PREFIX + String(i) + "_"; + setMetaValue(index_prefix + "score_type", ar.score_type); + setMetaValue(index_prefix + "score", ar.main_score); + setMetaValue(index_prefix + "higher_is_better", ar.higher_is_better == true ? "true" : "false"); for (const auto& subscore : ar.sub_scores) { - setMetaValue("_ar_" + String(i) + "_subscore_" + subscore.first, subscore.second); + setMetaValue(index_prefix + "subscore_" + subscore.first, subscore.second); } } }
230-242: Consider consistency with the prefix handling.The implementation correctly adds a new analysis result by determining the next available index. However, the string prefixes could be handled more consistently.
void PeptideHit::addAnalysisResults(const PeptideHit::PepXMLAnalysisResult& aresult) { size_t index = getNumberOfAnalysisResultsFromMetaValues_(); - setMetaValue("_ar_" + String(index) + "_score_type", aresult.score_type); - setMetaValue("_ar_" + String(index) + "_score", aresult.main_score); - setMetaValue("_ar_" + String(index) + "_higher_is_better", aresult.higher_is_better == true ? "true" : "false"); + const String AR_PREFIX = "_ar_"; + String index_prefix = AR_PREFIX + String(index) + "_"; + setMetaValue(index_prefix + "score_type", aresult.score_type); + setMetaValue(index_prefix + "score", aresult.main_score); + setMetaValue(index_prefix + "higher_is_better", aresult.higher_is_better == true ? "true" : "false"); for (const auto& subscore : aresult.sub_scores) { - setMetaValue("_ar_" + String(index) + "_subscore_" + subscore.first, subscore.second); + setMetaValue(index_prefix + "subscore_" + subscore.first, subscore.second); } }
249-265: Efficient implementation but could benefit from using constants.The function correctly counts the number of analysis results by searching for meta value keys with specific prefixes and suffixes.
Consider defining constants for the prefixes and suffixes to improve maintainability:
size_t PeptideHit::getNumberOfAnalysisResultsFromMetaValues_() const { size_t count = 0; std::vector<String> keys; getKeys(keys); + const String AR_PREFIX = "_ar_"; + const String SCORE_TYPE_SUFFIX = "_score_type"; + for (const auto& key : keys) { - if (key.hasPrefix("_ar_") && - key.hasSuffix("_score_type")) + if (key.hasPrefix(AR_PREFIX) && + key.hasSuffix(SCORE_TYPE_SUFFIX)) { ++count; } } return count; }
267-327: Well-structured extraction method with some optimization opportunities.The method effectively extracts analysis results from meta values with a two-phase approach: first identify all indices, then extract data for each index.
Consider the following optimizations:
- Define constants for prefixes and suffixes
- Avoid repeated string operations by pre-computing common strings
- Use a more efficient approach to group related meta values
std::vector<PeptideHit::PepXMLAnalysisResult> PeptideHit::extractAnalysisResultsFromMetaValues_() const { std::vector<PeptideHit::PepXMLAnalysisResult> results; std::vector<String> keys; getKeys(keys); + const String AR_PREFIX = "_ar_"; + const String SCORE_TYPE_SUFFIX = "_score_type"; + // First, find all indices that have analysis results std::set<size_t> indices; for (const auto& key : keys) { - const String prefix = "_ar_"; - const String suffix = "_score_type"; - if (key.hasPrefix(prefix) && - key.hasSuffix(suffix)) + if (key.hasPrefix(AR_PREFIX) && + key.hasSuffix(SCORE_TYPE_SUFFIX)) { - String index_str = key.substr(prefix.size(), key.size() - prefix.size() - suffix.size()); // Extract index from _ar_<index>_score_type" + String index_str = key.substr(AR_PREFIX.size(), key.size() - AR_PREFIX.size() - SCORE_TYPE_SUFFIX.size()); // Extract index from _ar_<index>_score_type" indices.insert(index_str.toInt()); } } // For each index, extract the analysis result for (size_t index : indices) { PeptideHit::PepXMLAnalysisResult ar; - String prefix = "_ar_" + String(index) + "_"; + String prefix = AR_PREFIX + String(index) + "_"; // Get score type if (metaValueExists(prefix + "score_type")) { ar.score_type = getMetaValue(prefix + "score_type").toString(); } // Get main score if (metaValueExists(prefix + "score")) { ar.main_score = getMetaValue(prefix + "score"); } // Get higher_is_better flag if (metaValueExists(prefix + "higher_is_better")) { ar.higher_is_better = getMetaValue(prefix + "higher_is_better").toBool(); } // Get sub-scores String subscore_prefix = prefix + "subscore_"; for (const auto& key : keys) { if (key.hasPrefix(subscore_prefix)) { String subscore_name = key.substr(subscore_prefix.size()); ar.sub_scores[subscore_name] = getMetaValue(key); } } results.push_back(ar); } return results; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
src/openms/include/OpenMS/METADATA/PeptideHit.h(2 hunks)src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp(2 hunks)src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp(1 hunks)src/openms/source/FORMAT/IdXMLFile.cpp(3 hunks)src/openms/source/FORMAT/MzTab.cpp(4 hunks)src/openms/source/METADATA/ID/IdentificationDataConverter.cpp(1 hunks)src/openms/source/METADATA/PeptideHit.cpp(1 hunks)src/openms/source/METADATA/PeptideIdentification.cpp(4 hunks)src/tests/class_tests/openms/source/PeptideIdentification_test.cpp(3 hunks)src/topp/TextExporter.cpp(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/openms/source/FORMAT/MzTab.cpp
🚧 Files skipped from review as they are similar to previous changes (8)
- src/openms/source/METADATA/ID/IdentificationDataConverter.cpp
- src/tests/class_tests/openms/source/PeptideIdentification_test.cpp
- src/topp/TextExporter.cpp
- src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp
- src/openms/source/METADATA/PeptideIdentification.cpp
- src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp
- src/openms/source/FORMAT/IdXMLFile.cpp
- src/openms/include/OpenMS/METADATA/PeptideHit.h
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (windows-2022, cl.exe, default)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: cppcheck-test
🔇 Additional comments (1)
src/openms/source/METADATA/PeptideHit.cpp (1)
244-247: Clean implementation - nicely leverages private helper method.The implementation correctly delegates to the private helper method which improves code organization and maintainability.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors metadata handling in peptide identification and peptide hit classes by moving the significance threshold and analysis results from dedicated member variables to meta values, streamlining class functionality and ensuring consistency in data storage. Key changes include:
- Storing the significance threshold exclusively as a meta value and updating related methods.
- Removing the dedicated analysis_results_ pointer from PeptideHit and replacing its use with meta value based storage and retrieval.
- Updating relevant exporters, converters, and tests to accommodate the new metadata handling approach.
Reviewed Changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/topp/TextExporter.cpp | Extended meta key filtering to remove SIGNIFICANCE_THRESHOLD from peptide identification meta keys. |
| src/tests/class_tests/openms/source/PeptideIdentification_test.cpp | Added tests to verify significance threshold meta value handling. |
| src/tests/class_tests/openms/source/PeptideHit_test.cpp | Added extensive tests for analysis results meta value functionality. |
| src/openms/source/METADATA/PeptideIdentification.cpp | Refactored significance threshold getter/setter to rely on meta values. |
| src/openms/source/METADATA/PeptideHit.cpp | Removed analysis_results_ pointer and implemented meta value based analysis results storage and retrieval. |
| src/openms/source/METADATA/ID/IdentificationDataConverter.cpp, MzTab.cpp, IdXMLFile.cpp, FeatureXMLHandler.cpp, ConsensusXMLHandler.cpp | Updated to remove SIGNIFICANCE_THRESHOLD meta value where appropriate. |
| src/openms/include/OpenMS/METADATA/PeptideIdentification.h, PeptideHit.h, Constants.h | Updated documentation and header declarations to reflect significance threshold as a meta value and removed the legacy member. |
Files not reviewed (3)
- src/tests/topp/IDFileConverter_10_output.idXML: Language not supported
- src/tests/topp/IDFileConverter_16_output.idXML: Language not supported
- src/tests/topp/IDFileConverter_24_output.idXML: Language not supported
This pull request includes several changes to the
PeptideHitandPeptideIdentificationclasses in the OpenMS library to remove rarely used members and handle them as metadata instead.The primary aim is to simplify both classes:
Metadata Handling Improvements:
src/openms/include/OpenMS/CONCEPT/Constants.h: Added a new user parameter name for the significance threshold inPeptideIdentification(SIGNIFICANCE_THRESHOLD).Class Renaming:
src/openms/include/OpenMS/METADATA/PeptideHit.h: IntroducedSpectrumMatchas an alias forPeptideHitto better reflect its purpose.src/openms/include/OpenMS/METADATA/PeptideIdentification.h: IntroducedSpectrumIdentificationas an alias forPeptideIdentificationto better reflect its purpose.Refactoring and Simplification:
src/openms/include/OpenMS/METADATA/PeptideHit.h: Removed theanalysis_results_member variable and replaced it with methods to handle analysis results as meta values. [1] [2]src/openms/source/METADATA/PeptideHit.cpp: Refactored the handling of analysis results to use meta values instead of a separate member variable, including adding and extracting analysis results. [1] [2] [3] [4] [5] [6] [7] [8]Significance Threshold Handling:
src/openms/include/OpenMS/METADATA/PeptideIdentification.h: Updated methods to get and set the significance threshold to use meta values.src/openms/source/METADATA/PeptideIdentification.cpp: Refactored the significance threshold handling to use meta values, ensuring backward compatibility. [1] [2] [3]These changes improve the clarity and maintainability of the code by using more descriptive class names and simplifying the handling of metadata.## Description
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
Refactor
Tests