1 | extractSignatures(mutCountMatrix, params, bootStrap = TRUE)
|
mutCountMatrix |
|
params |
|
bootStrap |
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 | ##---- 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 (mutCountMatrix, params, bootStrap = TRUE)
{
num_processesToExtract <- params$num_processesToExtract
approach <- params$approach
algorithm <- params$algorithm
eps <- params$eps
if (bootStrap) {
bstrpd.result <- bootstrapCancerGenomes(mutCountMatrix)
}
else {
bstrpd.result <- mutCountMatrix
}
bstrpd.result[bstrpd.result < eps] <- eps
if (algorithm %in% c("brunet", "alexa")) {
nmf.results <- alexaNMF(v = bstrpd.result, r = num_processesToExtract,
params = params)
}
else {
nmf.results <- chihJenNMF(v = bstrpd.result, r = num_processesToExtract,
params = params)
}
tmp.w <- nmf.results$w
tmp.h <- nmf.results$h
for (jj in 1:num_processesToExtract) {
tmp.tot <- sum(tmp.w[, jj])
tmp.w[, jj] <- tmp.w[, jj]/tmp.tot
tmp.h[jj, ] <- tmp.h[jj, ] * tmp.tot
}
mutCountMatrix.reconstructed <- tmp.w %*% tmp.h
result.list <- list()
result.list$Wk <- tmp.w
result.list$Hk <- tmp.h
result.list$mutCounts.reconstructed <- mutCountMatrix.reconstructed
result.list$mutCounts.errors <- bstrpd.result - mutCountMatrix.reconstructed
if (params$logIterations != "lite") {
result.list$inputMatrix <- bstrpd.result
result.list$cosDist <- proxy::dist(rbind(as.vector(bstrpd.result),
as.vector(mutCountMatrix.reconstructed)), method = "cosine")[1]
}
return(result.list)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.