Computes leave-one-out correlations (rDrop) for each CpG

CreateRdrop(data, method = c("pearson", "spearman"), use = "complete.obs")

Arguments

data

a dataframe with rownames = sample IDs, column names = CpG IDs.

method

method for computing correlation, can be "pearson" or "spearman", and is passed to the cor function.

use

method for handling missing values when calculating the correlation. Defaults to "complete.obs" because the option "pairwise.complete.obs" only works for Pearson correlation.

Value

A data frame with the following columns:

  • CpG : CpG ID

  • r_drop : The correlation between each CpG with the sum of the rest of the CpGs

Details

An outlier CpG in a genomic region will typically have low correlation with the rest of the CpGs in a genomic region. On the other hand, in a cluster of co-methylated CpGs, we expect each CpG to have high correlation with the rest of the CpGs. The r.drop statistic is used to identify these co-methylated CpGs here.

Examples

   data(betaMatrix_ex1)

   CreateRdrop(data = betaMatrix_ex1, method = "pearson")
#>          CpG    r_drop
#> 1 cg10170214 0.7359922
#> 2 cg06518233 0.8936653
#> 3 cg18326783 0.8901418
#> 4 cg05229649 0.1862278