Learn R Programming

ume (version 1.5.2)

validate_peaklist: Validate UME peaklist structure

Description

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.

Usage

validate_peaklist(x)

Value

The input data.table (invisibly) if validation passes.

Arguments

x

A data.table representing a peaklist.

Details

A valid UME peaklist must satisfy the following:

Required columns

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.

Type requirements

  • file_id and peak_id must be integer-like

  • mz, i_magnitude, s_n, res must be numeric

Uniqueness

The pair (file_id, peak_id) must be unique.