Description Usage Arguments Examples
This function filters and dichotomizes Methylation values of Tumor samples based on the methylation values of Normal samples. This method accounts for the contamination of Tumor tissue with surrounding Normal tissue which routinely confounds methylation analysis of cancer samples
1 | dichotomize(Mset, T, N, index.T, index.N, filter = c("none", "noncg", "sex", "snp", "rpt", "all", "custom"), custom.filter)
|
Mset |
|
T |
|
N |
|
index.T |
|
index.N |
|
filter |
|
custom.filter |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (Mset, T, N, index.T, index.N, filter = c("none", "noncg",
"sex", "snp", "rpt", "all", "custom"), custom.filter)
{
if (!missing(Mset) && is(Mset, "MethylumiSet")) {
if (!missing(T) && !missing(N))
warning("Both MethyLumiSet and Tumor-Normal beta value matrices are provided. Using methyLumiSet for processing \n")
if (missing(index.T) || missing(index.N))
stop("Tumor and Normal sample indices are missing. Cannot process MethyLumiSet \n")
beta <- betas(Mset)
}
if (missing(Mset) && (!missing(T) && (!missing(N)))) {
if (!is(T, "matrix") && !is(N, "matrix"))
stop("Expect Tumor-Normal beta values to be matrices. Please provide valid matrices to proceed \n")
beta <- cbind(T, N)
if (missing(index.T) || missing(index.N)) {
index.T <- 1:ncol(T)
index.N <- (ncol(T) + 1):ncol(beta)
}
}
if (!any(grepl("^cg", rownames(beta))))
stop("Probe names are not standard Illumina 450k probe names \n")
if (missing(filter)) {
filter <- "all"
}
else {
filter <- match.arg(filter, several.ok = TRUE)
}
if (!(all(filter %in% c("none", "noncg", "sex", "snp", "rpt",
"all", "custom"))))
stop("Please provide a valid filter. See '?applyFilters' for valid filters \n")
beta.filtered <- applyFilters(beta, filter, custom.filter = custom.filter)
beta.filtered <- na.omit(beta.filtered)
gc()
betaT.raw <- beta.filtered[, index.T, drop = FALSE]
betaN.raw <- beta.filtered[, index.N, drop = FALSE]
medianN <- apply(betaN.raw, 1, median, na.rm = T)
probesN <- names(subset(medianN, medianN < 0.2))
betaT.dichotomized <- betaT.raw[probesN, , drop = FALSE]
betaT.dichotomized <- betaT.dichotomized > 0.3
storage.mode(betaT.dichotomized) <- "numeric"
betaN.dichotomized <- betaN.raw > 0.3
storage.mode(betaN.dichotomized) <- "numeric"
retval <- SimpleList()
retval$RAW <- SimpleList(Tumor.Raw = betaT.raw, Normal.Raw = betaN.raw)
retval$DICHOTOMIZED <- SimpleList(Tumor.Dichotomized = betaT.dichotomized,
Normal.Dichotomized = betaN.dichotomized)
gc()
return(retval)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.