#Load data for CNV for two control cohorts
data(A112)
raw.signal <- as.matrix(A112[, -c(1,2)])
dimnames(raw.signal)[[1]] <- A112$subject
#Extract CNV signal using principal components
pca.signal <- apply.pca(raw.signal)
#Extract batch, sample and trait information
batches <- factor(A112$cohort)
sample <- factor(A112$subject)
results <- CNVtest.select.model(signal = pca.signal, batch = batches,
sample = sample, n.H0 = 3)
# Best model - with the default model setting this is also
# the number of components
best_model <- results$selected
# Look at the fit
cnv.plot( results[['posteriors']][[best_model]] )
Run the code above in your browser using DataLab