Skip to contents

This function performs beta value adjustment for tumor sample composition based on the original Staaf & Aine approch, correcting betas from a cohort of samples with known sample purities and CpG beta values. More information about this method can be found in the original publication: (Staaf & Aine, PLosOne, 2022). This function allows multi-core execution.

Usage

beta_correction_for_cohorts(
  beta_values,
  tumour_purities,
  set_seed = FALSE,
  seed_num = 2000,
  cores = 1
)

Arguments

beta_values

A matrix with CpGs as rows and tumour samples as columns with the uncorrected beta values from the CpGs of the samples that are intended to be corrected. The values must be numeric, the rows must be named with the CpG ID, and the columns with the sample IDs. An example of the required format is available in the example_betas_reference matrix.

tumour_purities

Named vector containing the purity values of of the samples whose DNA methylation beta values are intended to be corrected. The vector must be named with the sample ID, which must match with the sample IDs from the matrix containing the beta values. An example of the required format is available in the example_purities_reference vector.

set_seed

Default = FALSE. A seed for the FlexMix package to detect the different CpG methylation patterns can be used by setting this argument to TRUE.

seed_num

Default = 2000. The seed to be used when set_seed = TRUE can be specified here.

cores

Default = 1. Number of cores to be used to run the function in parallel.

Value

List containing the original uncorrected beta values (output$betas.original), the corrected tumour beta values (output$betas.tumour) and the corrected microenvironment beta values (output$betas.microenvironment) as matrices with CpGs as rows and tumor samples as columns.

Examples


# Using the default parameters
beta_correction_for_cohorts (beta_values = example_betas_reference,
                             tumour_purities = example_purities_reference)

# Specifying new parameters
beta_correction_for_cohorts (beta_values = example_betas_reference,
                             tumour_purities = example_purities_reference,
                             set_seed = TRUE,
                             seed_num = 1,
                             cores = 5)