This class is used to switch identification scores within identification or consensus feature maps.
More...
|
| | IDScoreSwitcherAlgorithm () |
| | Default constructor. Initializes the parameter handler with default values.
|
| |
| bool | isScoreType (const std::string &score_name, const ScoreType &type) const |
| | Checks if the given score name corresponds to a specific score type.
|
| |
| bool | isScoreTypeHigherBetter (ScoreType score_type) |
| | Determines whether a higher score type is better given a ScoreType enum.
|
| |
| std::vector< std::string > | getScoreNames () |
| | Gets a vector of all score names that are used in OpenMS.
|
| |
| template<typename IdentificationType > |
| ScoreSearchResult | findScoreType (const IdentificationType &id, ScoreType score_type) const |
| | Searches for a general score type (e.g. PEP, QVAL) in an identification data structure.
|
| |
| template<typename IdentificationType > |
| void | switchScores (IdentificationType &id, Size &counter) |
| | Switches the main scores of all hits in an identification object based on the new scoring settings.
|
| |
| template<class IdentificationType > |
| void | switchToGeneralScoreType (std::vector< IdentificationType > &id, ScoreType type, Size &counter) |
| | Switches the scoring type of identification objects to a general score type.
|
| |
| void | switchToGeneralScoreType (PeptideIdentificationList &pep_ids, ScoreType type, Size &counter) |
| | Switches the score type of a PeptideIdentificationList to a general score type.
|
| |
| void | switchToGeneralScoreType (ConsensusMap &cmap, ScoreType type, Size &counter, bool unassigned_peptides_too=true) |
| | Switches the score type of a ConsensusMap to a general score type.
|
| |
| void | determineScoreNameOrientationAndType (const PeptideIdentificationList &pep_ids, std::string &name, bool &higher_better, ScoreType &score_type) |
| | Determines the score type and orientation of the main score for a set of peptide identifications.
|
| |
| void | determineScoreNameOrientationAndType (const ConsensusMap &cmap, std::string &name, bool &higher_better, ScoreType &score_type, bool include_unassigned=true) |
| | Determines the score type and orientation of the main score in a ConsensusMap.
|
| |
| void | switchScores (ConsensusMap &cmap, Size &counter, bool unassigned_peptides_too=true) |
| | Switches the scores of peptide identifications in a ConsensusMap.
|
| |
| void | switchScores (PeptideIdentificationList &pep_ids, Size &counter) |
| | Switches the scores of peptide identifications.
|
| |
Public Member Functions inherited from DefaultParamHandler |
| | DefaultParamHandler (const std::string &name) |
| | Constructor with name that is displayed in error messages.
|
| |
| | DefaultParamHandler (const DefaultParamHandler &rhs) |
| | Copy constructor.
|
| |
| virtual | ~DefaultParamHandler () |
| | Destructor.
|
| |
| DefaultParamHandler & | operator= (const DefaultParamHandler &rhs) |
| | Assignment operator.
|
| |
| virtual bool | operator== (const DefaultParamHandler &rhs) const |
| | Equality operator.
|
| |
| void | setParameters (const Param ¶m) |
| | Sets the parameters.
|
| |
| const Param & | getParameters () const |
| | Non-mutable access to the parameters.
|
| |
| const Param & | getDefaults () const |
| | Non-mutable access to the default parameters.
|
| |
| const std::string & | getName () const |
| | Non-mutable access to the name.
|
| |
| void | setName (const std::string &name) |
| | Mutable access to the name.
|
| |
| const std::vector< std::string > & | getSubsections () const |
| | Non-mutable access to the registered subsections.
|
| |
|
Protected Member Functions inherited from DefaultParamHandler |
| void | defaultsToParam_ () |
| | Updates the parameters after the defaults have been set in the constructor.
|
| |
Protected Attributes inherited from DefaultParamHandler |
| Param | param_ |
| | Container for current parameters.
|
| |
| Param | defaults_ |
| | Container for default parameters. This member should be filled in the constructor of derived classes!
|
| |
| std::vector< std::string > | subsections_ |
| | Container for registered subsections. This member should be filled in the constructor of derived classes!
|
| |
| std::string | error_name_ |
| | Name that is displayed in error messages during the parameter checking.
|
| |
| bool | check_defaults_ |
| | If this member is set to false no checking if parameters in done;.
|
| |
| bool | warn_empty_defaults_ |
| | If this member is set to false no warning is emitted when defaults are empty;.
|
| |
This class is used to switch identification scores within identification or consensus feature maps.
This class provides functionality to switch the main scoring type used in peptide or protein identification data. It supports switching between different score types, such as raw scores, E-values, posterior probabilities, posterior error probabilities, FDR, and q-values. The class also handles the direction of the score (whether a higher score is better) and can store the original scores as meta values to prevent data loss.
The score switching process is configurable through parameters that specify the score types, as well as the desired score direction and how old scores are annotated in the meta information.
The class can operate on individual identification objects or ConsensusMaps, updating the main scores of all hits based on the specified criteria.
template<typename IdentificationType >
Searches for a general score type (e.g. PEP, QVAL) in an identification data structure.
Returns a ScoreSearchResult for any identification type, checking if the main score of an identification object is already of the requested score type, and if not, searches for scores of that type in the meta values of the first hit.
- Template Parameters
-
- Parameters
-
| [in] | id | The identification object to analyze for scores |
| [in] | score_type | The ScoreType to search for (e.g., ScoreType::PEP, ScoreType::QVAL, etc.) |
- Returns
- ScoreSearchResult containing whether main score is of the requested type and its name.
- Note
- This method only checks the first hit for meta values, similar to other methods in this class.
-
Returns empty score_name if no score of the requested type is found.
References IDScoreSwitcherAlgorithm::ScoreSearchResult::is_main_score_type, and IDScoreSwitcherAlgorithm::ScoreSearchResult::score_name.
Referenced by IDFilter::filterHitsByScore().
template<typename IdentificationType >
| void switchScores |
( |
IdentificationType & |
id, |
|
|
Size & |
counter |
|
) |
| |
|
inline |
Switches the main scores of all hits in an identification object based on the new scoring settings.
This method iterates through all hits in the provided identification object and updates their main scores according to the new scoring settings defined in the switcher class's parameter object. If the old and new score types share the same name (e.g., "q-value"), the method safeguards the original scores by storing them as meta values with a "~" appended to the old score type. This prevents overwriting the meta value of the new score.
- Template Parameters
-
| IdentificationType | The type of the identification object, which must support getHits(), getScoreType(), setScoreType(), and setHigherScoreBetter() methods, along with the ability to handle meta values. |
- Parameters
-
| [in,out] | id | An identification object containing hits whose scores are to be switched. The object will be modified in place, with updated scores and score type. |
| [in,out] | counter | A reference to a Size variable that counts the number of hits processed. |
- Exceptions
-
| Exception::MissingInformation | If a required meta value (specified as the new score) is not found in any of the hits, indicating incomplete or incorrect score setup. |
- Note
- The method assumes that the identification object's hits are properly initialized with all necessary meta values. It also relies on the tolerance_ value to determine significant differences between scores.
References DataValue::isEmpty().
Referenced by IDScoreSwitcherAlgorithm::switchBackScoreType(), and IDScoreSwitcherAlgorithm::switchBackScoreType().
template<class IdentificationType >
| void switchToGeneralScoreType |
( |
std::vector< IdentificationType > & |
id, |
|
|
ScoreType |
type, |
|
|
Size & |
counter |
|
) |
| |
|
inline |
Switches the scoring type of identification objects to a general score type.
This method iterates over a vector of identification objects and changes their scoring type to a specified general score type. It first checks the score type of the first identification object in the vector to determine the necessary conversion. If the first ID does not have the requested score type, an exception is thrown. The method also adjusts the score direction (higher_better_) based on the specified score type if it's different from the raw score.
- Template Parameters
-
| IdentificationType | The type of the identification objects contained in the vector. Must have getScoreType() and other relevant methods for score manipulation. |
- Parameters
-
| [in,out] | id | A vector of identification objects whose score types are to be switched. |
| [in] | type | The desired general score type to switch to. This could be an enum or similar representing different scoring systems (e.g., RAW, LOG, etc.). |
| [in,out] | counter | A reference to a Size variable that may be used to count certain operations or changes made by this method. The exact usage depends on the implementation details and needs. |
- Exceptions
-
| Exception::MissingInformation | If the first identification object in the vector does not have the requested score type, indicating that the operation cannot proceed. |
- Note
- The method assumes that if the first identification object has the correct score type, all subsequent objects in the vector also have the correct score type. This assumption might need validation depending on the use case.
References OPENMS_LOG_WARN.
Referenced by IDScoreSwitcherAlgorithm::switchToScoreType(), and IDScoreSwitcherAlgorithm::switchToScoreType().
Switches the score type of peptide identifications to the requested type.
This static function modifies the provided vector of PeptideIdentification objects by switching their main score to the specified type. If no score type is requested, the original main score is retained. The function determines the original score's name, orientation, and type, and updates these attributes based on the requested score type. If a different score type is requested, it performs the switch and updates the relevant score information.
- Parameters
-
| [in] | pep_ids | A vector of PeptideIdentification objects to be processed. |
| [in] | requested_score_type_as_string | The desired score type as a string (e.g., "RAW", "PEP", "q-value"). |
- Returns
- IDSwitchResult A struct containing details about the original and requested score types, whether a switch was performed, and the number of IDs updated.
References IDScoreSwitcherAlgorithm::determineScoreNameOrientationAndType(), DefaultParamHandler::getDefaults(), IDScoreSwitcherAlgorithm::isScoreTypeHigherBetter(), OPENMS_LOG_DEBUG, IDScoreSwitcherAlgorithm::IDSwitchResult::original_score_higher_better, IDScoreSwitcherAlgorithm::IDSwitchResult::original_score_name, IDScoreSwitcherAlgorithm::IDSwitchResult::original_score_type, IDScoreSwitcherAlgorithm::IDSwitchResult::requested_score_higher_better, IDScoreSwitcherAlgorithm::IDSwitchResult::requested_score_name, IDScoreSwitcherAlgorithm::IDSwitchResult::requested_score_type, IDScoreSwitcherAlgorithm::IDSwitchResult::score_switched, DefaultParamHandler::setParameters(), Param::setValue(), and IDScoreSwitcherAlgorithm::switchToGeneralScoreType().
| static ScoreType toScoreTypeEnum |
( |
const std::string & |
score_type | ) |
|
|
inlinestatic |
Converts a string representation of a score type to a ScoreType enum.
This static method attempts to map a given string, representing a score type, to the corresponding ScoreType enum value. It handles various common representations of score types, including those with or without the "_score" suffix, and ignores case and special characters like '-', '_', and ' '.
- Parameters
-
| [in] | score_type | The string representation of the score type. |
- Returns
- The corresponding ScoreType enum value.
- Exceptions
-