This function calculates the confidence level for each annotation based on the presence or absence of m/z error, retention time (RT) error, and spectral similarity (SS).

calculate_confidence_level(annotation_result)

Arguments

annotation_result

A data frame containing the annotation results, including the columns `mz.error`, `RT.error`, and `SS`.

Value

A numeric vector of confidence levels (1, 2, or 3) for each annotation in the input data.

Details

The function assigns a confidence level to each annotation according to the following rules:

1

All of `mz.error`, `RT.error`, and `SS` are available (not NA).

2

Any two of the three (`mz.error`, `RT.error`, or `SS`) are available.

3

Only one or none of `mz.error`, `RT.error`, or `SS` is available.

Examples

if (FALSE) { # \dontrun{
# Assuming `my_annotation_result` is the annotation data frame:
confidence_levels <- calculate_confidence_level(my_annotation_result)
} # }