
MethylSurroGetR: DNA Methylation Surrogate Calculations
Source:R/MethylSurroGetR-package.R
MethylSurroGetR-package.RdMethylSurroGetR provides a comprehensive toolkit for calculating DNA methylation surrogate biomarkers from existing studies. The package handles the complete workflow from data preparation through prediction calculation, with robust handling of missing data and flexible transformation options.
Main Workflow Functions
The typical workflow involves four main steps:
surro_setCreate a surrogate object by combining methylation data with surrogate weights
reference_fillFill missing CpG probes using reference values (e.g., from population means)
impute_obsImpute missing observations within samples using mean or median imputation
surro_calcCalculate surrogate predictions with linear, logistic (probability), or Poisson (count) transformations
Data Assessment Functions
methyl_missComprehensive missing data assessment for methylation matrices
Data Conversion Functions
convert_beta_to_mConvert beta values (0-1 scale) to M-values (log-ratio scale)
convert_m_to_betaConvert M-values back to beta values
Sample Datasets
The package includes example datasets for learning and testing:
beta_matrix_compComplete beta value matrix (15 probes × 5 samples)
beta_matrix_missBeta matrix with missing values
mval_matrix_compComplete M-value matrix
mval_matrix_missM-value matrix with missing values
wts_dfExample surrogate weights with three transformation types
ref_dfReference values for missing probe imputation
methyl_surro_compExample complete
methyl_surroobjectmethyl_surro_missExample
methyl_surroobject with missing data
Getting Started
To get started with MethylSurroGetR:
Load your methylation data (beta or M-values) as a matrix with CpG probes as rows and samples as columns
Obtain surrogate weights from a published study or your own model
Follow the basic workflow:
# Create surrogate object my_surro <- surro_set(methyl_matrix, weights_vector, intercept = "Intercept") # Handle missing probes my_surro <- reference_fill(my_surro, reference_values) # Impute missing observations (if needed) my_surro <- impute_obs(my_surro, method = "mean") # Calculate predictions predictions <- surro_calc(my_surro, transform = "linear")See
vignette("MethylSurroGetR")for detailed examples
Key Features
Flexible missing data handling with multiple strategies
Support for linear, logistic (probability), and Poisson (count) transformations
Comprehensive input validation and informative error messages
Detailed diagnostic reporting for transparency
Memory-efficient operations for large-scale datasets
Extensive test coverage ensuring reliability
Author
Maintainer: Joshua A. Goode jagoode@umich.edu (ORCID)