examples/example.R

# load example data
# example data is generated as the combined study, where reference data is generated 
# from six previous studies and the mixture has 100 samples generated by the mixture model
# with t-distribution (d.f. = 1).

load('./data/etaexample.RData') #eta: tumor purity
load('./data/muexample.RData') #mu: reference data
load('./data/nu0example.RData') #nu0: true methylation of unknown cell type 
load('./data/Yexample.RData') #Y: sample methylation
load('./data/mixexample.RData') #rho.true: true proportion of each cell type
penalty= (dim(mu)[1])*(10^seq(-2,1,0.5)) 
source('../R/utils.R')
source('../R/cv.emeth.R')
source('../R/emeth.R')
cellTypes = colnames(mu)

# run EMeth  
print('LaplaceEM')
hundrediter_laplace = cv.emeth(Y,eta,mu,aber = TRUE, V='c', init = 'default',
                               family = 'laplace', nu = penalty, folds = 5, 
                               maxiter = 50, verbose = TRUE)
rho.laplace = hundrediter_laplace[[1]]$rho

print('NormalEM')
hundrediter = cv.emeth(Y,eta,mu,aber = TRUE, V='c', init = 'default',
                       family = 'normal', nu = penalty, folds = 5, 
                       maxiter = 50, verbose = TRUE)
rho.normal = hundrediter[[1]]$rho
Hanyuz1996/EMeth documentation built on Dec. 31, 2020, 12:59 p.m.