Internal structural validator for UME peaklists. Ensures that a peaklist has the correct columns, types, and unique identifiers required for downstream processing such as formula assignment.
Unlike as_peaklist(), this function does not modify the input
except for returning it unchanged if validation succeeds.
Instead, it raises informative errors that indicate what
structural issue was found.
This validator is called automatically inside as_peaklist()
and should not be used directly by end-users.
validate_peaklist(x)The input data.table (invisibly) if validation passes.
A data.table representing a peaklist.
A valid UME peaklist must satisfy the following:
The following columns must exist:
file_id (integer)
file (character; optional for minimal peaklists)
peak_id (integer)
mz (numeric, >= 0)
i_magnitude (numeric)
s_n (numeric; optional)
res (numeric; optional)
Missing optional columns are allowed if they are not explicitly required for downstream operations.
file_id and peak_id must be integer-like
mz, i_magnitude, s_n, res must be numeric
The pair (file_id, peak_id) must be unique.