This function checks if the provided `mass_dataset` object is valid for metabolite annotation based on the specified criteria (`ms1`, `rt`, and/or `ms2`). It ensures that the object contains the necessary data for the chosen annotation method.

check_mass_dataset(object, based_on = c("ms1", "rt", "ms2"))

Arguments

object

A `mass_dataset` object containing MS1, RT, and/or MS2 data.

based_on

Character vector. Specifies the criteria to base the validation on. Can include `"ms1"`, `"rt"`, and `"ms2"`. Default is `c("ms1", "rt", "ms2")`.

Value

The function does not return a value but throws an error if any validation checks fail.

Details

The function checks the following: * Ensures that `object` is a valid `mass_dataset` object. * If `"ms2"` is included in `based_on`, it checks that the `mass_dataset` object contains MS2 data (`object@ms2_data`). If no MS2 data is present, the function throws an error.

If any of these conditions are not met, the function will stop with an appropriate error message.

Examples

if (FALSE) { # \dontrun{
# Load a sample mass dataset
my_data <- load_mass_dataset("path/to/dataset")

# Validate the dataset for MS1 and MS2 information
check_mass_dataset(object = my_data, based_on = c("ms1", "ms2"))
} # }