The methyl_surro class is the core data structure in MethylSurroGetR. It stores
methylation data aligned with surrogate weights, ready for calculation of surrogate
predictions. Objects of this class are created by surro_set and modified
by reference_fill and impute_obs.
Object Structure
A methyl_surro object is a list with class "methyl_surro" containing:
methylA numeric matrix with CpG sites as rows (with CpG IDs as row names) and samples as columns (with sample IDs as column names). Values represent methylation levels, typically as beta values (0-1 scale) or M-values (log-ratio scale).
weightsA named numeric vector where names are CpG site IDs and values are the regression coefficients for each probe in the surrogate model. The intercept term is stored separately (see below).
interceptA single numeric value representing the intercept term of the surrogate model, or
NULLif no intercept is included.
Creating methyl_surro Objects
Objects are created using surro_set:
Accessing Components
Components can be accessed using standard list notation:
# Access methylation matrix
methyl_data <- my_surro$methyl
# Access weights
weight_values <- my_surro$weights
# Access intercept
intercept_value <- my_surro$interceptModifying methyl_surro Objects
methyl_surro objects can be modified by:
reference_fill: Fills missing probes and/or observations with reference valuesimpute_obs: Imputes missing observations using mean or median values
These functions return modified methyl_surro objects, optionally with additional
statistics components (see below).
Optional Statistics Components
When reference_fill or impute_obs are called with return_stats = TRUE,
the returned object may contain additional components:
reference_fill_statsAn object of class
reference_fill_statscontaining detailed information about the reference filling operation (seereference_fill_stats).imputation_statsAn object of class
imputation_statscontaining detailed information about the imputation operation (seeimputation_stats).
Using methyl_surro Objects
Once properly prepared, methyl_surro objects are used with surro_calc
to calculate surrogate predictions:
# Calculate predictions
predictions <- surro_calc(my_surro, transform = "linear")See also
surro_set for creating objects,
reference_fill and impute_obs for handling missing data,
surro_calc for calculating predictions,
methyl_miss for assessing missing data patterns
